Skip to content

This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.

License

Notifications You must be signed in to change notification settings

ntk148v/mcp-server-template

Repository files navigation

MCP Server Cookiecutter template

A Cookiecutter template for creating Model Context Protocol (MCP) servers with Python.

GitHub license GitHub stars

Table of contents:

1. Introduction

  • 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

2. Quickstart

2.1. Requirements

  • Python 3.12
  • Cookiecutter

2.2. Create a project

# 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

2.3. Getting started with your new server

  • 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

3. License

Apache 2.0


Made with ❤️ by @ntk148v

About

This template provides a streamlined foundation for building Model Context Protocol (MCP) servers in Python. It's designed to make AI-assisted development of MCP tools easier and more efficient.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published