python-starter MCP server
Commit Nov 12, 2026Provides a production-ready Python template for building MCP servers with support for stdio, Streamable HTTP, OAuth, and backend API integration.
Also known as opikdev/mcp-server-python-starter
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 12, 2026
- License
- MIT
What is python-starter MCP?
python-starter provides a production-ready Python template for building MCP servers with support for stdio, Streamable HTTP, OAuth, and backend API integration.
Summary generated from the project's README
About python-starter MCP server
Building production-ready Model Context Protocol servers in Python is made easier with this starter template. It provides a foundation for developers to create custom tools for coding agents using the official MCP Python SDK. The template supports local connections via stdio for clients like Claude Desktop, Cursor, and Claude Code, while also offering stateless Streamable HTTP for remote, horizontally scalable deployments.
Security is integrated through OAuth per the MCP authorization spec or static tokens, including per-tool scopes and protection against DNS rebinding. Developers can integrate backend REST APIs using tools like list_notes and create_note, which support service accounts or user-specific token exchange. The setup includes built-in support for OpenTelemetry traces, readiness checks, and a complete release pipeline for PyPI and the MCP Registry.
What you can do with it
- 1Deploying remote MCP serversA developer can host a scalable server using Streamable HTTP to serve remote clients.
- 2Connecting to existing REST APIsYou can build tools that interact with a backend notes service using validated responses.
- 3Implementing secure tool accessAn engineer can restrict tool usage using specific OAuth scopes and challenges.
Written from the project's README. Every use case is checked against a quote from it.
README
View on GitHubMCP server Python starter
A production-ready Model Context Protocol server in Python, ready to customize with coding agents. It runs over stdio for local clients and Streamable HTTP for remote ones, with OAuth, sample tools that include calls to a backend API, tests through real MCP clients, and a release pipeline.
Features
- Current protocol: built on the official MCP Python SDK v2 and its
MCPServerAPI, for the 2026-07-28 spec, while still serving older clients. - Two transports: stdio for Claude Code, Claude Desktop, and Cursor, plus stateless Streamable HTTP that scales horizontally.
- Secure HTTP: OAuth per the MCP authorization spec, with per-tool scopes and
403scope challenges, or static tokens. It won't start without an auth mode, and it blocks DNS rebinding. - Typed tools:
get_time,search_docs, andwhoamiuse type hints and Pydantic models as their schemas, with annotations and readable errors, plusdocs://resources. - Backend integration:
list_notesandcreate_notecall any REST API that meets a documented notes contract, with deadlines, validated responses, and errors the model can act on. They use a service account, or act as each user through token exchange. See Connect a backend API. - Production ready: readiness and graceful drain, OpenTelemetry traces and metrics, and a deploy guide with proxy, TLS, and identity provider setup.
- Real tests: tools are tested through real MCP clients in process, over stdio, and over HTTP, on both protocol eras, plus the built wheel and the Docker image.
- Strict gates: Ruff, mypy in strict mode, and 90% coverage.
- Publishing: releases to PyPI, the MCP Registry, and GHCR, with digest-pinned base images, a vulnerability scan before push, an SBOM, and provenance. A test keeps
server.json,pyproject.toml, and the image label in step. - Agent-ready:
AGENTS.md, skills, and checks that run on every commit.
Quick start
You need uv, which installs Python 3.15 for you, and Node for the MCP Inspector:
git clone https://github.com/opikdev/mcp-server-python-starter
cd mcp-server-python-starter
make sync
make inspect
The MCP Inspector opens in your browser. Connect, list the tools, and call get_time. To try the notes tools too, pass the UPSTREAM_* settings, as Connect a backend API shows.
To run it over HTTP in Docker instead:
docker compose up --build --wait mcp
The server is now at http://localhost:3000/mcp, with the dev token dev-token-change-me-0123. To connect Claude Code, Claude Desktop, Cursor, or VS Code, see Connect a client.
Start your own project
Create a renamed copy with pik. It downloads this starter's latest release, then sets your project name and GitHub owner:
pik new mcp-server-python-starter my-mcp-server
Or select Use this template on GitHub. That copy keeps the name mcp-server-python-starter and the owner opikdev, so follow pik.yaml by hand: swap the replace text, delete the exclude paths, and run the setup commands.
Usage
| Task | Command |
|---|---|
| Try the tools in the MCP Inspector | make inspect |
| Serve over HTTP on your machine | cp .env.example .env, then make dev |
| Run lint, types, tests with coverage, and repo checks | make verify |
| Test the built wheel, the Docker image, and an example backend | make e2e |
| Fix formatting and lint you can fix automatically | make format |
To work in a dev container, open the folder in one: .devcontainer/ has Python, uv, and jq, so make verify runs inside it. make e2e needs Docker on the host. Over HTTP, the server needs an auth mode. See Configure HTTP auth.
To add a tool, create a module in src/mcp_app/tools/ with a register_* function, call it from src/mcp_app/server.py, and test it in tests/integration/test_tools.py. Before you release, read Publish a release.
Project structure
| Path | Purpose |
|---|---|
src/mcp_app/cli.py |
Entry point: stdio by default, or HTTP with --http |
src/mcp_app/server.py |
Builds the server with every tool and resource |
src/mcp_app/tools/ |
One module per tool, or a small related set |
src/mcp_app/resources/ |
docs:// resources |
src/mcp_app/http.py, src/mcp_app/auth/ |
The HTTP app, health and readiness, token verifiers, and scope challenges |
src/mcp_app/upstream/ |
Clients for backend APIs, and the credential each call uses |
compose.auth.yaml, keycloak/ |
A local Keycloak for OAuth and token exchange |
tests/ |
Unit, integration, and end-to-end tests |
server.json |
MCP Registry metadata |
docs/ |
Architecture, guides, and decisions |
Contributing
Read CONTRIBUTING.md before opening a pull request, and follow the code of conduct.
Security
Report vulnerabilities privately, as described in SECURITY.md.
License
Released under the MIT License.
python-starter MCP questions
What transport protocols does this server support?
It supports stdio for local clients like Claude Desktop and Cursor, as well as stateless Streamable HTTP for remote scaling.
How can I connect a backend API to the tools?
You can integrate any REST API that follows a documented notes contract using service accounts or user token exchange.
Does the server include security features for HTTP?
Yes, it implements OAuth per the MCP authorization spec with per-tool scopes and blocks DNS rebinding.