One route, three surfaces
Write the handler once, then opt it into MCP tools or CLI actions when agents should use it directly.
A Python backend framework for the agent era.
Quater starts from a simple belief: AI agents need a better interface to software than screens meant for humans. The answer is not to bypass your backend. The answer is to expose the right backend views directly, with clear inputs and real safety boundaries.
This site documents Quater's current 0.x API. If you are evaluating the framework, start with the Quickstart, then read the Manual to understand how HTTP, MCP, and CLI access fit together.
Prerequisites: Python 3.11 or newer, async Python basics, and enough HTTP knowledge to read request and response examples.
from quater import AuthConfig, AuthContext, Quater, Request
async def authenticate(request: Request) -> AuthContext | None:
if request.headers.get("authorization") != "Bearer demo-token":
return None
return AuthContext(subject="demo-user")
app = Quater(auth=[AuthConfig(authenticate, surfaces=["api", "mcp", "cli"])])
@app.get(
"/orders/{order_id}",
tool=True,
cli=True,
description="Fetch one order by id.",
)
async def get_order(order_id: str, request: Request) -> dict[str, object]:
assert request.auth is not None
return {
"order_id": order_id,
"subject": request.auth.subject,
"source": request.context.source,
}Run it:
python -m pip install quater
quater dev main.pyIf you use uv, install with uv add quater instead.
Expected server output:
[INFO] Starting granian
[INFO] Listening at: http://127.0.0.1:8000curl -H "Authorization: Bearer demo-token" \
http://127.0.0.1:8000/orders/ord_1001curl http://127.0.0.1:8000/mcp \
-H "Authorization: Bearer demo-token" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_order","arguments":{"order_id":"ord_1001"}}}'export QUATER_APP=main:app
export QUATER_TOKEN=demo-token
quater call get_order --order-id ord_1001All three calls reach the same handler. The source value tells you which surface called it: api, cli, or mcp.