MCP Server (Python)
Scaffolds a Model Context Protocol server in Python using the official mcp SDK and FastMCP. Produces a working server with example tools and resources, configurable for stdio or streamable-http transport. Uses Pydantic for input validation and structlog for structured logging.
| Name | mcp-server-python |
| Version | 0.1.0 |
| Category | ai-systems |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | mcp, python, ai, tools, server |
| Source | templates/mcp-server-python |
Render it
Three front doors, one catalog. Pick whichever suits the caller.
# CLI
npx @nanohype/sdk render mcp-server-python --out ./my-app
# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "mcp-server-python", variables);
# MCP — from an agent
get_template({ name: "mcp-server-python" })Prerequisites
| Tool | Version | Why |
|---|---|---|
python | >=3.10 | Python runtime for the MCP server |
pip | — | Package management and dependency installation |
Variables
Required
ProjectNamestring- Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.
Optional
Descriptionstring — defaults toAn MCP server in Python- Short project description for pyproject.toml and README
Transportstring — defaults tostdio- Server transport protocol (stdio or http)
IncludeTestsbool — defaults totrue- Include test suite with pytest
What it produces
23 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.
.env.example
.gitignore
pyproject.toml
README.md
src/__init__.py
src/config.py
src/logger.py
src/main.py
src/resources/__init__.py
src/resources/example.py
src/resources/registry.py
src/server.py
src/tools/__init__.py
src/tools/example.py
src/tools/registry.py
src/transports/__init__.py
src/transports/http.py
src/transports/stdio.py
tests/__init__.py
tests/conftest.py
tests/test_registries.py
tests/test_server.py
tests/test_tools.pyComposes with
- Pairs with
agentic-loop - Pairs with
eval-harness - Nests inside
monorepo