Open
Description
I am building the MCP server application to connect some services to LLM .
One of things i want to implement is authorisation of a user with the token.
I see it must be possible somehow. Because MCP inspector has the Authentification and Bearer Token field
Most of tutorials about MCP are related to STDIO kind of a server run. My will be SSE.
There is my code:
from mcp.server.fastmcp import FastMCP
from fastapi import FastAPI, Request, Depends, HTTPException
app = FastAPI()
mcp = FastMCP("SMB Share Server")
@mcp.tool()
def create_folder(parent_path: str, name: str) -> str:
"""Create new subfolder in the specified path"""
return f"Folder {name} created in {parent_path}"
app.mount("/", mcp.sse_app())
How can i read Authorization header in case if it is sent by the client?
I tried to use approaches of FastAPI - setting dependency, adding request:Request to arguments but this doesn't work.
Is there a way?
Metadata
Metadata
Assignees
Labels
No labels