nothingworry's picture
Add RAG MCP Server with Supabase vector search
c16e1c9
raw
history blame
701 Bytes
from fastapi import APIRouter, Header, HTTPException
from api.mcp_clients.web_client import WebClient
router = APIRouter()
web_client = WebClient()
@router.post("/web/search")
async def web_search(
query: str,
x_tenant_id: str = Header(None)
):
"""
Perform a live internet search using the Web MCP server.
"""
if not x_tenant_id:
raise HTTPException(status_code=400, detail="Missing tenant ID")
try:
results = await web_client.search(query)
return {
"tenant_id": x_tenant_id,
"query": query,
"results": results
}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))