/** * Bourdon L6 — MCP server (faithful port of `core/l6_server.py`). * * Wraps `@getbourdon/federation`'s `L6Store` in an `@modelcontextprotocol/sdk` * `McpServer` so any MCP-aware agent (Claude Code, Codex, Cursor) can query the * federation natively. Registers the SAME tools + 3 resources as the Python * server, with byte-identical names, arg names, and defaults (the public/team * `access_level` split is reproduced exactly). * * WIRE ENCODING — the single highest-risk port detail: every tool handler * returns `{ content: [{ type: "text", text: JSON.stringify(payload) }] }`, NOT * the SDK's default structured content. The Python `RemoteL6Client` (and * `@getbourdon/client`) recover the payload with `json.loads(item.text)` / * `JSON.parse(text)`. Returning structured content instead makes a Python peer's * `json.loads(item.text)` get `None` and silently breaks mixed-language * federation. Each tool closure builds a plain object; `jsonContent` stringifies * it onto the wire. * * Caller identity arrives via the AsyncLocalStorage binding (`getCaller()` from * `@getbourdon/federation`): the HTTP auth middleware binds the resolved * identity for the request subtree; stdio has no binding and resolves to * OPERATOR (trusted) — exactly v0.8.0 behavior. Quarantined callers get an * allowlisted read surface (granted namespaces) and STAGED writes; every call is * audited, allow and deny alike. */ import { FederationAudit, FederationRegistry, L6Store } from "@getbourdon/federation"; import { type SkillSource } from "@getbourdon/participants"; import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; export interface CreateL6ServerOptions { name?: string; registry?: FederationRegistry; audit?: FederationAudit; /** * Explicit canonical HTTPS MCP resource for caller descriptions (Python's * `caller_audience`). Must match the enrolled library identity. Left unset, * `describe_caller` reports `not_configured` rather than guessing. */ callerAudience?: string | null; /** * `agentId -> SkillSource[] | null`: where an agent's skill reader looks, * used by `propose_skill` to find the folder an advertised skill was read * from. Defaults to the built-in readers' directories * (`skillSourcesForAgent` in `@getbourdon/participants`). */ skillSources?: (agentId: string) => readonly SkillSource[] | null; } /** * Sent in the MCP `initialize` response, byte-identical to the oracle's * `SERVER_INSTRUCTIONS` (pinned in conformance `mcp_server_meta.json`). Hosts * that surface server instructions to the model get a standing reason to call * `compile_turn`, and to reach for the shared skills on a how-to task. */ export declare const SERVER_INSTRUCTIONS: string; export declare function createL6Server(store: L6Store, options?: CreateL6ServerOptions): McpServer;