fastmcp-guard 🛡️
Production operations for FastMCP servers: API-key lifecycle management, identity-aware audit logs, and policy controls without changing tool code.
Status
Beta, v0.2. The package is tested for single-server deployments. Memory and SQLite key stores, API-key issue/rotate/revoke flows, per-key/global/per-tool rate limits, audit logs, IP allow/deny rules, and the CLI are implemented. Postgres/Redis backends, distributed rate limiting, and OpenTelemetry export are planned.
Install
pip install fastmcp-guard
Quickstart
from fastmcp import FastMCP
from fastmcp_guard import Guard
mcp = FastMCP("my-server")
guard = Guard(mcp)
key = guard.keys.create(name="alice", scopes=["read:data"])
print(key.token) # show this once and store it safely
@mcp.tool
def get_data(query: str) -> str:
return f"Results for: {query}"
Clients send the key as Authorization: Bearer fmg_sk_....
What it adds to FastMCP
FastMCP already provides strong authentication primitives and middleware. fastmcp-guard focuses on the operational layer around them:
- issue, inspect, rotate, and revoke scoped API keys
- enforce global, per-key, and per-tool limits
- record structured audit events by caller identity
- allow or deny callers by IP address when the transport provides one
- operate those controls through a CLI
Documentation
Local development
Requires Python 3.10+. Install the development extras, then run the repository test suite and static checks defined in pyproject.toml.
pip install -e '.[dev]'
pytest
ruff check .
mypy src
License
MIT
Metadata
Release files for fastmcp-guard 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastmcp_guard-0.2.2.tar.gz | 45.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastmcp_guard-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.3 kB
Release files / fastmcp_guard-0.2.2.tar.gz
| Download URL | fastmcp_guard-0.2.2.tar.gz |
|---|---|
| Size | 45.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f92e17ba7e6c34c0f5a59e00b506f4dcc08f912620191551e4c4b802db98c55
|
|
BLAKE2b-256 checksum How to use checksums |
9e1ba8cd77f486f15be4d4ba623ec4c8d99c3e20352583d977f12c0c084c7cd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / fastmcp_guard-0.2.2-py3-none-any.whl
| Download URL | fastmcp_guard-0.2.2-py3-none-any.whl |
|---|---|
| Size | 28.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2cc29cda0a841bcdedd34e8b14a7c91698990c2c4adf59744639f0cb2993d89e
|
|
BLAKE2b-256 checksum How to use checksums |
78ca1ff184647d04ae73d59f90e20106ff651e48b8e6ea70e3f953cbe97a4924
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency log