File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,19 @@ def weather_report(location: str) -> str:
5050if __name__ == " __main__" :
5151 mcp.run()
5252
53+ Once you have your server implemented, you can start it by running the server script.
54+
55+ ```bash
56+ mcp dev server.py
57+ ```
58+
5359```
5460
5561</hfoption>
5662<hfoption id="javascript">
5763
5864```javascript
65+ // index.mjs
5966import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
6067import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6168import { z } from "zod";
@@ -118,15 +125,15 @@ const transport = new StdioServerTransport();
118125await server.connect(transport);
119126```
120127
121- </hfoption >
122- </hfoptions >
123-
124128Once you have your server implemented, you can start it by running the server script.
125129
126130``` bash
127- mcp dev server.py
131+ npx @modelcontextprotocol/inspector node ./index.mjs
128132```
129133
134+ </hfoption >
135+ </hfoptions >
136+
130137This will initialize a development server running the file ` server.py ` . And log the following output:
131138
132139``` bash
Original file line number Diff line number Diff line change @@ -152,9 +152,17 @@ server.prompt(
152152const transport = new StdioServerTransport ();
153153await server .connect (transport);
154154```
155+
156+ Sau khi đã triển khai máy chủ của mình, bạn có thể khởi chạy nó bằng cách chạy script server.
157+
158+ ``` bash
159+ mcp dev server.py
160+ ```
161+
155162</details >
156163
157164``` javascript
165+ // index.mjs
158166import { McpServer , ResourceTemplate } from " @modelcontextprotocol/sdk/server/mcp.js" ;
159167import { StdioServerTransport } from " @modelcontextprotocol/sdk/server/stdio.js" ;
160168import { z } from " zod" ;
@@ -217,15 +225,15 @@ const transport = new StdioServerTransport();
217225await server .connect (transport);
218226```
219227
220- </hfoption >
221- </hfoptions >
222-
223228Sau khi đã triển khai máy chủ của mình, bạn có thể khởi chạy nó bằng cách chạy script server.
224229
225230``` bash
226- mcp dev server.py
231+ npx @modelcontextprotocol/inspector node ./index.mjs
227232```
228233
234+ </hfoption >
235+ </hfoptions >
236+
229237Lệnh này sẽ khởi tạo một máy chủ phát triển chạy file ` server.py ` và ghi lại output sau:
230238
231239<details >
You can’t perform that action at this time.
0 commit comments