The stdio transport is the recommended transport mechanism for local MCP servers as of the MCP Specification 2025-06-18. It communicates through standard input and output streams, requires no HTTP server, and is simpler to implement, debug, and secure than any web-based transport.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/microsoft/mcp-for-beginners/llms.txt
Use this file to discover all available pages before exploring further.
Learning objectives
By the end of this lesson you will be able to:- Explain how the stdio transport works and why it is recommended
- Build an MCP server using stdio in Python, TypeScript, and .NET
- Debug a stdio server with the MCP Inspector
- Integrate a stdio server with VS Code and Claude Desktop
How stdio transport works
| Aspect | Detail |
|---|---|
| Communication | Server reads JSON-RPC messages from stdin; writes responses to stdout |
| Process model | Client launches the server as a subprocess |
| Message format | Newline-delimited JSON-RPC (no embedded newlines) |
| Logging | Server writes UTF-8 strings to stderr — never to stdout |
| Security | Process isolation; no open network ports |
The server MUST NOT write anything to
stdout that is not a valid MCP message. Use stderr for all logging.Stdio vs. deprecated SSE
| stdio (current standard) | SSE (deprecated) | |
|---|---|---|
| Setup | No web server needed | Requires HTTP server |
| Security | Process isolation | Requires CORS, auth |
| Performance | Direct stream | HTTP overhead |
| Debugging | Simple — pipe Inspector directly | Requires network tools |
Building a stdio server
- Python
- TypeScript
- .NET
Debugging your stdio server
Run the Inspector with your server
- Python
- TypeScript
Integrating with Claude Desktop
Add your server to the Claude Desktop config file:- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- “Can you greet me using the greeting tool?”
- “Calculate the sum of 15 and 27”
Debugging tips
Common issues and fixes
Common issues and fixes
Server won’t start
- Check that all dependencies are installed:
pip install mcp - Verify Python syntax and indentation
- Look for error messages in the console
- Ensure
@server.tool()decorators are present - Check that tool functions are defined before
main() - Verify the server is using stdio transport correctly
- Use
logging/stderrfor debug output — neverprint()orconsole.log()to stdout - The MCP transport layer reads everything on stdout as a protocol message
Key takeaways
- The stdio transport is the recommended mechanism for local MCP servers (MCP spec 2025-06-18).
- Stdio provides process isolation with no open network ports — simpler and more secure than HTTP-based transports.
- You can debug stdio servers with the MCP Inspector and VS Code’s debugger.
- Never write non-MCP content to
stdout; usestderrfor logging.