fix: accept api-key header for Perplexity MCP connector
Some checks are pending
Check Python Version Consistency / Check Python Version (push) Waiting to run
Some checks are pending
Check Python Version Consistency / Check Python Version (push) Waiting to run
This commit is contained in:
parent
34c7b77a9f
commit
9d0f45cdd6
|
|
@ -75,9 +75,10 @@ class ToolRequest(BaseModel):
|
|||
@app.post("/tools/call")
|
||||
async def call_tool(
|
||||
req: ToolRequest,
|
||||
x_mcp_secret: Optional[str] = Header(default=None)
|
||||
x_mcp_secret: Optional[str] = Header(default=None, alias="X-MCP-Secret"),
|
||||
api_key: Optional[str] = Header(default=None, alias="api-key")
|
||||
):
|
||||
_auth_check(x_mcp_secret)
|
||||
_auth_check(x_mcp_secret or api_key)
|
||||
handler = TOOLS.get(req.tool)
|
||||
if not handler:
|
||||
raise HTTPException(status_code=404, detail=f"Unknown tool: {req.tool}")
|
||||
|
|
@ -86,8 +87,11 @@ async def call_tool(
|
|||
|
||||
|
||||
@app.get("/tools")
|
||||
async def list_tools(x_mcp_secret: Optional[str] = Header(default=None)):
|
||||
_auth_check(x_mcp_secret)
|
||||
async def list_tools(
|
||||
x_mcp_secret: Optional[str] = Header(default=None, alias="X-MCP-Secret"),
|
||||
api_key: Optional[str] = Header(default=None, alias="api-key")
|
||||
):
|
||||
_auth_check(x_mcp_secret or api_key)
|
||||
return {"tools": list(TOOLS.keys())}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user