@withpica/mcp-server
Version:
MCP Server for withPICA — enables AI assistants to interact with your withPICA music catalog
78 lines • 3.02 kB
TypeScript
import { ServerConfig } from "./config.js";
export declare class PicaMcpServer {
private server;
private pica;
private toolRegistry;
private resourceRegistry;
private promptRegistry;
private config;
private httpServer?;
private readonly sessionId;
constructor(config: ServerConfig);
/**
* Construct the dual-relay McpAuditLogger.
*
* One callback, two policies:
* - mcp_audit_log (via /api/mcp/audit): write-tool only — preserves
* ADR-154 F5's audit-log shape unchanged.
* - assistant_interactions + mcp_sessions (via
* /api/mcp/internal/log-interaction): EVERY tool call —
* ADR-226 Decision 8.
*
* `logReads: true` is mandatory: the McpAuditLogger short-circuits on
* `risk_level === "safe"` by default, which would block read-tool
* calls from reaching the substrate relay. The mcp_audit_log endpoint
* itself stays write-tool-only via a `risk_level !== "safe"` gate
* inside the callback.
*/
private buildAuditLogger;
/**
* Reinitialize server with new credentials (called after successful auth)
*/
reinitialize(apiKey: string): void;
/**
* Reset the server back to lobby mode (called after sign_out).
* Mirrors reinitialize() but in reverse: clears the PicaClient,
* sets lobbyMode=true, and rebuilds the tool/resource registries so
* the next tools/list call returns only [pica_sign_in, pica_sign_out].
*
* Without this the server would keep advertising the full authenticated
* tool surface after sign_out until the process is restarted, which
* lies about what's actually available — every privileged tool call
* would still fail at the API layer (no PicaClient), but the surface
* itself shouldn't pretend the catalog is reachable.
*/
signOut(): void;
/**
* Set up MCP protocol handlers on the main server instance (for stdio)
*/
private setupHandlers;
/**
* Start the MCP server.
*
* Transport is selected by environment:
* - MCP_TRANSPORT=http → HTTP server on MCP_PORT (default 3100)
* - Otherwise → stdio (default, for Claude Code / Cursor / VS Code)
*/
start(): Promise<void>;
/**
* ADR-226 Phase 6 — fetch the user's vocabulary and append it to the
* SDK Server's static instructions string. Bails silently on lobby
* mode (no apiKey-to-user mapping yet) or any fetch failure (the base
* instructions are still valid; vocabulary is a layer on top, not a
* gate). Runs at most once per server instance.
*/
private injectVocabularyInstructions;
private startStdio;
private startHttp;
/**
* Register protocol handlers on a server instance.
* Used by both the main server (stdio) and per-request servers (HTTP).
*/
private registerHandlers;
/**
* Stop the MCP server
*/
stop(): Promise<void>;
}
//# sourceMappingURL=server.d.ts.map