TinyMCP
A lightweight MCP router for FastAPI.
Quick Start
from tinymcp import create_mcp_router, mcp_tool
@mcp_tool(description="Get current time")
def get_time() -> str:
from datetime import datetime
return datetime.now().isoformat()
@mcp_tool(description="Get user data with structured output")
def get_user_data():
return {
"content": [{"type": "text", "text": "User data retrieved"}],
"structured": {"user_id": 123, "email": "user@example.com"}
}
# Add to FastAPI
app.include_router(create_mcp_router(name="My App"))
# Custom prefix (default: "/mcp")
app.include_router(create_mcp_router(name="My App", prefix="/my-mcp"))
Quick Demo
Once you have this repo cloned, from root, run the following (install the missing dev dependencies as required)
uv run python docs/sample_server/simple_fastapi_server.py
Note on Authentication
Authentication has been intentionally left out of TinyMCP to keep it... tiny. Any auth that can be setup with FastAPI in general can be setup with this. However, for MCP server to interact with most MCP clients like cursor, several specific configurations, endpoints etc. are required. If you have an existing OAuth mechanism in your FastAPI server, it is quite easy to make it work for the TinyMCP server as well. See oauth_integration_guide.md for a complete setup guide.
Metadata
Release files for tinymcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tinymcp-0.1.1.tar.gz | 6.8 kB | Without provenance | Details for tinymcp-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tinymcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for tinymcp-0.1.1-py3-none-any.whl |
Total release size: 14.5 kB
Release files / tinymcp-0.1.1.tar.gz
| Download URL | tinymcp-0.1.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a1d27f6008683de0a3890cc16a705cd8b51999e4d7a493c2a5874398e57709b
|
|
BLAKE2b-256 checksum How to use checksums |
5c472597f8cd76089a18523e019c1d3877369241beeadbdb8b730375fc6e07f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.3
|
Release files / tinymcp-0.1.1-py3-none-any.whl
| Download URL | tinymcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26caf392ec8d453ad102945ca653967d5802eec7b48b774052c0cccdead116b6
|
|
BLAKE2b-256 checksum How to use checksums |
ba26939523f96e973988f1fcb1a146c519976c945fa6d4560ad06d2796ed7ecb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.3
|
Security for tinymcp 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.