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 21
21
}
22
22
```
23
23
"""
24
- from examples .shared .apps .items import app # The FastAPI app
24
+
25
+ from examples .shared .apps .items import app # The FastAPI app
25
26
from examples .shared .setup import setup_logging
26
27
27
28
from fastapi import Depends
34
35
# Scheme for the Authorization header
35
36
token_auth_scheme = HTTPBearer ()
36
37
38
+
37
39
# Create a private endpoint
38
40
@app .get ("/private" )
39
- async def private (token = Depends (token_auth_scheme )):
41
+ async def private (token = Depends (token_auth_scheme )):
40
42
return token .credentials
41
43
44
+
42
45
# Create the MCP server with the token auth scheme
43
46
mcp = FastApiMCP (
44
47
app ,
@@ -49,10 +52,11 @@ async def private(token = Depends(token_auth_scheme)):
49
52
)
50
53
51
54
# Mount the MCP server
52
- mcp .mount ()
55
+ mcp .mount_http ()
56
+ # mcp.mount_sse() # Or use SSE transport instead
53
57
54
58
55
59
if __name__ == "__main__" :
56
60
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