Enables testing of the MCP server by spawning it as a child process to validate its I/O behavior, supporting various test modes including coverage reporting.
Provides tools for generating Markdown-formatted explanations of calculations, practice problems, and tutoring content through various calculator functions.
Used to visualize and document the sequence diagram of parent-child process communication in the MCP server documentation.
Serves as the runtime environment for the MCP server, managing the process-based architecture and handling stdin/stdout communication streams.
Provides type safety and structure for the MCP server implementation, with the server being built using TypeScript 5.x.
Implements rigorous validation of incoming request parameters through Zod schemas to ensure type safety and prevent injection-style attacks.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@example-mcp-server-stdiocalculate 15 * 3 + 7"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
example-mcp-stdio
production-ready, learning-focused starter for MCP servers over STDIO using TypeScript SDK v2.
part of a series: stdio (you are here) · stateless · stateful · sse
what it does
runs an MCP server that communicates exclusively over STDIO (stdin/stdout JSON-RPC, stderr for logs)
ships two tools (
echo,sum_numbers), two resources (starter-checklist,starter-lesson), and one prompt (scaffold-plan)loads features automatically from
src/features/using a file-based registrar patternincludes a scaffold CLI to generate new tools, resources, and prompts from templates
enforces quality with a full pipeline: typecheck, lint, format, build, smoke test
Related MCP server: mcp-serverTest
quick start
git clone https://github.com/yigitkonur/example-mcp-stdio.git
cd example-mcp-stdio
npm cirun in development mode:
npm run devor build and run:
npm run build && npm startvalidate everything:
npm run pipelinescaffold cli
generate new feature modules with a single command:
node dist/index.js create tool my-tool
node dist/index.js create resource my-resource --uri my://resource
node dist/index.js create prompt my-promptgenerated files land in src/features/<kind>/ and are picked up automatically on next server start.
full reference: docs/03-scaffold-cli.md
documentation
doc | what it covers |
reading order and audience guide | |
prerequisites, install, first run, Docker | |
module layout, registrar pattern, STDIO transport model | |
serve and create commands, options, naming conventions | |
vendoring strategy, v2 patterns, migration notes | |
pipeline breakdown, smoke test, mcp-cli verification |
sdk v2 context
this repo targets the TypeScript SDK v2 pre-release (@modelcontextprotocol/server). because v2 is not yet published to npm, the package is vendored as a tarball in vendor/. refresh it with npm run vendor:sdk:update. see docs/04-sdk-v2-notes.md for details.
license
MIT