-
Notifications
You must be signed in to change notification settings - Fork 30
chore: Update sample code with new MCP SDK #1303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,6 @@ | |
| "@types/express": "^5.0.5", | ||
| "express": "^5.1.0", | ||
| "uuid": "^13.0.0", | ||
| "zod": "^3.25.76" | ||
| "zod": "^4.1.13" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,18 +3,22 @@ | |
| /* eslint-disable import/no-internal-modules */ | ||
| import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; | ||
| import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; | ||
| import * as z from 'zod/v3'; | ||
| import * as z from 'zod'; | ||
|
|
||
| const server = new McpServer({ | ||
| name: 'Open-Meteo Weather MCP Server', | ||
| version: '1.0.0' | ||
| }); | ||
|
|
||
| server.tool( | ||
| server.registerTool( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As the line numbers changed a bit now, can you check if the referred line numbers in the documentation are still valid? |
||
| 'get_weather', | ||
| 'Tool to fetch weather details for a specific city', | ||
| { | ||
| city: z.string().describe('The name of the city to get the weather for') | ||
| description: 'Tool to fetch weather details for a specific city', | ||
| inputSchema: { | ||
| city: z | ||
| .string() | ||
| .meta({ description: 'The name of the city to get the weather for' }) | ||
| } | ||
| }, | ||
| async ({ city }) => { | ||
| try { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested all work.