Replies: 1 comment
-
Hi @wuhaiyi , |
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.
-
Hi all,
I’m currently trying to register a simple tool using fastapi-mcp with FastAPI. My endpoint looks like this:
from fastapi import FastAPI
from pydantic import BaseModel
from fastapi_mcp import FastApiMCP
app = FastAPI()
class DummyInput(BaseModel):
dummy: str = "hi"
@app.post("/test", operation_id="test_endpoint")
async def test_endpoint(input: DummyInput):
return {"message": f"Success: {input.dummy}"}
mcp = FastApiMCP(app, name="Test MCP", base_url="http://localhost:8000")
mcp.mount()
Then: curl -N -H "Accept: text/event-stream" http://localhost:8000/mcp
I only get:
event: endpoint
data: /mcp/messages/?session_id=...
But I expected to see /test registered as a tool.
I’ve verified:
• The endpoint uses POST and has a valid operation_id
• The input model is a BaseModel with valid fields
• mcp.mount() is called after all routes are registered
• mcp.to_openai_tool_spec() returns an empty list ([])
❓ Question
Is there anything I might be missing to get the tool properly registered and showing up in /mcp?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions