Skip to content

Commit 4cee64b

Browse files
Merge pull request modelcontextprotocol#39 from modelcontextprotocol/justin/fix-console-log
Fix TypeScript first server logging to stdout
2 parents 1df6f8b + 5e01994 commit 4cee64b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/first-server/typescript.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
192192
async run(): Promise<void> {
193193
const transport = new StdioServerTransport();
194194
await this.server.connect(transport);
195-
console.log("Weather MCP server running on stdio");
195+
196+
// Although this is just an informative message, we must log to stderr,
197+
// to avoid interfering with MCP communication that happens on stdout
198+
console.error("Weather MCP server running on stdio");
196199
}
197200
}
198201

0 commit comments

Comments
 (0)