This repository is a complete, layered MCP server scaffold in Rust using stdio transport.
src/domain: core types and contractssrc/application: request handling and MCP method routingsrc/tools: tool implementations and registrysrc/infrastructure: transport implementation (stdio)src/main.rs: process bootstrap and runtime loop
Configuration is loaded in this order:
- Defaults from
ServerConfig - Optional JSON file:
mcp-server.json(or path fromMCP_SERVER_CONFIG_PATH) - Environment variable overrides
Supported environment variables:
MCP_SERVER_NAMEMCP_SERVER_VERSIONMCP_SERVER_PROTOCOL_VERSIONMCP_SERVER_TOOLS_LIST_CHANGED
An example config file is available at mcp-server.example.json.
echo: returns the input messagenow: returns the current UTC timestamp in RFC3339 format
Server only:
cargo runWindows shortcut:
.\bin\run-server.batClient (spawns server internally):
cargo run --bin clientSee CLIENT.md for more details on the client module.
VS Code task:
- Run task
Run MCP Serverfrom the Command Palette.
Run unit tests:
cargo testRun integration tests only:
cargo test --test integration_testsRun smoke test (interactive server validation):
.\bin\test-tools.batSee TESTS.md for full test documentation.
The server communicates over stdio using JSON-RPC framing (Content-Length headers), compatible with MCP clients.
- Add a new tool under
src/toolsimplementing theTooltrait. - Register it in
ToolRegistry::new()insrc/tools/mod.rs. - Keep protocol handling in
src/application/mcp_service.rsfocused on MCP method dispatch.