I've been building MCP servers and kept running into the same three problems: one tool call dumps 20k tokens of raw JSON into the context, the model retries a write and does it twice, and nothing stops the model from calling a tool it shouldn't. So I built OunceMCP, a framework on top of FastMCP that makes the careful version the default.
What it does:
- Result budgets. Every result fits a token budget you set and still matches its output schema. Lists are trimmed first, the model gets a note saying what was cut, and pagination cursors move so nothing is skipped or repeated.
- Definition budgets in CI. `ouncemcp check server.py` counts every tool definition the way the host receives it and fails the build when one goes over.
- Search-then-call for big catalogs. Once your tool definitions outgrow the startup budget, the server switches to `search_tools` / `describe_tool` / `call_tool` automatically.
- Safe writes. Every tool declares its effect. Writes can be idempotent (a timed-out write finishes in the background, so a retry gets the result instead of writing twice) and can require a person's approval through the client.
- Security that holds when the model is wrong. Identity comes only from the verified token, one policy decides what each caller can list and call, caches are partitioned by tenant, and outbound fetches refuse private and metadata addresses.
- Works on existing servers. `OunceServer.wrap(my_fastmcp_server)` adds the above without touching your tools, and `ouncemcp audit` measures any MCP server, including ones not built with OunceMCP.
I benchmarked two small example servers against plain FastMCP versions with four models (Claude Haiku 5.5, Claude Sonnet 5.5, GPT-5.4 mini, DeepSeek V4.1 Flash), 840 runs in total:
- On the server with large results, OunceMCP used 58–85% fewer tokens per task.
- On the server with writes, every model on the plain version closed a ticket the user hadn't confirmed and deleted one without permission. OunceMCP refused both every time (100% task success vs 68–70%).
- The honest downside: tool definitions are 1.8–2.4x larger, mostly because of output schemas. On small servers with small results, that means more tokens per task, not fewer. It pays off when results are large.
Full results and caveats: https://github.com/subbusainath/ouncemcp/blob/main/benchmarks/results/m3-bench.md
It's a 1.0 release candidate. The API is frozen, the official MCP conformance suite runs in CI, and an external security review is the last step before 1.0.
```bash
pip install ouncemcp
ouncemcp init notes-server
```
- Docs, including a step-by-step book that builds one server over 15 chapters: https://subbusainath.github.io/ouncemcp/
- GitHub: https://github.com/subbusainath/ouncemcp
Python 3.11+, Apache-2.0. I'd really like feedback, especially from people running MCP servers with large catalogs or multiple tenants: what's missing, what's confusing, and where the defaults get in your way.