Skip to content

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.

Namemcp-server-python
Version0.1.0
Categoryai-systems
LicenseApache-2.0
Personaengineering
Tagsmcp, python, ai, tools, server
Sourcetemplates/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

ToolVersionWhy
python>=3.10Python runtime for the MCP server
pipPackage management and dependency installation

Variables

Required

ProjectName string
Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to An MCP server in Python
Short project description for pyproject.toml and README
Transport string — defaults to stdio
Server transport protocol (stdio or http)
IncludeTests bool — defaults to true
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.py

Composes with