UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

30 lines • 1.68 kB
import type { ApplicationService } from '@adonisjs/core/types'; /** * Wires the agent's {@link ToolRegistry} to the outside world over the Model Context Protocol * (Streamable HTTP). Reads `config/mcp.ts` and mounts: * * - `POST|GET|DELETE {path}` — the MCP endpoint (initialize/session resume, SSE stream, close). * - `GET /.well-known/oauth-protected-resource{path}` — RFC 9728 protected-resource metadata, mounted * only when `auth.oauth` is set, so MCP clients can discover how to authenticate. * * …once for the top-level config and once per entry of `endpoints`: each is a protected resource of * its own, with its registry, auth, sessions and metadata. * * A refused request answers `401` (or `403` for an {@link McpAuthError} with that status) with a * `WWW-Authenticate: Bearer …` challenge; with OAuth it carries `resource_metadata`, which is what makes * an MCP client discover the authorization server and open the login. URLs are built from * `config.publicUrl` when set, else from the request's protocol and `Host`. * * Every request is authenticated: the bearer token is verified via `config.auth` (e.g. `authKitAuth()`), * the resolved actor attached to the transport's `AuthInfo`, and `tools/list` / `tools/call` run against * the SAME `ToolRegistry` singleton the agent loop uses — so a role-checked tool stays role-checked, and * a fail-closed gate stays fail-closed, no matter the surface. */ export default class McpProvider { #private; protected app: ApplicationService; constructor(app: ApplicationService); boot(): Promise<void>; shutdown(): Promise<void>; } //# sourceMappingURL=mcp_provider.d.ts.map