A Cookiecutter template for creating Model Context Protocol (MCP) servers with Python.
Table of contents:
- This template provides you a easy managable way to create your own MCP server. MCP servers can expose:
- Tools: Functions that LLMs can execute to perform actions
- Resources: Data sources that LLMs can access for context
- Prompts: Reusable templates for LLM interactions
- Features:
- Complete project structure with all necessary components pre-configured
- Configurable transport modes (stdio, SSE)
- Suport tools, resources and prompts.
- Docker support for containerized deployment
- FastMCP integration for simple decorator-based development
- Github actions
- Minimal dependencies
- Python 3.12
- Cookiecutter
# Generate a new MCP server project from the template
cookiecutter gh:ntk148v/mcp-server-template
# Or from local copy
cookiecutter path/to/mcp-server-template
# Enter your desired input
- File structure:
{{cookiecutter.project_name}}
├── Dockerfile
├── .github
│ └── workflows
│ ├── docker.yaml
│ └── publish.yaml
├── .gitignore
├── LICENSE
├── Makefile
├── pyproject.toml
├── README.md
├── src
│ └── {{cookiecutter.module_name}}
│ ├── __init__.py
│ ├── main.py
│ └── server
│ ├── __init__.py
│ ├── prompts
│ │ ├── __init__.py
│ │ └── prompts.py
│ ├── resources
│ │ ├── __init__.py
│ │ └── resources.py
│ └── tools
│ ├── __init__.py
│ └── tools.py
└── tests
└── .gitkeep
main.py |
Main configuration |
server/__init__.py |
Init FastMCP server |
server/tools |
Tool implementations (functions that the LLM can call to perform actions) |
server/resources |
Resource implementations (data sources that provide context to the LLM) |
server/prompts |
Prompt template implementations (reusable conversation templates) |
tests/ |
Test cases |
- Edit these files according to your need: adding a new tool, a new resource, ...
- Run dev mode for testing:
$ make dev
- Install in Claude Desktop:
$ make install
Made with ❤️ by @ntk148v