Skip to main content

Framework for building authenticated, scoped, observable MCP servers on top of FastMCP. Tool registry, scoped bearer tokens, Prometheus + OTLP metrics, Grafana dashboards from code, multi-tenancy. `pip install fastmcp-kit` then `from mcp_toolkit import MCPToolkit`.

Project description

fastmcp-kit

CI Security PyPI Python License: MIT

0.1.0 live on PyPI. pip install fastmcp-kit then from mcp_toolkit import MCPToolkit. The distribution name (fastmcp-kit) and the Python module name (mcp_toolkit) differ — same pattern as pip install pyyamlimport yaml. PyPI's similarity rules rejected the shorter name.

A Python framework for building authenticated, scoped, observable MCP (Model Context Protocol) servers on top of FastMCP.

You bring the tools. fastmcp-kit brings:

  • Tool registry — register tools with @toolkit.tool(...), group them, version them.
  • Scoped auth — bearer tokens carry scopes; list_tools is filtered per caller. Tokens never see tools they can't call.
  • One-click observability — Prometheus metrics auto-registered per tool, Grafana dashboards generated from the registry, docker compose up brings the whole stack live.
  • Multi-tenancy — pluggable tenant resolvers (header / subdomain / token-claim). Per-tenant metric labels enforced at registration.
  • Battle-tested harness — Clara architecture, mypy-strict, 80% coverage gate, bandit + pip-audit + gitleaks + CodeQL, branch protection, PR-from-fork model.

Quick taste

from mcp_toolkit import MCPToolkit

toolkit = MCPToolkit(name="my-server")

@toolkit.tool(group="weather", scopes=["read:weather"])
async def get_weather(city: str) -> dict:
    return {"city": city, "temp_c": 21.0}

@toolkit.tool(group="admin", scopes=["admin"])
async def reset_cache() -> None:
    ...

app = toolkit.build_app()  # FastAPI / FastMCP app; uvicorn-ready

Tokens minted with scopes=["read:weather"] discover and call get_weather. They cannot see reset_cache exists.

Why not just FastMCP?

FastMCP gives you the MCP wire protocol and transports. fastmcp-kit gives you the production layer above it: auth-scoped discovery, metric-per-tool, dashboards-from-code, multitenancy. You can use both — fastmcp-kit wraps FastMCP under the hood.

Install

PyPI

# Just the framework
uv add fastmcp-kit

# With observability batteries (Prometheus exposition + Grafana JSON gen)
uv add 'fastmcp-kit[observability]'

# Everything
uv add 'fastmcp-kit[observability,redis,otel]'

Import name stays mcp_toolkit:

from mcp_toolkit import MCPToolkit

One-click stack

make stack-up      # Prometheus + Grafana + your server, dashboards provisioned
open http://localhost:3000  # Grafana, dashboards already populated

See deploy/observability-stack/README.md.

Deploy

Three deployment surfaces ship in this repo:

Target Manifest When
Knative deploy/knative-serving.yaml You already run Knative Serving.
Vanilla k8s (Helm) deploy/helm/mcp-toolkit/ You run k8s without Knative.
Local dev deploy/observability-stack/ docker compose, Prometheus + Grafana included.

Documentation

Topic Where
AI navigation primer CLAUDE.md
10,000 ft architecture ARCHITECTURE.md
Tool registration src/mcp_toolkit/domains/registry/DOMAIN.md
Auth + scopes src/mcp_toolkit/domains/auth/DOMAIN.md
Metrics + dashboards src/mcp_toolkit/domains/observability/DOMAIN.md
Multi-tenancy src/mcp_toolkit/domains/tenancy/DOMAIN.md
Roadmap docs/ROADMAP.md
Contributing CONTRIBUTING.md
Security policy SECURITY.md

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastmcp_kit-0.1.1.tar.gz (189.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastmcp_kit-0.1.1-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

Details for the file fastmcp_kit-0.1.1.tar.gz.

File metadata

  • Download URL: fastmcp_kit-0.1.1.tar.gz
  • Upload date:
  • Size: 189.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.18

File hashes

Hashes for fastmcp_kit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d426a39ece8541a37d72f75e6dbde0b0a061e8fb1102d3674600d6579d4087b8
MD5 12fcce1632fb266594096f0cdbd53952
BLAKE2b-256 a6c0514d0f8706aa82e43d95938be3dbc2ce9623a6c8e311c7e6d93b0068beb4

See more details on using hashes here.

File details

Details for the file fastmcp_kit-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastmcp_kit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 540bc6e7d25609c6fdc75d2c1c6e459e2147ef900d712c4b54e1904b2bca2e7d
MD5 a122792b10c293fea0fc8694655dd2b3
BLAKE2b-256 42789577c1f193f6d4601af80f10ab4ef41ebf043d3cd85f3ca230173f75d424

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page