feat(mcp): connect authenticated AquaPortal tools to Vocero (#1)
Vocero needs to query AquaPortal on behalf of the caller selected by the existing phone link. This adds server-owned conversations and MCP tool execution for voice and HTTP reasoning while leaving the speech pipeline unchanged. Release notes: - Added browser-bound conversations that keep backend credentials server-side and isolate callers. - Connected the eight-tool AquaPortal catalog through authenticated Streamable HTTP with full input schemas and structured results. - Added bounded multi-step tool execution with cancellation, expiry, and stale-result protection. - Updated browser bootstrap, tool progress, reasoning headers, and conversation cleanup. - Disabled legacy unscoped content preloads in MCP mode and documented configuration and deployment constraints. - Preserved disabled-mode contracts and added local SDK, WebSocket, and browser regression coverage. Reviewed-on: AquaPortal/s2s#1
This commit is contained in:
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import json
|
||||
|
||||
import httpx
|
||||
from fastapi import HTTPException
|
||||
from fastapi import HTTPException, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from vocero_api.api.responses import validated_json_response
|
||||
@@ -14,6 +14,7 @@ from vocero_api.models.responses import ReasoningResponse
|
||||
from vocero_api.providers import apipilot as providers_apipilot
|
||||
from vocero_api.providers import caller as providers_caller
|
||||
from vocero_api.services import context as services_context
|
||||
from vocero_api.services import mcp_reasoning
|
||||
from vocero_api.services import tool_context as services_tool_context
|
||||
|
||||
|
||||
@@ -31,9 +32,13 @@ def _openai_headers() -> dict[str, str]:
|
||||
return headers
|
||||
|
||||
|
||||
async def reasoning(req: models_requests.ReasoningRequest) -> JSONResponse:
|
||||
async def reasoning(req: models_requests.ReasoningRequest, request: Request) -> JSONResponse:
|
||||
if settings.S2S_REASONING_TYPE == "PROXY":
|
||||
raise HTTPException(status_code=409, detail="El servicio de razonamiento está deshabilitado en el modo PROXY.")
|
||||
if settings.S2S_MCP_URL:
|
||||
if not settings.OPENAI_API_KEY:
|
||||
raise HTTPException(503, "El servicio de razonamiento no está configurado.")
|
||||
return await mcp_reasoning.reply(req, request, _openai_headers())
|
||||
transcript = (req.transcript or "").strip()
|
||||
if not transcript:
|
||||
raise HTTPException(status_code=400, detail="Se requiere el campo transcript.")
|
||||
|
||||
Reference in New Issue
Block a user