Merge pull request #39 from modelcontextprotocol/justin/fix-console-log

Fix TypeScript first server logging to stdout
This commit is contained in:
Justin Spahr-Summers 2024-11-25 16:56:50 -06:00 • committed by GitHub
commit 4cee64bb2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -192,7 +192,10 @@ This guide uses the OpenWeatherMap API. You'll need a free API key from [OpenWea
async run(): Promise<void> {
const transport = new StdioServerTransport();
await this.server.connect(transport);
console.log("Weather MCP server running on stdio");
// Although this is just an informative message, we must log to stderr,
// to avoid interfering with MCP communication that happens on stdout
console.error("Weather MCP server running on stdio");
}
}