MCP Base
@josharsh
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP
Overview
What is MCP Base?
MCP Base is a production-ready, extensible Python template for building Model Context Protocol (MCP) servers. It provides a modular foundation for creating servers that expose tools, prompts, and resources to LLMs and agentic clients.
How to use MCP Base?
Install dependencies with pip install -r requirements.txt, copy .env.example to .env and configure, then run the server using python main.py --transport=stdio (STDIO) or follow transport-specific READMEs for SSE/HTTP.
Key features of MCP Base
- Multi‑transport support: STDIO, SSE, HTTP
- Modular tools, prompts, and resources with base classes
- Type‑safe input validation using Pydantic
- Security best practices: directory sandboxing, input validation
- Production‑ready: logging, environment management, Docker support
- Comprehensive documentation for users and contributors
Use cases of MCP Base
- Rapidly prototype a filesystem tool server for LLM agents
- Build and deploy an API tool that fetches external data
- Create a text summarization prompt server
- Develop a dynamic resource provider for LLM clients
- Test and containerize MCP servers using the provided Dockerfile
FAQ from MCP Base
Is MCP Base a ready-to-use MCP server?
No – it is a starter template. You add your own tools, prompts, and resources by creating classes and registering them in the provided registries.
What dependencies are required?
MCP Base uses Python 3 and lists dependencies in requirements.txt and pyproject.toml. It is built on the official MCP Python SDK and uses Pydantic for schemas.
What transport protocols does MCP Base support?
It supports STDIO, SSE, and HTTP transports. Each is modular and documented in separate READMEs under /src/transports/.
How are files and data secured?
All file and directory operations are sandboxed to allowed paths. Input validation is enforced for all tool/resource inputs, and sensitive configuration is managed via environment variables.
Can I contribute to MCP Base?
Yes, contributions are welcome. See CONTRIBUTING.md for guidelines, code style, and the pull request process.