File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 2121}
2222```
2323"""
24- from examples .shared .apps .items import app # The FastAPI app
24+
25+ from examples .shared .apps .items import app # The FastAPI app
2526from examples .shared .setup import setup_logging
2627
2728from fastapi import Depends
3435# Scheme for the Authorization header
3536token_auth_scheme = HTTPBearer ()
3637
38+
3739# Create a private endpoint
3840@app .get ("/private" )
39- async def private (token = Depends (token_auth_scheme )):
41+ async def private (token = Depends (token_auth_scheme )):
4042 return token .credentials
4143
44+
4245# Create the MCP server with the token auth scheme
4346mcp = FastApiMCP (
4447 app ,
@@ -49,10 +52,11 @@ async def private(token = Depends(token_auth_scheme)):
4952)
5053
5154# Mount the MCP server
52- mcp .mount ()
55+ mcp .mount_http ()
56+ # mcp.mount_sse() # Or use SSE transport instead
5357
5458
5559if __name__ == "__main__" :
5660 import uvicorn
57-
58- uvicorn .run (app , host = "0.0.0.0" , port = 8000 )
61+
62+ uvicorn .run (app , host = "0.0.0.0" , port = 8000 )
You can’t perform that action at this time.
0 commit comments