🔥 Hot Reload Your Python mcp-use Servers!
#727
CNSeniorious000
started this conversation in
Show and tell
Replies: 1 comment
-
|
This is actually very cool, could you contribute this functionality to mcp-use ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that since mcp-use v1.5, mcp-use now provides a
mcp_use.MCPServerimplementation which directly inherits frommcp.server.FastMCP, making it seamlessly supported by mcp-hmr.You can build MCP servers with mcp-use and develop them with hot reload, just like you'd experience with Vite in the frontend world.
mcp-use-inspector-demo.mov
Why This Matters
Traditional reload mechanisms (like
reload=Truefor Uvicorn) restart the entire process—interpreter, all third-party packages, everything. This means:Leading to interruption of the development flow.
mcp-hmr takes a different approach. Using HMR's runtime dependency tracking, it:
Resulting in instant feedback — changes take effect in milliseconds, not seconds
Quick Start
Just install
mcp-hmrlike any other PyPI package:Say you have a file
main.pycontaining your mcp-use server:Then just launch with
mcp-hmrlike how you would withmcp run:That's it! Now connect it with a MCP client and modify your tools, resources, or prompts, save the file, and next call to your server will reflect the changes instantly—without needing to manually restart the server.
How It Works
HMR knows what to reload and what to preserve by runtime tracking of variable-level dependencies.
The result is variable-level granularity—far more precise than traditional file-level reloading. In practice, this means modifying a single function only reruns that function and modules that depend on it, preserving expensive initialization elsewhere in your server.
Normally if your code is organized into modules, changing files often requires rerunning only one or two modules. But even if you write everything in a single file, HMR still cache 3-party imports and preserves them across reloads, so you still get significant speedups.
Learn More
mcp-hmrsupport the official mcp sdk and fastmcp tooHMR is a reactive programming engine and hot-reload framework that brings variable-level fine-grained reactivity to Python. While mcp-hmr focuses on MCP servers, the broader HMR ecosystem also includes:
Try it with your mcp-use servers and give me feedback! Thanks for reading :)
Beta Was this translation helpful? Give feedback.
All reactions