[{"data":1,"prerenderedAt":3938},["ShallowReactive",2],{"blog-posts-all":3},[4,336,1441],{"id":5,"title":6,"author":7,"body":8,"description":317,"draft":318,"extension":319,"image":320,"lang":321,"meta":322,"navigation":324,"path":325,"publishedAt":326,"seo":327,"seoTitle":328,"stem":329,"tags":330,"updatedAt":334,"__hash__":335},"blog\u002Fblog\u002Fvad-kostar-en-hemsida.md","Vad kostar en hemsida 2026? Så räknar du, och så räknar vi","Anton Andresen",{"type":9,"value":10,"toc":307},"minimark",[11,15,19,28,33,40,46,52,55,59,65,71,77,83,89,95,99,106,131,134,216,219,223,226,232,238,244,252,256,259,262,265,269,272,296,299],[12,13,6],"h1",{"id":14},"vad-kostar-en-hemsida-2026-så-räknar-du-och-så-räknar-vi",[16,17,18],"p",{},"Det korta svaret är att det beror på tre saker: hur hemsidan byggs, vad den ska kunna och vem som sköter den när den väl är uppe. Den sista punkten glöms ofta bort, och det är där de flesta överraskningar dyker upp.",[16,20,21,22,27],{},"Den här texten går igenom hur prissättningen brukar fungera, vad som faktiskt driver kostnaden och vad det kostar hos oss. Alla våra priser står också på ",[23,24,26],"a",{"href":25},"\u002Fse\u002Fpricing","prissidan",".",[29,30,32],"h2",{"id":31},"tre-sätt-att-betala-för-en-hemsida","Tre sätt att betala för en hemsida",[16,34,35,39],{},[36,37,38],"strong",{},"Gör det själv."," Med en hemsidebyggare betalar du en låg månadsavgift och bygger sajten själv. Det är billigast i kronor, men du betalar med din egen tid. Design, texter, bilder, lokal SEO och uppdateringar blir ditt ansvar.",[16,41,42,45],{},[36,43,44],{},"Engångspris."," En byrå eller frilansare bygger hemsidan och du betalar för bygget i förväg. Sedan tillkommer webbhotell, domän och ändringar. Ändringar efter lansering debiteras ofta per timme, så den totala kostnaden över några år är svår att veta från början.",[16,47,48,51],{},[36,49,50],{},"Abonnemang."," Du betalar ett fast pris i månaden som täcker bygget, driften och underhållet. Det är så vi arbetar med våra hemsidepaket. Kostnaden blir förutsägbar, men du binder dig till en avtalsperiod.",[16,53,54],{},"Inget av alternativen är rätt för alla. Längre ner finns några frågor som gör det lättare att välja.",[29,56,58],{"id":57},"det-här-driver-priset","Det här driver priset",[16,60,61,64],{},[36,62,63],{},"Antal sidor."," En enkel företagssida har oftast en startsida, en sida om tjänsterna, en om företaget och en kontaktsida. Vårt baspaket omfattar 5–7 sidor. Behöver du fler kostar en extra sida 500 kr, en gång.",[16,66,67,70],{},[36,68,69],{},"Funktioner."," Det är här skillnaderna blir stora. Onlinebokning, webbshop, flera språk och kopplingar till andra system kräver mer utveckling och mer underhåll än en ren informationssida.",[16,72,73,76],{},[36,74,75],{},"Innehåll."," Någon måste ta fram texter och bilder. Om du har dem klara går det fortare. Hos oss hjälper vi till med texter och bilder, och det ingår i priset.",[16,78,79,82],{},[36,80,81],{},"Drift."," En hemsida behöver webbhotell, SSL-certifikat och någon som håller den uppdaterad. I ett engångsköp är det ofta separata kostnader. Hos oss ingår webbhotell och SSL i månadspriset.",[16,84,85,88],{},[36,86,87],{},"Domän."," Domänen, till exempel dittforetag.se, tillkommer nästan alltid. Den brukar kosta runt 49 kr i månaden. Har du redan en domän kan du ta med den.",[16,90,91,94],{},[36,92,93],{},"Moms."," Priser till företag anges oftast exklusive moms. Kom ihåg att 25 % moms tillkommer på fakturan.",[29,96,98],{"id":97},"våra-priser","Våra priser",[16,100,101,102,105],{},"Baspaketet kostar ",[36,103,104],{},"2 999 kr i månaden"," exklusive moms. Det innehåller:",[107,108,109,113,116,119,122,125,128],"ul",{},[110,111,112],"li",{},"Responsiv hemsida med 5–7 sidor",[110,114,115],{},"Modern design som fungerar på mobil",[110,117,118],{},"Kontaktformulär",[110,120,121],{},"Grundläggande SEO (metataggar och sitemap)",[110,123,124],{},"Webbhotell och SSL-certifikat",[110,126,127],{},"Grundläggande besöksstatistik",[110,129,130],{},"En omgång revideringar före lansering",[16,132,133],{},"Tillägg, per månad exklusive moms:",[135,136,137,150],"table",{},[138,139,140],"thead",{},[141,142,143,147],"tr",{},[144,145,146],"th",{},"Tillägg",[144,148,149],{},"Pris per månad",[151,152,153,162,170,177,185,192,200,208],"tbody",{},[141,154,155,159],{},[156,157,158],"td",{},"Onlinebokning",[156,160,161],{},"2 000 kr",[141,163,164,167],{},[156,165,166],{},"Webbshop och onlinebeställning",[156,168,169],{},"1 500 kr",[141,171,172,175],{},[156,173,174],{},"Anpassade integrationer",[156,176,169],{},[141,178,179,182],{},[156,180,181],{},"Blogg och innehållshantering",[156,183,184],{},"1 200 kr",[141,186,187,190],{},[156,188,189],{},"Prioriterad support med 3 timmar underhåll",[156,191,184],{},[141,193,194,197],{},[156,195,196],{},"Avancerad SEO och analys",[156,198,199],{},"800 kr",[141,201,202,205],{},[156,203,204],{},"Fler språk",[156,206,207],{},"500 kr per extra språk",[141,209,210,213],{},[156,211,212],{},"Nyhetsbrev",[156,214,215],{},"400 kr",[16,217,218],{},"På våra branschpaket väljer du avtal på 12, 24 eller 36 månader. Ett avtal på 24 månader ger 10 % rabatt på månadspriset och 36 månader ger 20 %.",[29,220,222],{"id":221},"tre-räkneexempel","Tre räkneexempel",[16,224,225],{},"Exemplen räknar med 12 månaders avtal om inget annat står. Priserna är exklusive moms och domän.",[16,227,228,231],{},[36,229,230],{},"1. En konsultfirma som vill synas."," Fem sidor, kontaktformulär, inga extra funktioner. Baspaketet räcker: 2 999 kr i månaden, eller 3 749 kr inklusive moms.",[16,233,234,237],{},[36,235,236],{},"2. En frisörsalong med onlinebokning."," Baspaketet plus onlinebokning: 2 999 + 2 000 = 4 999 kr i månaden. Med 24 månaders avtal blir det 4 499 kr, och med 36 månader 3 999 kr.",[16,239,240,243],{},[36,241,242],{},"3. En restaurang med bordsbokning och beställning."," Baspaketet, onlinebokning för bord och onlinebeställning: 2 999 + 2 000 + 1 500 = 6 499 kr i månaden.",[16,245,246,247,251],{},"Vill du räkna på din egen kombination finns en kalkylator på sidan om ",[23,248,250],{"href":249},"\u002Fse\u002Fwebsite-offer","våra hemsidepaket",". Där ser du också totalen inklusive moms.",[29,253,255],{"id":254},"engångspris-eller-abonnemang","Engångspris eller abonnemang?",[16,257,258],{},"Ett engångsköp kan passa dig som har någon i företaget som kan sköta tekniken, eller som vill ha full kontroll över drift och leverantörer. Räkna då med att ändringar, uppdateringar och webbhotell kostar extra över tid.",[16,260,261],{},"Ett abonnemang passar dig som vill ha en fast kostnad och slippa tänka på tekniken. Nackdelen är bindningstiden, och att du är beroende av leverantören så länge avtalet löper.",[16,263,264],{},"Fråga därför vad som händer när avtalet tar slut. Hos oss gäller att om du har ett avtal på 24 månader eller längre äger du hemsidan när avtalstiden är slut. Vi skickar då över all källkod och data, så att du kan driva den själv eller ta den till en annan leverantör.",[29,266,268],{"id":267},"frågor-att-ställa-innan-du-köper","Frågor att ställa innan du köper",[16,270,271],{},"Oavsett vem du köper av, ställ de här frågorna innan du skriver på:",[273,274,275,278,281,284,287,290,293],"ol",{},[110,276,277],{},"Vad ingår i priset, och vad kostar en ändring efter lansering?",[110,279,280],{},"Vem äger domänen?",[110,282,283],{},"Hur lång är bindningstiden, och vad händer när den tar slut?",[110,285,286],{},"Vem äger hemsidan och koden efter avtalstiden, och får jag ut den?",[110,288,289],{},"Ingår webbhotell, SSL och säkerhetsuppdateringar?",[110,291,292],{},"Är priset med eller utan moms?",[110,294,295],{},"Vem kontaktar jag om något slutar fungera, och hur snabbt får jag svar?",[16,297,298],{},"Om svaren är tydliga är det oftast ett gott tecken. Är de luddiga, fråga igen.",[16,300,301,302,306],{},"Har du frågor om just din hemsida kan du ",[23,303,305],{"href":304},"\u002Fse\u002Fcontact","höra av dig till oss",". Vi svarar inom 24 timmar.",{"title":308,"searchDepth":309,"depth":309,"links":310},"",2,[311,312,313,314,315,316],{"id":31,"depth":309,"text":32},{"id":57,"depth":309,"text":58},{"id":97,"depth":309,"text":98},{"id":221,"depth":309,"text":222},{"id":254,"depth":309,"text":255},{"id":267,"depth":309,"text":268},"Vad kostar en hemsida för ett företag? Vi går igenom engångspris, abonnemang och gör-det-själv, vad som driver priset och tre räkneexempel med våra priser.",false,"md","\u002Fimages\u002Fblog\u002Fvad-kostar-en-hemsida.jpg","sv",{"readTime":323},"4 min",true,"\u002Fblog\u002Fvad-kostar-en-hemsida","2026-10-21",{"title":6,"description":317},"Vad kostar en hemsida 2026? Priser och exempel","blog\u002Fvad-kostar-en-hemsida",[331,332,333],"Hemsida","Priser","Småföretag",null,"oIxSpdsjqJ6P2PTZ81Ly-EQbz8t4SB3aP3xM_MtC3ig",{"id":337,"title":338,"author":7,"body":339,"description":1427,"draft":318,"extension":319,"image":1428,"lang":1429,"meta":1430,"navigation":324,"path":1432,"publishedAt":326,"seo":1433,"seoTitle":334,"stem":1434,"tags":1435,"updatedAt":334,"__hash__":1440},"blog\u002Fblog\u002Fwhat-breaks-when-you-connect-10-social-media-apis.md","What breaks when you connect 10 social media APIs",{"type":9,"value":340,"toc":1416},[341,344,347,350,354,357,360,363,629,632,639,642,646,649,750,761,764,771,778,782,796,803,896,899,903,906,1081,1084,1091,1094,1132,1136,1139,1142,1145,1149,1166,1173,1176,1191,1195,1198,1205,1384,1387,1391,1398,1402,1412],[12,342,338],{"id":343},"what-breaks-when-you-connect-10-social-media-apis",[16,345,346],{},"Pogton Connect does two things. Your users open a branded connect page and link their social accounts. Your backend then publishes to those accounts through one REST API. Behind that API sit ten platforms: X, LinkedIn, Instagram, Facebook, TikTok, YouTube, Pinterest, Threads, Bluesky and Google Business Profile.",[16,348,349],{},"On paper they all speak OAuth 2.0 and accept a POST with some text and an image. In practice almost every step differs. This post goes through the places where things broke or got more complicated than we expected, and what the code does about each one. It is meant for developers who are deciding whether to build this themselves.",[29,351,353],{"id":352},"ten-platforms-three-kinds-of-login","Ten platforms, three kinds of login",[16,355,356],{},"Nine of the ten use an OAuth 2.0 authorization code flow. Bluesky does not. It uses an app password that the user generates in their Bluesky settings, so the connect page shows a handle and password form instead of a redirect.",[16,358,359],{},"The nine OAuth platforms need six registered apps, not nine. Instagram, Facebook and Threads all run on one Meta app. Threads still has its own authorize URL on threads.net and its own token endpoint on graph.threads.net, so \"same app\" does not mean \"same flow\". YouTube and Google Business share one Google client, with different scopes.",[16,361,362],{},"The authorization request itself is where the first special cases show up:",[364,365,369],"pre",{"className":366,"code":367,"language":368,"meta":308,"style":308},"language-ts shiki shiki-themes github-light github-dark","const params = new URLSearchParams({\n  client_id: platformConfig.clientId,\n  redirect_uri: redirectUri,\n  \u002F\u002F TikTok wants comma-separated scopes, everyone else spaces\n  scope: platformConfig.scopes.join(platform === 'tiktok' ? ',' : ' '),\n  response_type: 'code',\n  state,\n})\n\n\u002F\u002F TikTok calls the client ID `client_key`\nif (platform === 'tiktok') {\n  params.delete('client_id')\n  params.set('client_key', platformConfig.clientId)\n}\n\n\u002F\u002F Google (YouTube + Business Profile) only returns a refresh token with\n\u002F\u002F access_type=offline, and only reliably on re-consent with prompt=consent\nif (platform === 'youtube' || platform === 'google_business') {\n  params.set('access_type', 'offline')\n  params.set('prompt', 'consent')\n}\n","ts",[370,371,372,399,404,410,417,451,463,469,475,481,487,503,521,537,543,548,554,560,585,605,624],"code",{"__ignoreMap":308},[373,374,377,381,385,388,391,395],"span",{"class":375,"line":376},"line",1,[373,378,380],{"class":379},"szBVR","const",[373,382,384],{"class":383},"sj4cs"," params",[373,386,387],{"class":379}," =",[373,389,390],{"class":379}," new",[373,392,394],{"class":393},"sScJk"," URLSearchParams",[373,396,398],{"class":397},"sVt8B","({\n",[373,400,401],{"class":375,"line":309},[373,402,403],{"class":397},"  client_id: platformConfig.clientId,\n",[373,405,407],{"class":375,"line":406},3,[373,408,409],{"class":397},"  redirect_uri: redirectUri,\n",[373,411,413],{"class":375,"line":412},4,[373,414,416],{"class":415},"sJ8bj","  \u002F\u002F TikTok wants comma-separated scopes, everyone else spaces\n",[373,418,420,423,426,429,432,436,439,442,445,448],{"class":375,"line":419},5,[373,421,422],{"class":397},"  scope: platformConfig.scopes.",[373,424,425],{"class":393},"join",[373,427,428],{"class":397},"(platform ",[373,430,431],{"class":379},"===",[373,433,435],{"class":434},"sZZnC"," 'tiktok'",[373,437,438],{"class":379}," ?",[373,440,441],{"class":434}," ','",[373,443,444],{"class":379}," :",[373,446,447],{"class":434}," ' '",[373,449,450],{"class":397},"),\n",[373,452,454,457,460],{"class":375,"line":453},6,[373,455,456],{"class":397},"  response_type: ",[373,458,459],{"class":434},"'code'",[373,461,462],{"class":397},",\n",[373,464,466],{"class":375,"line":465},7,[373,467,468],{"class":397},"  state,\n",[373,470,472],{"class":375,"line":471},8,[373,473,474],{"class":397},"})\n",[373,476,478],{"class":375,"line":477},9,[373,479,480],{"emptyLinePlaceholder":324},"\n",[373,482,484],{"class":375,"line":483},10,[373,485,486],{"class":415},"\u002F\u002F TikTok calls the client ID `client_key`\n",[373,488,490,493,496,498,500],{"class":375,"line":489},11,[373,491,492],{"class":379},"if",[373,494,495],{"class":397}," (platform ",[373,497,431],{"class":379},[373,499,435],{"class":434},[373,501,502],{"class":397},") {\n",[373,504,506,509,512,515,518],{"class":375,"line":505},12,[373,507,508],{"class":397},"  params.",[373,510,511],{"class":393},"delete",[373,513,514],{"class":397},"(",[373,516,517],{"class":434},"'client_id'",[373,519,520],{"class":397},")\n",[373,522,524,526,529,531,534],{"class":375,"line":523},13,[373,525,508],{"class":397},[373,527,528],{"class":393},"set",[373,530,514],{"class":397},[373,532,533],{"class":434},"'client_key'",[373,535,536],{"class":397},", platformConfig.clientId)\n",[373,538,540],{"class":375,"line":539},14,[373,541,542],{"class":397},"}\n",[373,544,546],{"class":375,"line":545},15,[373,547,480],{"emptyLinePlaceholder":324},[373,549,551],{"class":375,"line":550},16,[373,552,553],{"class":415},"\u002F\u002F Google (YouTube + Business Profile) only returns a refresh token with\n",[373,555,557],{"class":375,"line":556},17,[373,558,559],{"class":415},"\u002F\u002F access_type=offline, and only reliably on re-consent with prompt=consent\n",[373,561,563,565,567,569,572,575,578,580,583],{"class":375,"line":562},18,[373,564,492],{"class":379},[373,566,495],{"class":397},[373,568,431],{"class":379},[373,570,571],{"class":434}," 'youtube'",[373,573,574],{"class":379}," ||",[373,576,577],{"class":397}," platform ",[373,579,431],{"class":379},[373,581,582],{"class":434}," 'google_business'",[373,584,502],{"class":397},[373,586,588,590,592,594,597,600,603],{"class":375,"line":587},19,[373,589,508],{"class":397},[373,591,528],{"class":393},[373,593,514],{"class":397},[373,595,596],{"class":434},"'access_type'",[373,598,599],{"class":397},", ",[373,601,602],{"class":434},"'offline'",[373,604,520],{"class":397},[373,606,608,610,612,614,617,619,622],{"class":375,"line":607},20,[373,609,508],{"class":397},[373,611,528],{"class":393},[373,613,514],{"class":397},[373,615,616],{"class":434},"'prompt'",[373,618,599],{"class":397},[373,620,621],{"class":434},"'consent'",[373,623,520],{"class":397},[373,625,627],{"class":375,"line":626},21,[373,628,542],{"class":397},[16,630,631],{},"X adds PKCE on top: a code verifier in a short-lived cookie and its SHA-256 challenge in the URL. At the token exchange X also wants the client credentials in a Basic auth header, where other platforms take them in the form body.",[16,633,634,635,638],{},"Between the redirect and the callback we need to remember who is connecting. That goes in an httpOnly cookie that lives for 10 minutes and holds the OAuth ",[370,636,637],{},"state",", the org, the end user's ID and the options from their connect link. The cookie is signed with an HMAC. An unsigned cookie would let a visitor edit it and attach their social account to somebody else's user ID.",[16,640,641],{},"Scope lists also vary a lot. Google Business needs one scope; LinkedIn needs several, because posting as a company page needs organization scopes on top of the member ones. Every extra feature, such as reading comments or analytics, tends to mean another scope, and most of them sit behind the platform's app review.",[29,643,645],{"id":644},"every-platform-refreshes-tokens-differently","Every platform refreshes tokens differently",[16,647,648],{},"Access tokens expire. How you get a new one depends on the platform, and the differences go beyond the URL:",[135,650,651,661],{},[138,652,653],{},[141,654,655,658],{},[144,656,657],{},"Platform",[144,659,660],{},"How the token stays alive",[151,662,663,674,684,694,711,723,734,742],{},[141,664,665,668],{},[156,666,667],{},"X",[156,669,670,673],{},[370,671,672],{},"refresh_token"," grant, client credentials in a Basic auth header",[141,675,676,679],{},[156,677,678],{},"Pinterest",[156,680,681,683],{},[370,682,672],{}," grant, Basic auth header",[141,685,686,689],{},[156,687,688],{},"YouTube, Google Business",[156,690,691,693],{},[370,692,672],{}," grant to Google's token endpoint",[141,695,696,699],{},[156,697,698],{},"TikTok",[156,700,701,703,704,707,708],{},[370,702,672],{}," grant with ",[370,705,706],{},"client_key"," instead of ",[370,709,710],{},"client_id",[141,712,713,716],{},[156,714,715],{},"Instagram, Facebook",[156,717,718,719,722],{},"No refresh token. The long-lived token is exchanged again with ",[370,720,721],{},"fb_exchange_token"," before it runs out",[141,724,725,728],{},[156,726,727],{},"Threads",[156,729,730,731],{},"No refresh token. The long-lived token refreshes itself with ",[370,732,733],{},"th_refresh_token",[141,735,736,739],{},[156,737,738],{},"LinkedIn",[156,740,741],{},"Nothing. For most apps the user has to reconnect after 60 days",[141,743,744,747],{},[156,745,746],{},"Bluesky",[156,748,749],{},"Nothing. App passwords don't expire",[16,751,752,753,756,757,760],{},"Two more details matter. Some platforms rotate the refresh token, so every response may contain a new one that must replace the old one. Response shapes differ too: TikTok nests the tokens under ",[370,754,755],{},"data",", and some platforms leave out ",[370,758,759],{},"expires_in",", so the code falls back to the documented lifetime.",[16,762,763],{},"Refreshing happens in two places. Once an hour, a scheduled job refreshes every account whose token expires within the next 48 hours. And right before publishing, the publisher checks the token again and refreshes it if it expires within five minutes. The second check matters more than it sounds: a post scheduled for 09:00 should not fail because the hourly job last ran at 08:00.",[16,765,766,767,770],{},"LinkedIn is the case that affects product design. With no refresh grant, a connected LinkedIn account stops working after 60 days, and nothing on our side can fix that silently. When a platform rejects a token, the account is marked as needing a reconnect and the customer gets an ",[370,768,769],{},"account.needs_reauth"," webhook. They then create a connect link with the account's ID, and the page asks the user to reconnect only that platform.",[16,772,773,774,777],{},"Bluesky has the opposite problem. There is no token to refresh, so we store the handle and app password, encrypted, and open a session against the user's PDS when publishing. Sessions are cached for a few minutes, because ",[370,775,776],{},"createSession"," is rate limited. All tokens and secrets are encrypted at rest with AES-256-GCM.",[29,779,781],{"id":780},"one-login-several-accounts","One login, several accounts",[16,783,784,785,788,789,792,793,27],{},"A single OAuth login often gives you access to more than one thing you can post to. One LinkedIn login can administer several company pages. A Facebook login comes with the pages the person manages. An Instagram business account is not something you log into directly through this flow. It hangs off a Facebook page as ",[370,786,787],{},"instagram_business_account",". A Google login can own several YouTube channels. Google Business is two levels deep: we list accounts through one Google API, then locations under each account through a second one. Posts and reviews then need the full ",[370,790,791],{},"accounts\u002F{a}\u002Flocations\u002F{l}"," path, while the listing API returns ",[370,794,795],{},"locations\u002F{l}",[16,797,798,799,802],{},"So the callback cannot simply save \"the account\". After the token exchange, a ",[370,800,801],{},"fetchSubAccounts"," function that knows each platform's listing endpoint finds what the user can post to. These calls are allowed to fail. If the page listing for LinkedIn errors, the user still gets their personal profile.",[364,804,806],{"className":366,"code":805,"language":368,"meta":308,"style":308},"\u002F\u002F Hold the tokens and the discovered accounts for 10 minutes\nawait convex.mutation(api.connect.createOAuthSession, {\n  sessionToken,\n  accessToken: encrypt(accessToken),\n  refreshToken: refreshToken ? encrypt(refreshToken) : undefined,\n  availableAccounts: enrichedAccounts, \u002F\u002F each flagged alreadyConnected\n  \u002F\u002F ...\n})\n\n\u002F\u002F Single-account platforms are saved directly; the rest go to a picker\n\u002F\u002F where the user ticks pages, channels or locations\n",[370,807,808,813,827,832,843,865,873,878,882,886,891],{"__ignoreMap":308},[373,809,810],{"class":375,"line":376},[373,811,812],{"class":415},"\u002F\u002F Hold the tokens and the discovered accounts for 10 minutes\n",[373,814,815,818,821,824],{"class":375,"line":309},[373,816,817],{"class":379},"await",[373,819,820],{"class":397}," convex.",[373,822,823],{"class":393},"mutation",[373,825,826],{"class":397},"(api.connect.createOAuthSession, {\n",[373,828,829],{"class":375,"line":406},[373,830,831],{"class":397},"  sessionToken,\n",[373,833,834,837,840],{"class":375,"line":412},[373,835,836],{"class":397},"  accessToken: ",[373,838,839],{"class":393},"encrypt",[373,841,842],{"class":397},"(accessToken),\n",[373,844,845,848,851,854,857,860,863],{"class":375,"line":419},[373,846,847],{"class":397},"  refreshToken: refreshToken ",[373,849,850],{"class":379},"?",[373,852,853],{"class":393}," encrypt",[373,855,856],{"class":397},"(refreshToken) ",[373,858,859],{"class":379},":",[373,861,862],{"class":383}," undefined",[373,864,462],{"class":397},[373,866,867,870],{"class":375,"line":453},[373,868,869],{"class":397},"  availableAccounts: enrichedAccounts, ",[373,871,872],{"class":415},"\u002F\u002F each flagged alreadyConnected\n",[373,874,875],{"class":375,"line":465},[373,876,877],{"class":415},"  \u002F\u002F ...\n",[373,879,880],{"class":375,"line":471},[373,881,474],{"class":397},[373,883,884],{"class":375,"line":477},[373,885,480],{"emptyLinePlaceholder":324},[373,887,888],{"class":375,"line":483},[373,889,890],{"class":415},"\u002F\u002F Single-account platforms are saved directly; the rest go to a picker\n",[373,892,893],{"class":375,"line":489},[373,894,895],{"class":415},"\u002F\u002F where the user ticks pages, channels or locations\n",[16,897,898],{},"Each connected account is keyed by end user, platform and sub-account ID. Reconnecting the same page updates its tokens and clears the reconnect flag instead of creating a duplicate, which matters once LinkedIn users start reconnecting every 60 days.",[29,900,902],{"id":901},"media-and-text-rules-do-not-line-up","Media and text rules do not line up",[16,904,905],{},"Your API wants one request shape: some text and a list of media. Each platform wants something else:",[135,907,908,926],{},[138,909,910],{},[141,911,912,914,918,921,924],{},[144,913,657],{},[144,915,917],{"align":916},"right","Text limit",[144,919,920],{"align":916},"Media per post",[144,922,923],{},"Formats",[144,925,727],{},[151,927,928,944,960,976,992,1006,1020,1034,1050,1065],{},[141,929,930,932,935,938,941],{},[156,931,667],{},[156,933,934],{"align":916},"280 (weighted)",[156,936,937],{"align":916},"4 images, or 1 video or GIF",[156,939,940],{},"text, image, video",[156,942,943],{},"Yes",[141,945,946,948,951,954,957],{},[156,947,738],{},[156,949,950],{"align":916},"3,000",[156,952,953],{"align":916},"20 images, 1 video or 1 document",[156,955,956],{},"text, images, video, PDF, poll, article",[156,958,959],{},"No",[141,961,962,965,968,971,974],{},[156,963,964],{},"Instagram",[156,966,967],{"align":916},"2,200",[156,969,970],{"align":916},"20",[156,972,973],{},"image, carousel, Reel, Story",[156,975,959],{},[141,977,978,981,984,987,990],{},[156,979,980],{},"Facebook",[156,982,983],{"align":916},"63,206",[156,985,986],{"align":916},"10 photos or 1 video",[156,988,989],{},"text, photos, video, Reel",[156,991,959],{},[141,993,994,996,999,1001,1004],{},[156,995,727],{},[156,997,998],{"align":916},"500",[156,1000,970],{"align":916},[156,1002,1003],{},"text, image, video, carousel",[156,1005,943],{},[141,1007,1008,1010,1013,1016,1018],{},[156,1009,746],{},[156,1011,1012],{"align":916},"300 graphemes",[156,1014,1015],{"align":916},"4 images or 1 video",[156,1017,940],{},[156,1019,943],{},[141,1021,1022,1024,1026,1029,1032],{},[156,1023,698],{},[156,1025,967],{"align":916},[156,1027,1028],{"align":916},"1 video or 35 photos",[156,1030,1031],{},"video, photo carousel",[156,1033,959],{},[141,1035,1036,1039,1042,1045,1048],{},[156,1037,1038],{},"YouTube",[156,1040,1041],{"align":916},"5,000",[156,1043,1044],{"align":916},"1 video",[156,1046,1047],{},"video, Short",[156,1049,959],{},[141,1051,1052,1054,1057,1060,1063],{},[156,1053,678],{},[156,1055,1056],{"align":916},"800",[156,1058,1059],{"align":916},"5",[156,1061,1062],{},"image, carousel, video pin",[156,1064,959],{},[141,1066,1067,1070,1073,1076,1079],{},[156,1068,1069],{},"Google Business",[156,1071,1072],{"align":916},"1,500",[156,1074,1075],{"align":916},"1 photo",[156,1077,1078],{},"update, event, offer",[156,1080,959],{},[16,1082,1083],{},"Even the text limit hides differences. X counts URLs as 23 characters and most CJK characters and emoji as two. Bluesky counts graphemes, so a family emoji is one character, but its rich text facets (links, mentions, hashtags) are addressed by UTF-8 byte offsets, so an emoji or an \"å\" shifts every offset after it. We validate all of this before anything is sent, so a post that one platform will reject fails at the API call with a field-level error instead of an hour later in a webhook. The same check is available on its own as a dry run.",[16,1085,1086,1087,1090],{},"Each platform also has options that only make sense there: TikTok's privacy level (required, and the creator's account decides which levels are allowed), YouTube's title and playlist, Pinterest's board, Instagram's Reel cover, LinkedIn's visibility, Threads' reply controls. Each platform module has its own option schema, and ",[370,1088,1089],{},"GET \u002Fapi\u002Fv1\u002Fplatforms"," publishes the limits and the JSON schema of every option, so customers can build their UI from it.",[16,1092,1093],{},"The table also hides how different the upload paths are:",[107,1095,1096,1101,1106,1112,1117,1122,1127],{},[110,1097,1098,1100],{},[36,1099,667],{},": images are uploaded in one request; videos and GIFs go through a chunked initialize, append and finalize flow, then you wait for processing before the post can reference the media.",[110,1102,1103,1105],{},[36,1104,738],{},": each asset type has its own API (images, videos, documents). Initialize the upload, PUT the bytes to the URLs LinkedIn returns, finalize, then reference the asset URN in the post. LinkedIn doesn't scrape links, so a link card means fetching the page's Open Graph data and uploading the thumbnail yourself.",[110,1107,1108,1111],{},[36,1109,1110],{},"Instagram and Threads",": create a media container, wait for it to finish processing, then publish the container in a second call. A carousel means one container per item, a parent container, then publish.",[110,1113,1114,1116],{},[36,1115,980],{},": a multi-photo post means uploading each photo as unpublished first, then attaching the photo IDs to a feed post. Videos and Reels are uploaded by URL and processed asynchronously.",[110,1118,1119,1121],{},[36,1120,698],{},": you ask the creator's account what it allows first, then either let TikTok pull the file from a URL (only from domains you have verified with TikTok) or upload it in chunks. Publishing is asynchronous: you poll a status endpoint until the post is live.",[110,1123,1124,1126],{},[36,1125,1038],{},": a resumable upload. More on that below.",[110,1128,1129,1131],{},[36,1130,1069],{},": one photo by URL, and posts can come back as \"processing\" or \"rejected\".",[29,1133,1135],{"id":1134},"long-uploads-in-short-functions","Long uploads in short functions",[16,1137,1138],{},"Pogton runs on serverless functions with a time limit measured in seconds. A YouTube video can be gigabytes. So no publish call is allowed to wait for a platform to finish.",[16,1140,1141],{},"Instead, a platform module can answer \"processing\" and save what it needs to continue: a container ID, a TikTok publish ID, a YouTube upload session and how many bytes it has sent. Once a minute the scheduler asks each processing post to take its next step, in its own function call. For YouTube that means asking the upload session how much it has received, then streaming the next chunks from the source file with HTTP Range requests for a few seconds, until the whole file is there. Then it sets the thumbnail, adds the video to a playlist and waits for YouTube's processing. A first comment is only posted once the video exists.",[16,1143,1144],{},"Every step has to be safe to run twice. If a function times out after Instagram published a container but before we saved the result, the next attempt must find the published media instead of publishing it again. If a thread on Threads was half-published, the next attempt works out which replies already exist.",[29,1146,1148],{"id":1147},"scheduling-and-partial-failure","Scheduling and partial failure",[16,1150,1151,1152,599,1155,599,1158,1161,1162,1165],{},"A post that targets four accounts has four results. We store one target per account, each with its own status, platform post ID, error and attempt count. The post's status is derived from its targets: ",[370,1153,1154],{},"published",[370,1156,1157],{},"partially_published",[370,1159,1160],{},"failed",", or ",[370,1163,1164],{},"processing"," while a platform is still working.",[16,1167,1168,1169,1172],{},"Failures are classified. Rate limits, 5xx responses and network errors are retried, after a minute and then after five, or after whatever ",[370,1170,1171],{},"Retry-After"," says. A rejected token marks the account as needing a reconnect and is not retried. Content the platform refuses is reported straight away with the platform's message.",[16,1174,1175],{},"Scheduling works the same way. A scheduled function runs every minute, claims the posts that are due, and publishes each one in its own request, so one slow upload can't hold up the others. Posts go out within a minute of their time. Retries are just posts that are due again.",[16,1177,1178,1179,599,1182,599,1185,599,1188,1190],{},"The customer hears about all of this through webhooks: ",[370,1180,1181],{},"post.published",[370,1183,1184],{},"post.partially_published",[370,1186,1187],{},"post.failed",[370,1189,769],{}," and a few more, each with the post and its targets. Deliveries are signed with an HMAC over a timestamp and the body, and a failed delivery gets up to six attempts over about 15 hours. Every attempt is logged and can be sent again.",[29,1192,1194],{"id":1193},"credentials-and-app-review","Credentials and app review",[16,1196,1197],{},"Each of the six apps has to be registered and configured with its platform before real users can connect, and most publishing and engagement permissions are gated behind the platform's app review. TikTok goes further: until your app passes its audit, it can only post to private accounts.",[16,1199,1200,1201,1204],{},"Customers can also bring their own approved apps, so their own name is on the consent screen. Each org can store its own client ID and secret per platform through ",[370,1202,1203],{},"PUT \u002Fapi\u002Fv1\u002Fplatform-credentials\u002F{platform}",". The secret is encrypted before it is stored and never returned. At connect time we resolve credentials per org and fall back to our own:",[364,1206,1208],{"className":366,"code":1207,"language":368,"meta":308,"style":308},"export async function resolvePlatformConfig(platform: string, orgSlug: string) {\n  const base = getPlatformConfig(platform) \u002F\u002F URLs and scopes, always ours\n\n  try {\n    const creds = await convex.query(api.connect.getPlatformCredentialsByOrgSlug, {\n      slug: orgSlug,\n      platform,\n    })\n    if (creds?.clientId && creds?.clientSecret) {\n      return { ...base, clientId: creds.clientId, clientSecret: decrypt(creds.clientSecret) }\n    }\n  } catch {\n    \u002F\u002F fall back to managed credentials\n  }\n  return base\n}\n",[370,1209,1210,1246,1265,1269,1277,1298,1303,1308,1313,1327,1347,1352,1362,1367,1372,1380],{"__ignoreMap":308},[373,1211,1212,1215,1218,1221,1224,1226,1230,1232,1235,1237,1240,1242,1244],{"class":375,"line":376},[373,1213,1214],{"class":379},"export",[373,1216,1217],{"class":379}," async",[373,1219,1220],{"class":379}," function",[373,1222,1223],{"class":393}," resolvePlatformConfig",[373,1225,514],{"class":397},[373,1227,1229],{"class":1228},"s4XuR","platform",[373,1231,859],{"class":379},[373,1233,1234],{"class":383}," string",[373,1236,599],{"class":397},[373,1238,1239],{"class":1228},"orgSlug",[373,1241,859],{"class":379},[373,1243,1234],{"class":383},[373,1245,502],{"class":397},[373,1247,1248,1251,1254,1256,1259,1262],{"class":375,"line":309},[373,1249,1250],{"class":379},"  const",[373,1252,1253],{"class":383}," base",[373,1255,387],{"class":379},[373,1257,1258],{"class":393}," getPlatformConfig",[373,1260,1261],{"class":397},"(platform) ",[373,1263,1264],{"class":415},"\u002F\u002F URLs and scopes, always ours\n",[373,1266,1267],{"class":375,"line":406},[373,1268,480],{"emptyLinePlaceholder":324},[373,1270,1271,1274],{"class":375,"line":412},[373,1272,1273],{"class":379},"  try",[373,1275,1276],{"class":397}," {\n",[373,1278,1279,1282,1285,1287,1290,1292,1295],{"class":375,"line":419},[373,1280,1281],{"class":379},"    const",[373,1283,1284],{"class":383}," creds",[373,1286,387],{"class":379},[373,1288,1289],{"class":379}," await",[373,1291,820],{"class":397},[373,1293,1294],{"class":393},"query",[373,1296,1297],{"class":397},"(api.connect.getPlatformCredentialsByOrgSlug, {\n",[373,1299,1300],{"class":375,"line":453},[373,1301,1302],{"class":397},"      slug: orgSlug,\n",[373,1304,1305],{"class":375,"line":465},[373,1306,1307],{"class":397},"      platform,\n",[373,1309,1310],{"class":375,"line":471},[373,1311,1312],{"class":397},"    })\n",[373,1314,1315,1318,1321,1324],{"class":375,"line":477},[373,1316,1317],{"class":379},"    if",[373,1319,1320],{"class":397}," (creds?.clientId ",[373,1322,1323],{"class":379},"&&",[373,1325,1326],{"class":397}," creds?.clientSecret) {\n",[373,1328,1329,1332,1335,1338,1341,1344],{"class":375,"line":483},[373,1330,1331],{"class":379},"      return",[373,1333,1334],{"class":397}," { ",[373,1336,1337],{"class":379},"...",[373,1339,1340],{"class":397},"base, clientId: creds.clientId, clientSecret: ",[373,1342,1343],{"class":393},"decrypt",[373,1345,1346],{"class":397},"(creds.clientSecret) }\n",[373,1348,1349],{"class":375,"line":489},[373,1350,1351],{"class":397},"    }\n",[373,1353,1354,1357,1360],{"class":375,"line":505},[373,1355,1356],{"class":397},"  } ",[373,1358,1359],{"class":379},"catch",[373,1361,1276],{"class":397},[373,1363,1364],{"class":375,"line":523},[373,1365,1366],{"class":415},"    \u002F\u002F fall back to managed credentials\n",[373,1368,1369],{"class":375,"line":539},[373,1370,1371],{"class":397},"  }\n",[373,1373,1374,1377],{"class":375,"line":545},[373,1375,1376],{"class":379},"  return",[373,1378,1379],{"class":397}," base\n",[373,1381,1382],{"class":375,"line":550},[373,1383,542],{"class":397},[16,1385,1386],{},"URLs and scopes always come from our platform definition. Only the client ID and secret change. Token refreshes must use the same app that issued the token, so each account remembers which client it was connected through.",[29,1388,1390],{"id":1389},"the-connect-link","The connect link",[16,1392,1393,1394,1397],{},"The end user never handles an API key. Your backend calls ",[370,1395,1396],{},"POST \u002Fapi\u002Fv1\u002Fconnect-link"," with your own user ID and gets back a URL to the branded page. The token in that URL is a base64url JSON payload plus an HMAC-SHA256 signature, valid for an hour by default. Only someone holding a valid API key can mint one. The link can also limit which platforms the page offers, set where the user lands afterwards, or name an account that needs reconnecting.",[29,1399,1401],{"id":1400},"where-this-lives-now","Where this lives now",[16,1403,1404,1405,1408,1409,27],{},"We built all of this as Pogton Connect, so other teams do not have to repeat it. There is a sandbox with test keys that simulates every platform, an OpenAPI spec and an MCP server for AI agents. If you would rather build it yourself, the sections above are the list of things to plan for. If not, the product page is at ",[23,1406,1407],{"href":1407},"\u002Fconnect"," and the API reference is at ",[23,1410,1411],{"href":1411},"\u002Fdocs",[1413,1414,1415],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":308,"searchDepth":309,"depth":309,"links":1417},[1418,1419,1420,1421,1422,1423,1424,1425,1426],{"id":352,"depth":309,"text":353},{"id":644,"depth":309,"text":645},{"id":780,"depth":309,"text":781},{"id":901,"depth":309,"text":902},{"id":1134,"depth":309,"text":1135},{"id":1147,"depth":309,"text":1148},{"id":1193,"depth":309,"text":1194},{"id":1389,"depth":309,"text":1390},{"id":1400,"depth":309,"text":1401},"Notes from building Pogton Connect: OAuth quirks, token refresh, page and channel selection, media rules, async uploads, retries and webhooks across 10 social platforms.","\u002Fimages\u002Fblog\u002Fsocial-media-apis.jpg","en",{"readTime":1431},"11 min","\u002Fblog\u002Fwhat-breaks-when-you-connect-10-social-media-apis",{"title":338,"description":1427},"blog\u002Fwhat-breaks-when-you-connect-10-social-media-apis",[1436,1437,1438,1439],"Pogton Connect","OAuth","APIs","Engineering","fFILh1uJl9RMo5OCtzDZDjQQhUJL8_MMLRNmqyrbj3A",{"id":1442,"title":1443,"author":7,"body":1444,"description":3916,"draft":318,"extension":319,"image":3917,"lang":334,"meta":3918,"navigation":324,"path":3921,"publishedAt":3922,"seo":3923,"seoTitle":3932,"stem":3933,"tags":3934,"updatedAt":334,"__hash__":3937},"blog\u002Fblog\u002Fbuild-your-own-mcp-server-typescript.md","Build Your Own MCP Server with TypeScript: A Complete Guide",{"type":9,"value":1445,"toc":3904},[1446,1449,1452,1455,1458,1462,1465,1468,1471,1490,1493,1497,1500,1503,1534,1540,1543,1547,1550,2365,2368,2372,2375,2381,2391,2397,2403,2410,2414,2417,2420,2736,2739,2745,2748,2752,2755,2758,2764,2934,2940,3073,3079,3212,3215,3219,3222,3225,3230,3378,3383,3521,3526,3642,3645,3649,3652,3666,3669,3673,3676,3682,3698,3701,3707,3786,3792,3798,3801,3862,3865,3869,3872,3875,3892,3895,3898,3901],[12,1447,1443],{"id":1448},"build-your-own-mcp-server-with-typescript-a-complete-guide",[16,1450,1451],{},"Have you ever wanted to give Claude custom superpowers?",[16,1453,1454],{},"That's exactly what Model Context Protocol (MCP) servers let you do... They're basically a way to extend AI clients like Claude, Cursor, or any other MCP-compatible tool with your own custom functions...",[16,1456,1457],{},"And honestly, it's way easier than you might think...",[29,1459,1461],{"id":1460},"what-the-heck-is-mcp-anyway","What the Heck is MCP Anyway?",[16,1463,1464],{},"MCP is a standardized protocol that lets you connect AI clients to external tools and data sources...",[16,1466,1467],{},"Think of it like giving your AI access to your APIs, databases, or any custom functionality you want... The amazing thing is that once you build an MCP server, it works with ALL modern MCP clients...",[16,1469,1470],{},"That means your server will work with:",[107,1472,1473,1479,1485],{},[110,1474,1475,1478],{},[36,1476,1477],{},"Claude"," (via the desktop app or API)",[110,1480,1481,1484],{},[36,1482,1483],{},"Cursor"," (the AI code editor)",[110,1486,1487],{},[36,1488,1489],{},"Any other MCP-compatible client",[16,1491,1492],{},"The cool part? You can build these servers in any language and deploy them anywhere... I'm gonna show you how to do it with TypeScript because, well, TypeScript is awesome...",[29,1494,1496],{"id":1495},"setting-up-your-mcp-server","Setting Up Your MCP Server",[16,1498,1499],{},"First, let's get the dependencies sorted...",[16,1501,1502],{},"You'll need the MCP SDK and some other basics:",[364,1504,1508],{"className":1505,"code":1506,"language":1507,"meta":308,"style":308},"language-bash shiki shiki-themes github-light github-dark","npm install @modelcontextprotocol\u002Fsdk zod\n# If you're using Nitro (like I am), you're already set\n# For Express, add: npm install express @types\u002Fexpress\n","bash",[370,1509,1510,1524,1529],{"__ignoreMap":308},[373,1511,1512,1515,1518,1521],{"class":375,"line":376},[373,1513,1514],{"class":393},"npm",[373,1516,1517],{"class":434}," install",[373,1519,1520],{"class":434}," @modelcontextprotocol\u002Fsdk",[373,1522,1523],{"class":434}," zod\n",[373,1525,1526],{"class":375,"line":309},[373,1527,1528],{"class":415},"# If you're using Nitro (like I am), you're already set\n",[373,1530,1531],{"class":375,"line":406},[373,1532,1533],{"class":415},"# For Express, add: npm install express @types\u002Fexpress\n",[16,1535,1536,1539],{},[36,1537,1538],{},"Important:"," MCP requires Node.js v18.x or higher to work properly...",[16,1541,1542],{},"The core idea is pretty simple... You create a server, register some tools, and handle HTTP requests using the StreamableHTTPServerTransport...",[29,1544,1546],{"id":1545},"the-complete-mcp-server-code","The Complete MCP Server Code",[16,1548,1549],{},"Here's the full implementation I'm using in my Nitro app:",[364,1551,1555],{"className":1552,"code":1553,"language":1554,"meta":308,"style":308},"language-typescript shiki shiki-themes github-light github-dark","import { StreamableHTTPServerTransport } from \"@modelcontextprotocol\u002Fsdk\u002Fserver\u002FstreamableHttp.js\";\nimport { McpServer } from \"@modelcontextprotocol\u002Fsdk\u002Fserver\u002Fmcp.js\";\nimport { z } from \"zod\";\n\nexport default defineEventHandler(async (event) => {\n  if (['GET', 'DELETE'].includes(event.method)) {\n    event.node.res.writeHead(405).end(JSON.stringify({\n      jsonrpc: \"2.0\",\n      error: {\n        code: -32000,\n        message: \"Method not allowed.\"\n      },\n      id: null\n    }))\n  }\n\n  if (event.method === 'POST') {\n    const body = await readBody(event)\n    try {\n      const server = getServer()\n      const transport: StreamableHTTPServerTransport = new StreamableHTTPServerTransport({\n        sessionIdGenerator: undefined,\n      });\n      \n      event.node.res.on('close', () => {\n        console.log('Request closed')\n        transport.close()\n        server.close()\n      })\n      \n      await server.connect(transport)\n      await transport.handleRequest(event.node.req, event.node.res, body)\n      return\n    } catch (error) {\n      console.error('Error handling MCP request:', error);\n      if (!event.node.res.headersSent) {\n        return event.node.res.writeHead(500).end(JSON.stringify({\n          jsonrpc: '2.0',\n          error: {\n            code: -32603,\n            message: 'Internal server error',\n          },\n          id: null,\n        }))\n      }\n    }\n  }\n\n  \u002F\u002F Return 404 for all other methods\n  return event.node.res.writeHead(404).end()\n})\n\nconst getServer = () => {\n  \u002F\u002F Create an MCP server\n  const server = new McpServer({\n    name: \"your-mcp-server-name\",\n    version: \"1.0.0\"\n  });\n\n  \u002F\u002F Add an addition tool\n  server.registerTool(\"add\",\n    {\n      title: \"Addition Tool\",\n      description: \"Add two numbers\",\n      inputSchema: { a: z.number(), b: z.number() }\n    },\n    async ({ a, b }) => ({\n      content: [{ type: \"text\", text: String(a + b) }]\n    })\n  )\n\n  return server\n}\n","typescript",[370,1556,1557,1574,1588,1602,1606,1635,1660,1691,1701,1706,1719,1727,1732,1740,1745,1749,1753,1767,1784,1791,1807,1827,1838,1844,1850,1871,1887,1898,1908,1914,1919,1934,1948,1954,1965,1982,1996,2025,2036,2042,2055,2066,2072,2083,2089,2095,2100,2105,2110,2116,2136,2141,2146,2162,2168,2184,2195,2204,2210,2215,2221,2237,2243,2254,2265,2282,2288,2312,2336,2341,2347,2352,2360],{"__ignoreMap":308},[373,1558,1559,1562,1565,1568,1571],{"class":375,"line":376},[373,1560,1561],{"class":379},"import",[373,1563,1564],{"class":397}," { StreamableHTTPServerTransport } ",[373,1566,1567],{"class":379},"from",[373,1569,1570],{"class":434}," \"@modelcontextprotocol\u002Fsdk\u002Fserver\u002FstreamableHttp.js\"",[373,1572,1573],{"class":397},";\n",[373,1575,1576,1578,1581,1583,1586],{"class":375,"line":309},[373,1577,1561],{"class":379},[373,1579,1580],{"class":397}," { McpServer } ",[373,1582,1567],{"class":379},[373,1584,1585],{"class":434}," \"@modelcontextprotocol\u002Fsdk\u002Fserver\u002Fmcp.js\"",[373,1587,1573],{"class":397},[373,1589,1590,1592,1595,1597,1600],{"class":375,"line":406},[373,1591,1561],{"class":379},[373,1593,1594],{"class":397}," { z } ",[373,1596,1567],{"class":379},[373,1598,1599],{"class":434}," \"zod\"",[373,1601,1573],{"class":397},[373,1603,1604],{"class":375,"line":412},[373,1605,480],{"emptyLinePlaceholder":324},[373,1607,1608,1610,1613,1616,1618,1621,1624,1627,1630,1633],{"class":375,"line":419},[373,1609,1214],{"class":379},[373,1611,1612],{"class":379}," default",[373,1614,1615],{"class":393}," defineEventHandler",[373,1617,514],{"class":397},[373,1619,1620],{"class":379},"async",[373,1622,1623],{"class":397}," (",[373,1625,1626],{"class":1228},"event",[373,1628,1629],{"class":397},") ",[373,1631,1632],{"class":379},"=>",[373,1634,1276],{"class":397},[373,1636,1637,1640,1643,1646,1648,1651,1654,1657],{"class":375,"line":453},[373,1638,1639],{"class":379},"  if",[373,1641,1642],{"class":397}," ([",[373,1644,1645],{"class":434},"'GET'",[373,1647,599],{"class":397},[373,1649,1650],{"class":434},"'DELETE'",[373,1652,1653],{"class":397},"].",[373,1655,1656],{"class":393},"includes",[373,1658,1659],{"class":397},"(event.method)) {\n",[373,1661,1662,1665,1668,1670,1673,1676,1679,1681,1684,1686,1689],{"class":375,"line":465},[373,1663,1664],{"class":397},"    event.node.res.",[373,1666,1667],{"class":393},"writeHead",[373,1669,514],{"class":397},[373,1671,1672],{"class":383},"405",[373,1674,1675],{"class":397},").",[373,1677,1678],{"class":393},"end",[373,1680,514],{"class":397},[373,1682,1683],{"class":383},"JSON",[373,1685,27],{"class":397},[373,1687,1688],{"class":393},"stringify",[373,1690,398],{"class":397},[373,1692,1693,1696,1699],{"class":375,"line":471},[373,1694,1695],{"class":397},"      jsonrpc: ",[373,1697,1698],{"class":434},"\"2.0\"",[373,1700,462],{"class":397},[373,1702,1703],{"class":375,"line":477},[373,1704,1705],{"class":397},"      error: {\n",[373,1707,1708,1711,1714,1717],{"class":375,"line":483},[373,1709,1710],{"class":397},"        code: ",[373,1712,1713],{"class":379},"-",[373,1715,1716],{"class":383},"32000",[373,1718,462],{"class":397},[373,1720,1721,1724],{"class":375,"line":489},[373,1722,1723],{"class":397},"        message: ",[373,1725,1726],{"class":434},"\"Method not allowed.\"\n",[373,1728,1729],{"class":375,"line":505},[373,1730,1731],{"class":397},"      },\n",[373,1733,1734,1737],{"class":375,"line":523},[373,1735,1736],{"class":397},"      id: ",[373,1738,1739],{"class":383},"null\n",[373,1741,1742],{"class":375,"line":539},[373,1743,1744],{"class":397},"    }))\n",[373,1746,1747],{"class":375,"line":545},[373,1748,1371],{"class":397},[373,1750,1751],{"class":375,"line":550},[373,1752,480],{"emptyLinePlaceholder":324},[373,1754,1755,1757,1760,1762,1765],{"class":375,"line":556},[373,1756,1639],{"class":379},[373,1758,1759],{"class":397}," (event.method ",[373,1761,431],{"class":379},[373,1763,1764],{"class":434}," 'POST'",[373,1766,502],{"class":397},[373,1768,1769,1771,1774,1776,1778,1781],{"class":375,"line":562},[373,1770,1281],{"class":379},[373,1772,1773],{"class":383}," body",[373,1775,387],{"class":379},[373,1777,1289],{"class":379},[373,1779,1780],{"class":393}," readBody",[373,1782,1783],{"class":397},"(event)\n",[373,1785,1786,1789],{"class":375,"line":587},[373,1787,1788],{"class":379},"    try",[373,1790,1276],{"class":397},[373,1792,1793,1796,1799,1801,1804],{"class":375,"line":607},[373,1794,1795],{"class":379},"      const",[373,1797,1798],{"class":383}," server",[373,1800,387],{"class":379},[373,1802,1803],{"class":393}," getServer",[373,1805,1806],{"class":397},"()\n",[373,1808,1809,1811,1814,1816,1819,1821,1823,1825],{"class":375,"line":626},[373,1810,1795],{"class":379},[373,1812,1813],{"class":383}," transport",[373,1815,859],{"class":379},[373,1817,1818],{"class":393}," StreamableHTTPServerTransport",[373,1820,387],{"class":379},[373,1822,390],{"class":379},[373,1824,1818],{"class":393},[373,1826,398],{"class":397},[373,1828,1830,1833,1836],{"class":375,"line":1829},22,[373,1831,1832],{"class":397},"        sessionIdGenerator: ",[373,1834,1835],{"class":383},"undefined",[373,1837,462],{"class":397},[373,1839,1841],{"class":375,"line":1840},23,[373,1842,1843],{"class":397},"      });\n",[373,1845,1847],{"class":375,"line":1846},24,[373,1848,1849],{"class":397},"      \n",[373,1851,1853,1856,1859,1861,1864,1867,1869],{"class":375,"line":1852},25,[373,1854,1855],{"class":397},"      event.node.res.",[373,1857,1858],{"class":393},"on",[373,1860,514],{"class":397},[373,1862,1863],{"class":434},"'close'",[373,1865,1866],{"class":397},", () ",[373,1868,1632],{"class":379},[373,1870,1276],{"class":397},[373,1872,1874,1877,1880,1882,1885],{"class":375,"line":1873},26,[373,1875,1876],{"class":397},"        console.",[373,1878,1879],{"class":393},"log",[373,1881,514],{"class":397},[373,1883,1884],{"class":434},"'Request closed'",[373,1886,520],{"class":397},[373,1888,1890,1893,1896],{"class":375,"line":1889},27,[373,1891,1892],{"class":397},"        transport.",[373,1894,1895],{"class":393},"close",[373,1897,1806],{"class":397},[373,1899,1901,1904,1906],{"class":375,"line":1900},28,[373,1902,1903],{"class":397},"        server.",[373,1905,1895],{"class":393},[373,1907,1806],{"class":397},[373,1909,1911],{"class":375,"line":1910},29,[373,1912,1913],{"class":397},"      })\n",[373,1915,1917],{"class":375,"line":1916},30,[373,1918,1849],{"class":397},[373,1920,1922,1925,1928,1931],{"class":375,"line":1921},31,[373,1923,1924],{"class":379},"      await",[373,1926,1927],{"class":397}," server.",[373,1929,1930],{"class":393},"connect",[373,1932,1933],{"class":397},"(transport)\n",[373,1935,1937,1939,1942,1945],{"class":375,"line":1936},32,[373,1938,1924],{"class":379},[373,1940,1941],{"class":397}," transport.",[373,1943,1944],{"class":393},"handleRequest",[373,1946,1947],{"class":397},"(event.node.req, event.node.res, body)\n",[373,1949,1951],{"class":375,"line":1950},33,[373,1952,1953],{"class":379},"      return\n",[373,1955,1957,1960,1962],{"class":375,"line":1956},34,[373,1958,1959],{"class":397},"    } ",[373,1961,1359],{"class":379},[373,1963,1964],{"class":397}," (error) {\n",[373,1966,1968,1971,1974,1976,1979],{"class":375,"line":1967},35,[373,1969,1970],{"class":397},"      console.",[373,1972,1973],{"class":393},"error",[373,1975,514],{"class":397},[373,1977,1978],{"class":434},"'Error handling MCP request:'",[373,1980,1981],{"class":397},", error);\n",[373,1983,1985,1988,1990,1993],{"class":375,"line":1984},36,[373,1986,1987],{"class":379},"      if",[373,1989,1623],{"class":397},[373,1991,1992],{"class":379},"!",[373,1994,1995],{"class":397},"event.node.res.headersSent) {\n",[373,1997,1999,2002,2005,2007,2009,2011,2013,2015,2017,2019,2021,2023],{"class":375,"line":1998},37,[373,2000,2001],{"class":379},"        return",[373,2003,2004],{"class":397}," event.node.res.",[373,2006,1667],{"class":393},[373,2008,514],{"class":397},[373,2010,998],{"class":383},[373,2012,1675],{"class":397},[373,2014,1678],{"class":393},[373,2016,514],{"class":397},[373,2018,1683],{"class":383},[373,2020,27],{"class":397},[373,2022,1688],{"class":393},[373,2024,398],{"class":397},[373,2026,2028,2031,2034],{"class":375,"line":2027},38,[373,2029,2030],{"class":397},"          jsonrpc: ",[373,2032,2033],{"class":434},"'2.0'",[373,2035,462],{"class":397},[373,2037,2039],{"class":375,"line":2038},39,[373,2040,2041],{"class":397},"          error: {\n",[373,2043,2045,2048,2050,2053],{"class":375,"line":2044},40,[373,2046,2047],{"class":397},"            code: ",[373,2049,1713],{"class":379},[373,2051,2052],{"class":383},"32603",[373,2054,462],{"class":397},[373,2056,2058,2061,2064],{"class":375,"line":2057},41,[373,2059,2060],{"class":397},"            message: ",[373,2062,2063],{"class":434},"'Internal server error'",[373,2065,462],{"class":397},[373,2067,2069],{"class":375,"line":2068},42,[373,2070,2071],{"class":397},"          },\n",[373,2073,2075,2078,2081],{"class":375,"line":2074},43,[373,2076,2077],{"class":397},"          id: ",[373,2079,2080],{"class":383},"null",[373,2082,462],{"class":397},[373,2084,2086],{"class":375,"line":2085},44,[373,2087,2088],{"class":397},"        }))\n",[373,2090,2092],{"class":375,"line":2091},45,[373,2093,2094],{"class":397},"      }\n",[373,2096,2098],{"class":375,"line":2097},46,[373,2099,1351],{"class":397},[373,2101,2103],{"class":375,"line":2102},47,[373,2104,1371],{"class":397},[373,2106,2108],{"class":375,"line":2107},48,[373,2109,480],{"emptyLinePlaceholder":324},[373,2111,2113],{"class":375,"line":2112},49,[373,2114,2115],{"class":415},"  \u002F\u002F Return 404 for all other methods\n",[373,2117,2119,2121,2123,2125,2127,2130,2132,2134],{"class":375,"line":2118},50,[373,2120,1376],{"class":379},[373,2122,2004],{"class":397},[373,2124,1667],{"class":393},[373,2126,514],{"class":397},[373,2128,2129],{"class":383},"404",[373,2131,1675],{"class":397},[373,2133,1678],{"class":393},[373,2135,1806],{"class":397},[373,2137,2139],{"class":375,"line":2138},51,[373,2140,474],{"class":397},[373,2142,2144],{"class":375,"line":2143},52,[373,2145,480],{"emptyLinePlaceholder":324},[373,2147,2149,2151,2153,2155,2158,2160],{"class":375,"line":2148},53,[373,2150,380],{"class":379},[373,2152,1803],{"class":393},[373,2154,387],{"class":379},[373,2156,2157],{"class":397}," () ",[373,2159,1632],{"class":379},[373,2161,1276],{"class":397},[373,2163,2165],{"class":375,"line":2164},54,[373,2166,2167],{"class":415},"  \u002F\u002F Create an MCP server\n",[373,2169,2171,2173,2175,2177,2179,2182],{"class":375,"line":2170},55,[373,2172,1250],{"class":379},[373,2174,1798],{"class":383},[373,2176,387],{"class":379},[373,2178,390],{"class":379},[373,2180,2181],{"class":393}," McpServer",[373,2183,398],{"class":397},[373,2185,2187,2190,2193],{"class":375,"line":2186},56,[373,2188,2189],{"class":397},"    name: ",[373,2191,2192],{"class":434},"\"your-mcp-server-name\"",[373,2194,462],{"class":397},[373,2196,2198,2201],{"class":375,"line":2197},57,[373,2199,2200],{"class":397},"    version: ",[373,2202,2203],{"class":434},"\"1.0.0\"\n",[373,2205,2207],{"class":375,"line":2206},58,[373,2208,2209],{"class":397},"  });\n",[373,2211,2213],{"class":375,"line":2212},59,[373,2214,480],{"emptyLinePlaceholder":324},[373,2216,2218],{"class":375,"line":2217},60,[373,2219,2220],{"class":415},"  \u002F\u002F Add an addition tool\n",[373,2222,2224,2227,2230,2232,2235],{"class":375,"line":2223},61,[373,2225,2226],{"class":397},"  server.",[373,2228,2229],{"class":393},"registerTool",[373,2231,514],{"class":397},[373,2233,2234],{"class":434},"\"add\"",[373,2236,462],{"class":397},[373,2238,2240],{"class":375,"line":2239},62,[373,2241,2242],{"class":397},"    {\n",[373,2244,2246,2249,2252],{"class":375,"line":2245},63,[373,2247,2248],{"class":397},"      title: ",[373,2250,2251],{"class":434},"\"Addition Tool\"",[373,2253,462],{"class":397},[373,2255,2257,2260,2263],{"class":375,"line":2256},64,[373,2258,2259],{"class":397},"      description: ",[373,2261,2262],{"class":434},"\"Add two numbers\"",[373,2264,462],{"class":397},[373,2266,2268,2271,2274,2277,2279],{"class":375,"line":2267},65,[373,2269,2270],{"class":397},"      inputSchema: { a: z.",[373,2272,2273],{"class":393},"number",[373,2275,2276],{"class":397},"(), b: z.",[373,2278,2273],{"class":393},[373,2280,2281],{"class":397},"() }\n",[373,2283,2285],{"class":375,"line":2284},66,[373,2286,2287],{"class":397},"    },\n",[373,2289,2291,2294,2297,2299,2301,2304,2307,2309],{"class":375,"line":2290},67,[373,2292,2293],{"class":379},"    async",[373,2295,2296],{"class":397}," ({ ",[373,2298,23],{"class":1228},[373,2300,599],{"class":397},[373,2302,2303],{"class":1228},"b",[373,2305,2306],{"class":397}," }) ",[373,2308,1632],{"class":379},[373,2310,2311],{"class":397}," ({\n",[373,2313,2315,2318,2321,2324,2327,2330,2333],{"class":375,"line":2314},68,[373,2316,2317],{"class":397},"      content: [{ type: ",[373,2319,2320],{"class":434},"\"text\"",[373,2322,2323],{"class":397},", text: ",[373,2325,2326],{"class":393},"String",[373,2328,2329],{"class":397},"(a ",[373,2331,2332],{"class":379},"+",[373,2334,2335],{"class":397}," b) }]\n",[373,2337,2339],{"class":375,"line":2338},69,[373,2340,1312],{"class":397},[373,2342,2344],{"class":375,"line":2343},70,[373,2345,2346],{"class":397},"  )\n",[373,2348,2350],{"class":375,"line":2349},71,[373,2351,480],{"emptyLinePlaceholder":324},[373,2353,2355,2357],{"class":375,"line":2354},72,[373,2356,1376],{"class":379},[373,2358,2359],{"class":397}," server\n",[373,2361,2363],{"class":375,"line":2362},73,[373,2364,542],{"class":397},[16,2366,2367],{},"Let me break this down for you...",[29,2369,2371],{"id":2370},"how-it-actually-works","How It Actually Works",[16,2373,2374],{},"The magic happens in a few key parts:",[16,2376,2377,2380],{},[36,2378,2379],{},"1. HTTP Method Handling","\nWe only accept POST requests because that's how MCP communication works... Everything else gets a nice error response...",[16,2382,2383,2386,2387,2390],{},[36,2384,2385],{},"2. Transport Layer","\nThe ",[370,2388,2389],{},"StreamableHTTPServerTransport"," handles the connection between Claude and your server... It's basically the bridge that makes everything work...",[16,2392,2393,2396],{},[36,2394,2395],{},"3. Server Creation","\nWe create a new MCP server instance with a name and version... This is what Claude will see when it connects...",[16,2398,2399,2402],{},[36,2400,2401],{},"4. Tool Registration","\nThis is where you define what your server can actually do... In this example, it's just adding two numbers, but you can build way more complex stuff...",[16,2404,2405,2406,2409],{},"The modern way to register tools uses ",[370,2407,2408],{},"server.registerTool()"," which gives you better TypeScript support and cleaner APIs...",[29,2411,2413],{"id":2412},"adapting-for-express-or-any-framework","Adapting for Express (Or Any Framework)",[16,2415,2416],{},"The beauty of this approach is that it works everywhere...",[16,2418,2419],{},"For Express, you'd do something like this:",[364,2421,2423],{"className":1552,"code":2422,"language":1554,"meta":308,"style":308},"import express from 'express';\n\u002F\u002F ... other imports\n\nconst app = express();\napp.use(express.json());\n\napp.post('\u002Fmcp', async (req, res) => {\n  try {\n    const server = getServer();\n    const transport = new StreamableHTTPServerTransport({\n      sessionIdGenerator: undefined,\n    });\n    \n    res.on('close', () => {\n      transport.close();\n      server.close();\n    });\n    \n    await server.connect(transport);\n    await transport.handleRequest(req, res, req.body);\n  } catch (error) {\n    console.error('MCP Error:', error);\n    if (!res.headersSent) {\n      res.status(500).json({\n        jsonrpc: '2.0',\n        error: { code: -32603, message: 'Internal server error' },\n        id: null,\n      });\n    }\n  }\n});\n",[370,2424,2425,2439,2444,2448,2463,2480,2484,2516,2522,2534,2548,2557,2562,2567,2584,2593,2602,2606,2610,2622,2633,2641,2655,2666,2684,2693,2710,2719,2723,2727,2731],{"__ignoreMap":308},[373,2426,2427,2429,2432,2434,2437],{"class":375,"line":376},[373,2428,1561],{"class":379},[373,2430,2431],{"class":397}," express ",[373,2433,1567],{"class":379},[373,2435,2436],{"class":434}," 'express'",[373,2438,1573],{"class":397},[373,2440,2441],{"class":375,"line":309},[373,2442,2443],{"class":415},"\u002F\u002F ... other imports\n",[373,2445,2446],{"class":375,"line":406},[373,2447,480],{"emptyLinePlaceholder":324},[373,2449,2450,2452,2455,2457,2460],{"class":375,"line":412},[373,2451,380],{"class":379},[373,2453,2454],{"class":383}," app",[373,2456,387],{"class":379},[373,2458,2459],{"class":393}," express",[373,2461,2462],{"class":397},"();\n",[373,2464,2465,2468,2471,2474,2477],{"class":375,"line":419},[373,2466,2467],{"class":397},"app.",[373,2469,2470],{"class":393},"use",[373,2472,2473],{"class":397},"(express.",[373,2475,2476],{"class":393},"json",[373,2478,2479],{"class":397},"());\n",[373,2481,2482],{"class":375,"line":453},[373,2483,480],{"emptyLinePlaceholder":324},[373,2485,2486,2488,2491,2493,2496,2498,2500,2502,2505,2507,2510,2512,2514],{"class":375,"line":465},[373,2487,2467],{"class":397},[373,2489,2490],{"class":393},"post",[373,2492,514],{"class":397},[373,2494,2495],{"class":434},"'\u002Fmcp'",[373,2497,599],{"class":397},[373,2499,1620],{"class":379},[373,2501,1623],{"class":397},[373,2503,2504],{"class":1228},"req",[373,2506,599],{"class":397},[373,2508,2509],{"class":1228},"res",[373,2511,1629],{"class":397},[373,2513,1632],{"class":379},[373,2515,1276],{"class":397},[373,2517,2518,2520],{"class":375,"line":471},[373,2519,1273],{"class":379},[373,2521,1276],{"class":397},[373,2523,2524,2526,2528,2530,2532],{"class":375,"line":477},[373,2525,1281],{"class":379},[373,2527,1798],{"class":383},[373,2529,387],{"class":379},[373,2531,1803],{"class":393},[373,2533,2462],{"class":397},[373,2535,2536,2538,2540,2542,2544,2546],{"class":375,"line":483},[373,2537,1281],{"class":379},[373,2539,1813],{"class":383},[373,2541,387],{"class":379},[373,2543,390],{"class":379},[373,2545,1818],{"class":393},[373,2547,398],{"class":397},[373,2549,2550,2553,2555],{"class":375,"line":489},[373,2551,2552],{"class":397},"      sessionIdGenerator: ",[373,2554,1835],{"class":383},[373,2556,462],{"class":397},[373,2558,2559],{"class":375,"line":505},[373,2560,2561],{"class":397},"    });\n",[373,2563,2564],{"class":375,"line":523},[373,2565,2566],{"class":397},"    \n",[373,2568,2569,2572,2574,2576,2578,2580,2582],{"class":375,"line":539},[373,2570,2571],{"class":397},"    res.",[373,2573,1858],{"class":393},[373,2575,514],{"class":397},[373,2577,1863],{"class":434},[373,2579,1866],{"class":397},[373,2581,1632],{"class":379},[373,2583,1276],{"class":397},[373,2585,2586,2589,2591],{"class":375,"line":545},[373,2587,2588],{"class":397},"      transport.",[373,2590,1895],{"class":393},[373,2592,2462],{"class":397},[373,2594,2595,2598,2600],{"class":375,"line":550},[373,2596,2597],{"class":397},"      server.",[373,2599,1895],{"class":393},[373,2601,2462],{"class":397},[373,2603,2604],{"class":375,"line":556},[373,2605,2561],{"class":397},[373,2607,2608],{"class":375,"line":562},[373,2609,2566],{"class":397},[373,2611,2612,2615,2617,2619],{"class":375,"line":587},[373,2613,2614],{"class":379},"    await",[373,2616,1927],{"class":397},[373,2618,1930],{"class":393},[373,2620,2621],{"class":397},"(transport);\n",[373,2623,2624,2626,2628,2630],{"class":375,"line":607},[373,2625,2614],{"class":379},[373,2627,1941],{"class":397},[373,2629,1944],{"class":393},[373,2631,2632],{"class":397},"(req, res, req.body);\n",[373,2634,2635,2637,2639],{"class":375,"line":626},[373,2636,1356],{"class":397},[373,2638,1359],{"class":379},[373,2640,1964],{"class":397},[373,2642,2643,2646,2648,2650,2653],{"class":375,"line":1829},[373,2644,2645],{"class":397},"    console.",[373,2647,1973],{"class":393},[373,2649,514],{"class":397},[373,2651,2652],{"class":434},"'MCP Error:'",[373,2654,1981],{"class":397},[373,2656,2657,2659,2661,2663],{"class":375,"line":1840},[373,2658,1317],{"class":379},[373,2660,1623],{"class":397},[373,2662,1992],{"class":379},[373,2664,2665],{"class":397},"res.headersSent) {\n",[373,2667,2668,2671,2674,2676,2678,2680,2682],{"class":375,"line":1846},[373,2669,2670],{"class":397},"      res.",[373,2672,2673],{"class":393},"status",[373,2675,514],{"class":397},[373,2677,998],{"class":383},[373,2679,1675],{"class":397},[373,2681,2476],{"class":393},[373,2683,398],{"class":397},[373,2685,2686,2689,2691],{"class":375,"line":1852},[373,2687,2688],{"class":397},"        jsonrpc: ",[373,2690,2033],{"class":434},[373,2692,462],{"class":397},[373,2694,2695,2698,2700,2702,2705,2707],{"class":375,"line":1873},[373,2696,2697],{"class":397},"        error: { code: ",[373,2699,1713],{"class":379},[373,2701,2052],{"class":383},[373,2703,2704],{"class":397},", message: ",[373,2706,2063],{"class":434},[373,2708,2709],{"class":397}," },\n",[373,2711,2712,2715,2717],{"class":375,"line":1889},[373,2713,2714],{"class":397},"        id: ",[373,2716,2080],{"class":383},[373,2718,462],{"class":397},[373,2720,2721],{"class":375,"line":1900},[373,2722,1843],{"class":397},[373,2724,2725],{"class":375,"line":1910},[373,2726,1351],{"class":397},[373,2728,2729],{"class":375,"line":1916},[373,2730,1371],{"class":397},[373,2732,2733],{"class":375,"line":1921},[373,2734,2735],{"class":397},"});\n",[16,2737,2738],{},"Same logic, different framework... Pretty nice, right?",[16,2740,2741,2744],{},[36,2742,2743],{},"Important Note:"," The example above creates a new server instance for each request (stateless mode)... This is perfect for simple use cases, but if you need session management, you'd want to store transports by session ID...",[16,2746,2747],{},"Check out the official MCP SDK docs for examples of both stateless and session-based implementations...",[29,2749,2751],{"id":2750},"understanding-mcp-capabilities","Understanding MCP Capabilities",[16,2753,2754],{},"Before we dive into building tools, let's talk about what MCP servers can actually do...",[16,2756,2757],{},"There are three main types of features you can implement:",[16,2759,2760,2763],{},[36,2761,2762],{},"Tools"," - These are like POST endpoints... They perform actions and can have side effects:",[364,2765,2767],{"className":1552,"code":2766,"language":1554,"meta":308,"style":308},"server.registerTool(\"send-email\",\n  {\n    title: \"Send Email\",\n    description: \"Send an email to someone\",\n    inputSchema: { \n      to: z.string().email(), \n      subject: z.string(), \n      body: z.string() \n    }\n  },\n  async ({ to, subject, body }) => {\n    await sendEmail(to, subject, body);\n    return {\n      content: [{ type: \"text\", text: `Email sent to ${to}` }]\n    };\n  }\n);\n",[370,2768,2769,2783,2788,2798,2808,2813,2830,2839,2849,2853,2858,2884,2894,2901,2920,2925,2929],{"__ignoreMap":308},[373,2770,2771,2774,2776,2778,2781],{"class":375,"line":376},[373,2772,2773],{"class":397},"server.",[373,2775,2229],{"class":393},[373,2777,514],{"class":397},[373,2779,2780],{"class":434},"\"send-email\"",[373,2782,462],{"class":397},[373,2784,2785],{"class":375,"line":309},[373,2786,2787],{"class":397},"  {\n",[373,2789,2790,2793,2796],{"class":375,"line":406},[373,2791,2792],{"class":397},"    title: ",[373,2794,2795],{"class":434},"\"Send Email\"",[373,2797,462],{"class":397},[373,2799,2800,2803,2806],{"class":375,"line":412},[373,2801,2802],{"class":397},"    description: ",[373,2804,2805],{"class":434},"\"Send an email to someone\"",[373,2807,462],{"class":397},[373,2809,2810],{"class":375,"line":419},[373,2811,2812],{"class":397},"    inputSchema: { \n",[373,2814,2815,2818,2821,2824,2827],{"class":375,"line":453},[373,2816,2817],{"class":397},"      to: z.",[373,2819,2820],{"class":393},"string",[373,2822,2823],{"class":397},"().",[373,2825,2826],{"class":393},"email",[373,2828,2829],{"class":397},"(), \n",[373,2831,2832,2835,2837],{"class":375,"line":465},[373,2833,2834],{"class":397},"      subject: z.",[373,2836,2820],{"class":393},[373,2838,2829],{"class":397},[373,2840,2841,2844,2846],{"class":375,"line":471},[373,2842,2843],{"class":397},"      body: z.",[373,2845,2820],{"class":393},[373,2847,2848],{"class":397},"() \n",[373,2850,2851],{"class":375,"line":477},[373,2852,1351],{"class":397},[373,2854,2855],{"class":375,"line":483},[373,2856,2857],{"class":397},"  },\n",[373,2859,2860,2863,2865,2868,2870,2873,2875,2878,2880,2882],{"class":375,"line":489},[373,2861,2862],{"class":379},"  async",[373,2864,2296],{"class":397},[373,2866,2867],{"class":1228},"to",[373,2869,599],{"class":397},[373,2871,2872],{"class":1228},"subject",[373,2874,599],{"class":397},[373,2876,2877],{"class":1228},"body",[373,2879,2306],{"class":397},[373,2881,1632],{"class":379},[373,2883,1276],{"class":397},[373,2885,2886,2888,2891],{"class":375,"line":505},[373,2887,2614],{"class":379},[373,2889,2890],{"class":393}," sendEmail",[373,2892,2893],{"class":397},"(to, subject, body);\n",[373,2895,2896,2899],{"class":375,"line":523},[373,2897,2898],{"class":379},"    return",[373,2900,1276],{"class":397},[373,2902,2903,2905,2907,2909,2912,2914,2917],{"class":375,"line":539},[373,2904,2317],{"class":397},[373,2906,2320],{"class":434},[373,2908,2323],{"class":397},[373,2910,2911],{"class":434},"`Email sent to ${",[373,2913,2867],{"class":397},[373,2915,2916],{"class":434},"}`",[373,2918,2919],{"class":397}," }]\n",[373,2921,2922],{"class":375,"line":545},[373,2923,2924],{"class":397},"    };\n",[373,2926,2927],{"class":375,"line":550},[373,2928,1371],{"class":397},[373,2930,2931],{"class":375,"line":556},[373,2932,2933],{"class":397},");\n",[16,2935,2936,2939],{},[36,2937,2938],{},"Resources"," - These are like GET endpoints... They provide data but shouldn't have side effects:",[364,2941,2943],{"className":1552,"code":2942,"language":1554,"meta":308,"style":308},"server.registerResource(\n  \"user-profile\",\n  new ResourceTemplate(\"users:\u002F\u002F{userId}\u002Fprofile\", { list: undefined }),\n  {\n    title: \"User Profile\",\n    description: \"Get user profile information\"\n  },\n  async (uri, { userId }) => ({\n    contents: [{\n      uri: uri.href,\n      text: JSON.stringify(await getUserProfile(userId))\n    }]\n  })\n);\n",[370,2944,2945,2955,2962,2983,2987,2996,3003,3007,3028,3033,3038,3059,3064,3069],{"__ignoreMap":308},[373,2946,2947,2949,2952],{"class":375,"line":376},[373,2948,2773],{"class":397},[373,2950,2951],{"class":393},"registerResource",[373,2953,2954],{"class":397},"(\n",[373,2956,2957,2960],{"class":375,"line":309},[373,2958,2959],{"class":434},"  \"user-profile\"",[373,2961,462],{"class":397},[373,2963,2964,2967,2970,2972,2975,2978,2980],{"class":375,"line":406},[373,2965,2966],{"class":379},"  new",[373,2968,2969],{"class":393}," ResourceTemplate",[373,2971,514],{"class":397},[373,2973,2974],{"class":434},"\"users:\u002F\u002F{userId}\u002Fprofile\"",[373,2976,2977],{"class":397},", { list: ",[373,2979,1835],{"class":383},[373,2981,2982],{"class":397}," }),\n",[373,2984,2985],{"class":375,"line":412},[373,2986,2787],{"class":397},[373,2988,2989,2991,2994],{"class":375,"line":419},[373,2990,2792],{"class":397},[373,2992,2993],{"class":434},"\"User Profile\"",[373,2995,462],{"class":397},[373,2997,2998,3000],{"class":375,"line":453},[373,2999,2802],{"class":397},[373,3001,3002],{"class":434},"\"Get user profile information\"\n",[373,3004,3005],{"class":375,"line":465},[373,3006,2857],{"class":397},[373,3008,3009,3011,3013,3016,3019,3022,3024,3026],{"class":375,"line":471},[373,3010,2862],{"class":379},[373,3012,1623],{"class":397},[373,3014,3015],{"class":1228},"uri",[373,3017,3018],{"class":397},", { ",[373,3020,3021],{"class":1228},"userId",[373,3023,2306],{"class":397},[373,3025,1632],{"class":379},[373,3027,2311],{"class":397},[373,3029,3030],{"class":375,"line":477},[373,3031,3032],{"class":397},"    contents: [{\n",[373,3034,3035],{"class":375,"line":483},[373,3036,3037],{"class":397},"      uri: uri.href,\n",[373,3039,3040,3043,3045,3047,3049,3051,3053,3056],{"class":375,"line":489},[373,3041,3042],{"class":397},"      text: ",[373,3044,1683],{"class":383},[373,3046,27],{"class":397},[373,3048,1688],{"class":393},[373,3050,514],{"class":397},[373,3052,817],{"class":379},[373,3054,3055],{"class":393}," getUserProfile",[373,3057,3058],{"class":397},"(userId))\n",[373,3060,3061],{"class":375,"line":505},[373,3062,3063],{"class":397},"    }]\n",[373,3065,3066],{"class":375,"line":523},[373,3067,3068],{"class":397},"  })\n",[373,3070,3071],{"class":375,"line":539},[373,3072,2933],{"class":397},[16,3074,3075,3078],{},[36,3076,3077],{},"Prompts"," - These are reusable templates for AI interactions:",[364,3080,3082],{"className":1552,"code":3081,"language":1554,"meta":308,"style":308},"server.registerPrompt(\n  \"code-review\",\n  {\n    title: \"Code Review\",\n    description: \"Review code for best practices\",\n    argsSchema: { code: z.string() }\n  },\n  ({ code }) => ({\n    messages: [{\n      role: \"user\",\n      content: {\n        type: \"text\",\n        text: `Please review this code:\\n\\n${code}`\n      }\n    }]\n  })\n);\n",[370,3083,3084,3093,3100,3104,3113,3122,3131,3135,3148,3153,3163,3168,3177,3196,3200,3204,3208],{"__ignoreMap":308},[373,3085,3086,3088,3091],{"class":375,"line":376},[373,3087,2773],{"class":397},[373,3089,3090],{"class":393},"registerPrompt",[373,3092,2954],{"class":397},[373,3094,3095,3098],{"class":375,"line":309},[373,3096,3097],{"class":434},"  \"code-review\"",[373,3099,462],{"class":397},[373,3101,3102],{"class":375,"line":406},[373,3103,2787],{"class":397},[373,3105,3106,3108,3111],{"class":375,"line":412},[373,3107,2792],{"class":397},[373,3109,3110],{"class":434},"\"Code Review\"",[373,3112,462],{"class":397},[373,3114,3115,3117,3120],{"class":375,"line":419},[373,3116,2802],{"class":397},[373,3118,3119],{"class":434},"\"Review code for best practices\"",[373,3121,462],{"class":397},[373,3123,3124,3127,3129],{"class":375,"line":453},[373,3125,3126],{"class":397},"    argsSchema: { code: z.",[373,3128,2820],{"class":393},[373,3130,2281],{"class":397},[373,3132,3133],{"class":375,"line":465},[373,3134,2857],{"class":397},[373,3136,3137,3140,3142,3144,3146],{"class":375,"line":471},[373,3138,3139],{"class":397},"  ({ ",[373,3141,370],{"class":1228},[373,3143,2306],{"class":397},[373,3145,1632],{"class":379},[373,3147,2311],{"class":397},[373,3149,3150],{"class":375,"line":477},[373,3151,3152],{"class":397},"    messages: [{\n",[373,3154,3155,3158,3161],{"class":375,"line":483},[373,3156,3157],{"class":397},"      role: ",[373,3159,3160],{"class":434},"\"user\"",[373,3162,462],{"class":397},[373,3164,3165],{"class":375,"line":489},[373,3166,3167],{"class":397},"      content: {\n",[373,3169,3170,3173,3175],{"class":375,"line":505},[373,3171,3172],{"class":397},"        type: ",[373,3174,2320],{"class":434},[373,3176,462],{"class":397},[373,3178,3179,3182,3185,3188,3191,3193],{"class":375,"line":523},[373,3180,3181],{"class":397},"        text: ",[373,3183,3184],{"class":434},"`Please review this code:",[373,3186,3187],{"class":383},"\\n\\n",[373,3189,3190],{"class":434},"${",[373,3192,370],{"class":397},[373,3194,3195],{"class":434},"}`\n",[373,3197,3198],{"class":375,"line":539},[373,3199,2094],{"class":397},[373,3201,3202],{"class":375,"line":545},[373,3203,3063],{"class":397},[373,3205,3206],{"class":375,"line":550},[373,3207,3068],{"class":397},[373,3209,3210],{"class":375,"line":556},[373,3211,2933],{"class":397},[16,3213,3214],{},"Pretty powerful stuff, right?",[29,3216,3218],{"id":3217},"building-useful-tools","Building Useful Tools",[16,3220,3221],{},"The addition example is cute, but let's be real... You probably want to build something more useful...",[16,3223,3224],{},"Here are some ideas that actually make sense:",[16,3226,3227],{},[36,3228,3229],{},"Database Queries",[364,3231,3233],{"className":1552,"code":3232,"language":1554,"meta":308,"style":308},"server.registerTool(\"query_users\",\n  {\n    title: \"Query Users\",\n    description: \"Search for users in the database\",\n    inputSchema: { query: z.string(), limit: z.number().optional() }\n  },\n  async ({ query, limit = 10 }) => {\n    const users = await db.user.findMany({\n      where: { name: { contains: query } },\n      take: limit\n    });\n    return { content: [{ type: \"text\", text: JSON.stringify(users) }] };\n  }\n)\n",[370,3234,3235,3248,3252,3261,3270,3289,3293,3317,3336,3341,3346,3350,3370,3374],{"__ignoreMap":308},[373,3236,3237,3239,3241,3243,3246],{"class":375,"line":376},[373,3238,2773],{"class":397},[373,3240,2229],{"class":393},[373,3242,514],{"class":397},[373,3244,3245],{"class":434},"\"query_users\"",[373,3247,462],{"class":397},[373,3249,3250],{"class":375,"line":309},[373,3251,2787],{"class":397},[373,3253,3254,3256,3259],{"class":375,"line":406},[373,3255,2792],{"class":397},[373,3257,3258],{"class":434},"\"Query Users\"",[373,3260,462],{"class":397},[373,3262,3263,3265,3268],{"class":375,"line":412},[373,3264,2802],{"class":397},[373,3266,3267],{"class":434},"\"Search for users in the database\"",[373,3269,462],{"class":397},[373,3271,3272,3275,3277,3280,3282,3284,3287],{"class":375,"line":419},[373,3273,3274],{"class":397},"    inputSchema: { query: z.",[373,3276,2820],{"class":393},[373,3278,3279],{"class":397},"(), limit: z.",[373,3281,2273],{"class":393},[373,3283,2823],{"class":397},[373,3285,3286],{"class":393},"optional",[373,3288,2281],{"class":397},[373,3290,3291],{"class":375,"line":453},[373,3292,2857],{"class":397},[373,3294,3295,3297,3299,3301,3303,3306,3308,3311,3313,3315],{"class":375,"line":465},[373,3296,2862],{"class":379},[373,3298,2296],{"class":397},[373,3300,1294],{"class":1228},[373,3302,599],{"class":397},[373,3304,3305],{"class":1228},"limit",[373,3307,387],{"class":379},[373,3309,3310],{"class":383}," 10",[373,3312,2306],{"class":397},[373,3314,1632],{"class":379},[373,3316,1276],{"class":397},[373,3318,3319,3321,3324,3326,3328,3331,3334],{"class":375,"line":471},[373,3320,1281],{"class":379},[373,3322,3323],{"class":383}," users",[373,3325,387],{"class":379},[373,3327,1289],{"class":379},[373,3329,3330],{"class":397}," db.user.",[373,3332,3333],{"class":393},"findMany",[373,3335,398],{"class":397},[373,3337,3338],{"class":375,"line":477},[373,3339,3340],{"class":397},"      where: { name: { contains: query } },\n",[373,3342,3343],{"class":375,"line":483},[373,3344,3345],{"class":397},"      take: limit\n",[373,3347,3348],{"class":375,"line":489},[373,3349,2561],{"class":397},[373,3351,3352,3354,3357,3359,3361,3363,3365,3367],{"class":375,"line":505},[373,3353,2898],{"class":379},[373,3355,3356],{"class":397}," { content: [{ type: ",[373,3358,2320],{"class":434},[373,3360,2323],{"class":397},[373,3362,1683],{"class":383},[373,3364,27],{"class":397},[373,3366,1688],{"class":393},[373,3368,3369],{"class":397},"(users) }] };\n",[373,3371,3372],{"class":375,"line":523},[373,3373,1371],{"class":397},[373,3375,3376],{"class":375,"line":539},[373,3377,520],{"class":397},[16,3379,3380],{},[36,3381,3382],{},"API Integrations",[364,3384,3386],{"className":1552,"code":3385,"language":1554,"meta":308,"style":308},"server.registerTool(\"get_weather\",\n  {\n    title: \"Get Weather\",\n    description: \"Get current weather for a location\",\n    inputSchema: { location: z.string() }\n  },\n  async ({ location }) => {\n    const weather = await fetch(`https:\u002F\u002Fapi.weather.com\u002Fv1\u002Fcurrent?location=${location}`);\n    const data = await weather.json();\n    return { content: [{ type: \"text\", text: JSON.stringify(data) }] };\n  }\n)\n",[370,3387,3388,3401,3405,3414,3423,3432,3436,3451,3476,3494,3513,3517],{"__ignoreMap":308},[373,3389,3390,3392,3394,3396,3399],{"class":375,"line":376},[373,3391,2773],{"class":397},[373,3393,2229],{"class":393},[373,3395,514],{"class":397},[373,3397,3398],{"class":434},"\"get_weather\"",[373,3400,462],{"class":397},[373,3402,3403],{"class":375,"line":309},[373,3404,2787],{"class":397},[373,3406,3407,3409,3412],{"class":375,"line":406},[373,3408,2792],{"class":397},[373,3410,3411],{"class":434},"\"Get Weather\"",[373,3413,462],{"class":397},[373,3415,3416,3418,3421],{"class":375,"line":412},[373,3417,2802],{"class":397},[373,3419,3420],{"class":434},"\"Get current weather for a location\"",[373,3422,462],{"class":397},[373,3424,3425,3428,3430],{"class":375,"line":419},[373,3426,3427],{"class":397},"    inputSchema: { location: z.",[373,3429,2820],{"class":393},[373,3431,2281],{"class":397},[373,3433,3434],{"class":375,"line":453},[373,3435,2857],{"class":397},[373,3437,3438,3440,3442,3445,3447,3449],{"class":375,"line":465},[373,3439,2862],{"class":379},[373,3441,2296],{"class":397},[373,3443,3444],{"class":1228},"location",[373,3446,2306],{"class":397},[373,3448,1632],{"class":379},[373,3450,1276],{"class":397},[373,3452,3453,3455,3458,3460,3462,3465,3467,3470,3472,3474],{"class":375,"line":471},[373,3454,1281],{"class":379},[373,3456,3457],{"class":383}," weather",[373,3459,387],{"class":379},[373,3461,1289],{"class":379},[373,3463,3464],{"class":393}," fetch",[373,3466,514],{"class":397},[373,3468,3469],{"class":434},"`https:\u002F\u002Fapi.weather.com\u002Fv1\u002Fcurrent?location=${",[373,3471,3444],{"class":397},[373,3473,2916],{"class":434},[373,3475,2933],{"class":397},[373,3477,3478,3480,3483,3485,3487,3490,3492],{"class":375,"line":477},[373,3479,1281],{"class":379},[373,3481,3482],{"class":383}," data",[373,3484,387],{"class":379},[373,3486,1289],{"class":379},[373,3488,3489],{"class":397}," weather.",[373,3491,2476],{"class":393},[373,3493,2462],{"class":397},[373,3495,3496,3498,3500,3502,3504,3506,3508,3510],{"class":375,"line":483},[373,3497,2898],{"class":379},[373,3499,3356],{"class":397},[373,3501,2320],{"class":434},[373,3503,2323],{"class":397},[373,3505,1683],{"class":383},[373,3507,27],{"class":397},[373,3509,1688],{"class":393},[373,3511,3512],{"class":397},"(data) }] };\n",[373,3514,3515],{"class":375,"line":489},[373,3516,1371],{"class":397},[373,3518,3519],{"class":375,"line":505},[373,3520,520],{"class":397},[16,3522,3523],{},[36,3524,3525],{},"File Operations",[364,3527,3529],{"className":1552,"code":3528,"language":1554,"meta":308,"style":308},"server.registerTool(\"read_file\",\n  {\n    title: \"Read File\",\n    description: \"Read contents of a file\",\n    inputSchema: { path: z.string() }\n  },\n  async ({ path }) => {\n    const content = await fs.readFile(path, 'utf-8');\n    return { content: [{ type: \"text\", text: content }] };\n  }\n)\n)\n",[370,3530,3531,3544,3548,3557,3566,3575,3579,3594,3619,3630,3634,3638],{"__ignoreMap":308},[373,3532,3533,3535,3537,3539,3542],{"class":375,"line":376},[373,3534,2773],{"class":397},[373,3536,2229],{"class":393},[373,3538,514],{"class":397},[373,3540,3541],{"class":434},"\"read_file\"",[373,3543,462],{"class":397},[373,3545,3546],{"class":375,"line":309},[373,3547,2787],{"class":397},[373,3549,3550,3552,3555],{"class":375,"line":406},[373,3551,2792],{"class":397},[373,3553,3554],{"class":434},"\"Read File\"",[373,3556,462],{"class":397},[373,3558,3559,3561,3564],{"class":375,"line":412},[373,3560,2802],{"class":397},[373,3562,3563],{"class":434},"\"Read contents of a file\"",[373,3565,462],{"class":397},[373,3567,3568,3571,3573],{"class":375,"line":419},[373,3569,3570],{"class":397},"    inputSchema: { path: z.",[373,3572,2820],{"class":393},[373,3574,2281],{"class":397},[373,3576,3577],{"class":375,"line":453},[373,3578,2857],{"class":397},[373,3580,3581,3583,3585,3588,3590,3592],{"class":375,"line":465},[373,3582,2862],{"class":379},[373,3584,2296],{"class":397},[373,3586,3587],{"class":1228},"path",[373,3589,2306],{"class":397},[373,3591,1632],{"class":379},[373,3593,1276],{"class":397},[373,3595,3596,3598,3601,3603,3605,3608,3611,3614,3617],{"class":375,"line":471},[373,3597,1281],{"class":379},[373,3599,3600],{"class":383}," content",[373,3602,387],{"class":379},[373,3604,1289],{"class":379},[373,3606,3607],{"class":397}," fs.",[373,3609,3610],{"class":393},"readFile",[373,3612,3613],{"class":397},"(path, ",[373,3615,3616],{"class":434},"'utf-8'",[373,3618,2933],{"class":397},[373,3620,3621,3623,3625,3627],{"class":375,"line":477},[373,3622,2898],{"class":379},[373,3624,3356],{"class":397},[373,3626,2320],{"class":434},[373,3628,3629],{"class":397},", text: content }] };\n",[373,3631,3632],{"class":375,"line":483},[373,3633,1371],{"class":397},[373,3635,3636],{"class":375,"line":489},[373,3637,520],{"class":397},[373,3639,3640],{"class":375,"line":505},[373,3641,520],{"class":397},[16,3643,3644],{},"The possibilities are honestly endless...",[29,3646,3648],{"id":3647},"deployment-made-easy","Deployment Made Easy",[16,3650,3651],{},"Since this is just HTTP, you can deploy it literally anywhere...",[16,3653,3654,3657,3658,3661,3662,3665],{},[36,3655,3656],{},"Vercel\u002FNetlify",": Perfect for simple tools and integrations\n",[36,3659,3660],{},"Railway\u002FRender",": Great for more complex servers with databases\n",[36,3663,3664],{},"Your own VPS",": Full control, do whatever you want",[16,3667,3668],{},"Just make sure your endpoint is publicly accessible so Claude can reach it...",[29,3670,3672],{"id":3671},"testing-your-mcp-server","Testing Your MCP Server",[16,3674,3675],{},"There are a few ways to test your MCP server...",[16,3677,3678,3681],{},[36,3679,3680],{},"Option 1: MCP Inspector (Recommended)","\nThe easiest way is using the official MCP Inspector:",[364,3683,3685],{"className":1505,"code":3684,"language":1507,"meta":308,"style":308},"npx @modelcontextprotocol\u002Finspector http:\u002F\u002Flocalhost:3000\u002Froutes\u002Fmcp\n",[370,3686,3687],{"__ignoreMap":308},[373,3688,3689,3692,3695],{"class":375,"line":376},[373,3690,3691],{"class":393},"npx",[373,3693,3694],{"class":434}," @modelcontextprotocol\u002Finspector",[373,3696,3697],{"class":434}," http:\u002F\u002Flocalhost:3000\u002Froutes\u002Fmcp\n",[16,3699,3700],{},"This gives you a nice web interface to test all your tools, resources, and prompts...",[16,3702,3703,3706],{},[36,3704,3705],{},"Option 2: Manual Testing","\nYou can also test with curl if you want to go old school:",[364,3708,3710],{"className":1505,"code":3709,"language":1507,"meta":308,"style":308},"curl -X POST http:\u002F\u002Flocalhost:3000\u002Froutes\u002Fmcp \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"tools\u002Fcall\",\n    \"params\": {\n      \"name\": \"add\",\n      \"arguments\": { \"a\": 5, \"b\": 3 }\n    },\n    \"id\": 1\n  }'\n",[370,3711,3712,3729,3739,3747,3752,3757,3762,3767,3772,3776,3781],{"__ignoreMap":308},[373,3713,3714,3717,3720,3723,3726],{"class":375,"line":376},[373,3715,3716],{"class":393},"curl",[373,3718,3719],{"class":383}," -X",[373,3721,3722],{"class":434}," POST",[373,3724,3725],{"class":434}," http:\u002F\u002Flocalhost:3000\u002Froutes\u002Fmcp",[373,3727,3728],{"class":383}," \\\n",[373,3730,3731,3734,3737],{"class":375,"line":309},[373,3732,3733],{"class":383},"  -H",[373,3735,3736],{"class":434}," \"Content-Type: application\u002Fjson\"",[373,3738,3728],{"class":383},[373,3740,3741,3744],{"class":375,"line":406},[373,3742,3743],{"class":383},"  -d",[373,3745,3746],{"class":434}," '{\n",[373,3748,3749],{"class":375,"line":412},[373,3750,3751],{"class":434},"    \"jsonrpc\": \"2.0\",\n",[373,3753,3754],{"class":375,"line":419},[373,3755,3756],{"class":434},"    \"method\": \"tools\u002Fcall\",\n",[373,3758,3759],{"class":375,"line":453},[373,3760,3761],{"class":434},"    \"params\": {\n",[373,3763,3764],{"class":375,"line":465},[373,3765,3766],{"class":434},"      \"name\": \"add\",\n",[373,3768,3769],{"class":375,"line":471},[373,3770,3771],{"class":434},"      \"arguments\": { \"a\": 5, \"b\": 3 }\n",[373,3773,3774],{"class":375,"line":477},[373,3775,2287],{"class":434},[373,3777,3778],{"class":375,"line":483},[373,3779,3780],{"class":434},"    \"id\": 1\n",[373,3782,3783],{"class":375,"line":489},[373,3784,3785],{"class":434},"  }'\n",[16,3787,3788,3791],{},[36,3789,3790],{},"Option 3: Connect to Claude Desktop","\nOnce your server is running, you can add it to Claude Desktop's configuration and test it in real conversations...",[16,3793,3794,3797],{},[36,3795,3796],{},"Option 4: Connect to Cursor","\nIf you're using Cursor (the AI code editor), you can add your server to the MCP settings...",[16,3799,3800],{},"Open Cursor Settings and add this to your MCP configuration:",[364,3802,3805],{"className":3803,"code":3804,"language":2476,"meta":308,"style":308},"language-json shiki shiki-themes github-light github-dark","{\n  \"mcpServers\": {\n    \"your-mcp-server-name\": {\n      \"type\": \"http\",\n      \"url\": \"http:\u002F\u002Flocalhost:3000\u002Froutes\u002Fmcp\"\n    }\n  }\n}\n",[370,3806,3807,3812,3820,3827,3840,3850,3854,3858],{"__ignoreMap":308},[373,3808,3809],{"class":375,"line":376},[373,3810,3811],{"class":397},"{\n",[373,3813,3814,3817],{"class":375,"line":309},[373,3815,3816],{"class":383},"  \"mcpServers\"",[373,3818,3819],{"class":397},": {\n",[373,3821,3822,3825],{"class":375,"line":406},[373,3823,3824],{"class":383},"    \"your-mcp-server-name\"",[373,3826,3819],{"class":397},[373,3828,3829,3832,3835,3838],{"class":375,"line":412},[373,3830,3831],{"class":383},"      \"type\"",[373,3833,3834],{"class":397},": ",[373,3836,3837],{"class":434},"\"http\"",[373,3839,462],{"class":397},[373,3841,3842,3845,3847],{"class":375,"line":419},[373,3843,3844],{"class":383},"      \"url\"",[373,3846,3834],{"class":397},[373,3848,3849],{"class":434},"\"http:\u002F\u002Flocalhost:3000\u002Froutes\u002Fmcp\"\n",[373,3851,3852],{"class":375,"line":453},[373,3853,1351],{"class":397},[373,3855,3856],{"class":375,"line":465},[373,3857,1371],{"class":397},[373,3859,3860],{"class":375,"line":471},[373,3861,542],{"class":397},[16,3863,3864],{},"Then just let that connect, and your MCP server will be available for AI interactions...",[29,3866,3868],{"id":3867},"whats-next","What's Next?",[16,3870,3871],{},"This is just the beginning...",[16,3873,3874],{},"You could build MCP servers for pretty much anything:",[107,3876,3877,3880,3883,3886,3889],{},[110,3878,3879],{},"Custom analytics dashboards",[110,3881,3882],{},"Internal company tools",[110,3884,3885],{},"Database management",[110,3887,3888],{},"File system operations",[110,3890,3891],{},"Third-party API integrations",[16,3893,3894],{},"The cool thing is that once you build it, Claude can use it naturally in conversation...",[16,3896,3897],{},"Want to see more advanced examples? I'm thinking about open-sourcing some of the MCP servers we use at Pogton... Would that be useful?",[16,3899,3900],{},"Let me know what kind of tools you'd want to build with this...",[1413,3902,3903],{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":308,"searchDepth":309,"depth":309,"links":3905},[3906,3907,3908,3909,3910,3911,3912,3913,3914,3915],{"id":1460,"depth":309,"text":1461},{"id":1495,"depth":309,"text":1496},{"id":1545,"depth":309,"text":1546},{"id":2370,"depth":309,"text":2371},{"id":2412,"depth":309,"text":2413},{"id":2750,"depth":309,"text":2751},{"id":3217,"depth":309,"text":3218},{"id":3647,"depth":309,"text":3648},{"id":3671,"depth":309,"text":3672},{"id":3867,"depth":309,"text":3868},"Want to create custom tools for Claude? Here's how to build your own Model Context Protocol server with TypeScript and deploy it anywhere...","\u002Fimages\u002Fblog\u002Fmcp-server-typescript.jpg",{"category":3919,"featured":324,"readTime":3920},"Development","8 min","\u002Fblog\u002Fbuild-your-own-mcp-server-typescript","2025-07-22",{"keywords":3924,"title":1443,"description":3916},[3925,3926,3927,3928,3929,3930,3931],"MCP server","Model Context Protocol","TypeScript","Claude AI","Nitro","Express","AI tools","Build an MCP Server with TypeScript: Full Guide","blog\u002Fbuild-your-own-mcp-server-typescript",[3935,3927,1477,3936,3919,3929,3930],"MCP","AI","7FRtEmZ61kc81No5_P1FPoyks9eUwsYNqrArEgd4lcI",1794240386726]