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:
2026-10-08 08:49:39 -04:00
parent ccb1f708ca
commit 96895996d9
37 changed files with 2498 additions and 55 deletions
+13
View File
@@ -68,6 +68,10 @@ audio. It is not an unconditional byte-for-byte tunnel.
| `GET /api/config` | Connection settings, primary prompt, reasoning/theme/start modes, and feature flags |
| `WS /v1/realtime` | Local realtime proxy to `S2S_PROXY_TARGET` |
| `POST /api/reasoning` | OpenAI-compatible HTTP reasoning; disabled in `PROXY` mode |
| `POST /api/conversations` | MCP-mode phone login and browser-owned conversation creation |
| `DELETE /api/conversations/current` | Release the selected MCP conversation |
| `POST /api/conversations/current/interrupt` | Cancel its matching HTTP reasoning turn |
| `GET /api/mcp/tools` | Discover the selected conversation's authenticated MCP catalog |
| `GET /api/user/phone` | Configured caller profile lookup |
| `GET /api/user/reports` | Configured scheduled report lookup, subject to report-injection controls |
| `GET /api/apipilot/tools` | Tool discovery with optional authorization and cache refresh |
@@ -116,5 +120,14 @@ external-answer path. These HTTP operations supplement the realtime audio path.
New user speech and session teardown cancel pending reasoning. Turn identity
checks reject stale HTTP results and speech callbacks even if cancellation is late.
With MCP enabled, `services/conversations.py` owns bounded server-side caller
credentials. `providers/mcp.py` owns the official SDK transport, while
`services/mcp_tools.py` validates selections and enforces per-turn limits.
`services/mcp_reasoning.py` and `realtime/mcp_proxy.py` share that executor for
HTTP and voice reasoning respectively. The browser stores only its conversation
ID in memory and uses an HttpOnly owner cookie. Legacy public content preloads
are disabled in this mode; the AquaPortal backend remains the authority for
content access. The speech pipeline and its audio protocol are unchanged.
Read [reasoning](reasoning.md), [context injection](context-injection.md), and
[tool calling](tool-calling.md) for the conditions and limitations of each path.