Open
Description
I am getting the below error while calling the below server from my tool kit , how can i handle the post requests here from the toolkit server .
"POST /mcp HTTP/1.1" 405 Method Not Allowed
"cause": "unhandled errors in a TaskGroup (1 sub-exception)"
import uvicorn
import logging
from fastapi import FastAPI, Request
from fastapi import FastAPI
from fastapi_mcp import FastApiMCP
logger = logging.getLogger("mcp")
logger.setLevel(logging.DEBUG)
# Initialize FastAPI app
app = FastAPI()
# Initialize MCP server
# Mount the MCP server to your FastAPI app
## sample endpoints( this will call to the kubernetes api endpoints to get the details ).
@app.get("/get_namespace/", operation_id="get_namespace_info")
async def get_namespace():
"""
Fetch namespace details.
This endpoint returns a simple message along with namespace details.
"""
return {
"message": "Hello, Hanger!",
"namespace_details": ["namespace_x", "namespace_y", "namespace_z"],
}
# But if you re-run the setup, the new endpoints will now be exposed.
# mcp.setup_server()
if __name__ == "__main__":
mcp = FastApiMCP(app,include_operations=["get_namespace_info"],)
mcp.mount()
uvicorn.run(app, host="0.0.0.0", port=8080)
Metadata
Metadata
Assignees
Labels
No labels