Substrate - MCP Foundation Layer
Substrate provides the foundation for building production-grade Model Context Protocol (MCP) servers. It includes base classes, documentation, and patterns that ensure consistent, reliable implementations.
Overview
Substrate is:
- Foundation Layer: Base classes and interfaces for all MCP servers
- Documentation Server: Serves methodology and architecture documentation
- Pattern Library: Common patterns for MCP implementation
- Passive Component: Provides structure but no active functionality
Features
- Base MCP Class: Standard patterns for all MCP servers
- Response Builders: Structured response creation
- Error Handling: Consistent error patterns
- Progress Tracking: Real-time operation feedback
- Sampling Support: Intelligent assistance integration
- Documentation Loading: Flexible documentation system
Installation
As a Dependency
For use in your MCP server:
Or in your pyproject.toml
:
For Development
Usage
Creating an MCP Server
Running Substrate Server
Docker Usage
Documentation System
Substrate can serve different documentation sets:
- Bundled Docs: Default examples included with substrate
- Custom Docs: Your own methodology and architecture
Custom Documentation
Mount your documentation at runtime:
Your documentation directory should contain:
atlas.md
- Development methodologysystem-design.md
- System architecturecomponent-map.json
- Component registry
Base Classes
SubstrateMCP
The foundation for all MCP servers:
Response Patterns
Progress Tracking
Integration with AKAB
Substrate is designed to work with AKAB for A/B testing:
Best Practices
- Production-Grade Only: Real implementations, no mocks
- Clear Separation: Each MCP does one thing well
- Explicit Interfaces: No implicit behaviors
- Structured Errors: Always provide actionable feedback
- Clean Logging: Use stderr, never stdout
Common Issues
Stdout Pollution
MCP uses JSON-RPC over stdio. Any print() breaks the protocol.
Solution: Log to stderr
AsyncIO Conflicts
FastMCP manages its own event loop.
Solution: Don't use asyncio.run()
Examples
See the included example documentation:
docs/atlas.md
- Example development methodologydocs/system-design.md
- Example system architecturedocs/component-map.json
- Example component structure
Contributing
- Follow the Atlas methodology
- Ensure all tests pass
- Update documentation as needed
- Submit PR with clear description
License
MIT License - see LICENSE file for details
This server cannot be installed
A foundation layer for building production-grade Model Context Protocol (MCP) servers with base classes, documentation, and consistent implementation patterns.
Related MCP Servers
- AsecurityAlicenseAqualityA beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.Last updated -361461JavaScriptApache 2.0
- -securityAlicense-qualityMCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.Last updated -14TypeScriptMIT License
- AsecurityFlicenseAqualityA specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.Last updated -82TypeScript
- AsecurityFlicenseAqualityA ready-to-use starter implementation of the Model Context Protocol (MCP) server that enables applications to provide standardized context for LLMs with sample resources, tools, and prompts.Last updated -2TypeScript