@@ -22,35 +22,17 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
2222 </Step >
2323
2424 <Step title = " Create a new project" >
25+ You can use our [ create-typescript-server] ( https://github.com/modelcontextprotocol/create-typescript-server ) tool to bootstrap a new project:
26+
2527 ``` bash
26- mkdir weather-server
28+ npx @modelcontextprotocol/create-server weather-server
2729 cd weather-server
28- npm init -y
2930 ```
3031 </Step >
3132
3233 <Step title = " Install dependencies" >
3334 ``` bash
34- npm install @modelcontextprotocol/sdk axios dotenv typescript @types/node
35- npm install --save-dev ts-node
36- ```
37- </Step >
38-
39- <Step title = " Configure TypeScript" >
40- Create ` tsconfig.json ` :
41- ```json
42- {
43- " compilerOptions" : {
44- " target" : " ES2020" ,
45- " module" : " ES2020" ,
46- " moduleResolution" : " node" ,
47- " esModuleInterop" : true ,
48- " outDir" : " ./dist" ,
49- " rootDir" : " ./src" ,
50- " strict" : true
51- },
52- " include" : [" src/**/*" ]
53- }
35+ npm install --save axios dotenv
5436 ```
5537 </Step >
5638
@@ -65,16 +47,8 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
6547## Create your server
6648
6749<Steps >
68- <Step title = " Create project structure" >
69- ``` bash
70- mkdir src
71- touch src/index.ts
72- touch src/types.ts
73- ```
74- </Step >
75-
7650 <Step title = " Define types" >
77- In ` src/ types.ts` :
51+ Create a file ` types.ts ` , and add the following :
7852
7953 ``` typescript
8054 export interface OpenWeatherResponse {
@@ -124,7 +98,7 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
12498 </Step >
12599
126100 <Step title = " Add the base code" >
127- In ` src/ index.ts` :
101+ Replace ` index.ts ` with the following :
128102
129103 ``` typescript
130104 import { Server } from " @modelcontextprotocol/sdk/server/index.js" ;
@@ -376,21 +350,9 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
376350 </Step >
377351
378352 <Step title = " Build and test" >
379- Add these scripts to ` package.json ` :
380- ```json
381- {
382- " scripts" : {
383- " build" : " tsc" ,
384- " start" : " node dist/index.js" ,
385- " dev" : " ts-node src/index.ts"
386- }
387- }
388- ```
389-
390- Then run:
391353 ``` bash
392354 npm run build
393- npm install -g .
355+ npm link
394356 ```
395357 </Step >
396358</Steps >
@@ -628,4 +590,4 @@ npx tsc --noEmit
628590
629591<Note >
630592Need help? Ask Claude! Since it has access to the MCP SDK documentation, it can help you debug issues and suggest improvements to your server.
631- </Note >
593+ </Note >
0 commit comments