-
Notifications
You must be signed in to change notification settings - Fork 7
feat: Add MCP integration #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,6 +38,7 @@ dependencies = [ | |||||||||
| "dnet-p2p @ file://${PROJECT_ROOT}/lib/dnet-p2p/bindings/py", | ||||||||||
| "rich>=13.0.0", | ||||||||||
| "psutil>=5.9.0", | ||||||||||
| "fastmcp", | ||||||||||
|
||||||||||
| "fastmcp", | |
| "fastmcp==1.0.0", |
Outdated
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fastmcp dependency lacks a version constraint. For reproducible builds and to avoid potential breaking changes, it's recommended to pin or constrain the version (e.g., "fastmcp>=0.1.0,<1.0.0" or "fastmcp==0.x.y").
| "fastmcp", | |
| "fastmcp>=0.1.0,<1.0.0", |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |||
| from .inference import InferenceManager | ||||
| from .model_manager import ModelManager | ||||
| from dnet_p2p import DnetDeviceProperties | ||||
| from .mcp_handler import create_mcp_server | ||||
|
|
||||
|
|
||||
| class HTTPServer: | ||||
|
|
@@ -41,9 +42,22 @@ def __init__( | |||
| self.inference_manager = inference_manager | ||||
| self.model_manager = model_manager | ||||
| self.node_id = node_id | ||||
| self.app = FastAPI() | ||||
| self.http_server: Optional[asyncio.Task] = None | ||||
|
|
||||
| # Create MCP server first to get lifespan | ||||
| mcp = create_mcp_server( | ||||
| inference_manager, model_manager, cluster_manager | ||||
| ) | ||||
| # Use path='/' since we're mounting at /mcp, so final path will be /mcp/ | ||||
| mcp_app = mcp.http_app(path="/") | ||||
|
|
||||
| # Create FastAPI app with MCP lifespan | ||||
| self.app = FastAPI(lifespan=mcp_app.lifespan) | ||||
|
|
||||
| # Mount MCP server as ASGI app | ||||
| self.app.mount("/mcp", mcp_app) | ||||
|
|
||||
|
|
||||
|
||||
Uh oh!
There was an error while loading. Please reload this page.