Turn any Python codebase into a production-grade MCP server with zero friction.
Project description
Smarter-MCP 🚀
The highest-level Python framework for building, generating, and running MCP servers.
If Python can call it, Smarter-MCP can serve it.
pip install smarter-mcp
Smarter-MCP sits on top of FastMCP and acts as the orchestration layer that handles everything a developer shouldn't have to think about:
Three ways in, one runtime
1. Existing code — zero rewrites
Point at any module you already have (or anything on PyPI):
import pandas as pd
from smarter_mcp import SmarterMCP
app = SmarterMCP("data-tools")
app.discover_module(pd.DataFrame, include=["describe", "head", "tail"])
app.run()
Or scan an entire local codebase from the CLI:
smarter-mcp serve ./src/mylib
The dual-pass engine (AST + inspect) reads your signatures, builds JSON schemas, and serves them. Nothing to rewrite.
2. Stateful class tools
When your tools need shared state (a DB connection, an API client, an ML model loaded once), @toolkit manages it:
from smarter_mcp import tool, toolkit
@toolkit(lifecycle="session")
class DatabaseClient:
def __init__(self, host: str = "localhost", port: int = 5432):
self.conn = connect(host, port)
@tool(name="run_query")
def query(self, sql: str) -> list[dict]:
"""Execute a SQL query and return results."""
return self.conn.execute(sql).fetchall()
One instance per session. Constructor args injected from config. Cleaned up on session end. You write the class, Smarter-MCP handles the plumbing.
3. ✍️ Fresh tools from scratch
from smarter_mcp import SmarterMCP, tool, resource
app = SmarterMCP("my-server")
@tool("Greet a user by name")
def greet(name: str) -> str:
return f"Hello, {name}!"
@resource("config://settings")
def get_settings() -> dict:
return {"debug": True, "version": "1.0"}
app.run()
⚙️ What the runtime gives every tool
Regardless of how a tool was registered, every call goes through:
- ✅ Schema validation — parameters validated before your function is called. Clean errors back to the agent, not raw tracebacks.
Type coercion — agents send
"42"instead of42constantly. Handled silently. - ✅ Schema validation — parameters validated before your function is called. Clean errors back to the agent, not raw tracebacks.
- ✅ Schema validation — parameters validated before your function is called. Clean errors back to the agent, not raw tracebacks.
- ✅ Multimodal —
PIL.Imageandnp.ndarrayparameters decoded fromImageContentautomatically. Return images and they're wrapped back up. - ✅ Instance lifecycle —
session,singleton, orper-call. Resolved and bound per request. - ✅ Namespace routing — auto-derived from module paths. No silent name collisions.
- ✅ Auth + rate limiting — API key middleware and sliding-window rate limits, config-driven.
✨ AI-generated tool descriptions
Most Python code in the wild has no docstrings. That's fine.
Point Smarter-MCP at an undocumented library and it will write the tool descriptions for you using Claude, GPT, or any OpenAI-compatible model. Every tool your agent sees gets a clean, accurate description regardless of what the original code looked like.
llm:
provider: anthropic # or openai, openrouter
model: claude-3-5-haiku
cache: true
or in code:
server = SmarterMCP(
"my-server",
llm_enabled=True,
llm_provider="anthropic",
llm_model="claude-3-5-haiku",
)
server.run()
Undocumented code stops being a blocker.
📋 YAML manifest — no Python required
name: my-server
version: 0.1.0
server:
host: 0.0.0.0
port: 8000
transport: sse
sources:
- path: ./src/my_local_utils
- module: random
include: [choices, randint]
namespace: random_tools
expose:
private: false
unannotated: warn
smarter-mcp serve --manifest smarter-mcp.yaml
🚀 Getting started
pip install smarter-mcp
For multimodal support (PIL / numpy):
pip install "smarter-mcp[multimodal]"
Then point it at your code:
smarter-mcp serve ./src/mylib --port 8000
smarter-mcp validate ./my_tools.py
smarter-mcp test ./my_tools.py
Built on FastMCP.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smarter_mcp-0.1.1.tar.gz.
File metadata
- Download URL: smarter_mcp-0.1.1.tar.gz
- Upload date:
- Size: 214.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e2ef73b5e9f81f7c0d5423702d7300ac628d9e222d92d95018e6cfea6f72d86
|
|
| MD5 |
05e7f32ed9418b9a7524ce33ebfdc7fb
|
|
| BLAKE2b-256 |
31a08d1f61950929a81f4839f400d44cefb844fa4c69380378b9554201d7dadd
|
File details
Details for the file smarter_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: smarter_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 73.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f1aea0853182850d802616b8da5935b536553904d12dd6e9ff03ad39bcb62b7
|
|
| MD5 |
3bfe598fdfad0fcfc123c3e65a3dcb83
|
|
| BLAKE2b-256 |
94b36bfdbaf57e19311c76a7b17b304c238e8f09eaaf5e482a1099328390506c
|