async · ASGI-native · typed · MCP-native
Veloce — Async Python Web Framework¶
One route definition is an HTTP endpoint, an OpenAPI operation and an MCP tool. Routing, typed dependency injection, WebSockets, templating, sessions and a built-in test client — all in one tree, no second service to keep in sync.
Python 3.10+ MIT licensed MCP built in pip install veloceframework
Veloce framework (PyPI: veloceframework) is an ASGI-native, async-first Python web framework for building APIs and full-stack applications. It draws Flask-compatible patterns (g, flash, blueprints, @app.route) and FastAPI-style typed dependency injection together into one tree — without depending on either. Requires Python 3.10+.
from veloce import Veloce
app = Veloce()
@app.get("/hello/{name}")
async def hello(name: str):
return {"hello": name}
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)
Type-annotated path parameters are coerced automatically, dictionaries become JSON responses, and the route is registered on the radix tree at import time.
One flag also serves that handler to an AI agent as an MCP tool:
from veloce import Veloce
app = Veloce()
@app.get("/users/{user_id}", expose_as_mcp_tool=True,
mcp_description="Fetch a user by id")
async def get_user(user_id: int):
return {"id": user_id}
There is no second service and no re-declared schema. An HTTP client calls the
endpoint, an agent calls the tool, and both reach the same handler, the same
dependencies and the same Security() check — because both doors emit from one
route contract instead of a hand-written mirror of it. New here?
Why Veloce Exists explains the one-IR
architecture the rest of the framework follows from.
Why Veloce¶
-
Fast by design
Built on raw
asynciowithorjsonandhttptools. Handler signatures are inspected once at registration — no reflection on the request hot path. -
Radix-tree routing
Path parameters are matched and type-coerced during tree traversal, with built-in
int,float,uuid,path, and custom converters. -
Typed dependency injection
Depends,Security, andSecurityScopesresolve from precompiled plans, includingyield-style dependencies with teardown. -
Batteries included
OpenAPI 3.1, WebSockets, Server-Sent Events, background tasks, middleware, signed sessions, and signals — all in core.
-
Validated, both ways
Pydantic v2 validates request bodies;
response_modelserialises and filters what goes back out. -
Honest tests
The in-memory
TestClientdrives the real ASGI surface — middleware, encoding, and cookies included.