/** * MCP server instance for astramemory-local. * * Canonical tool-name SoT: contracts/manifests/mcp-tools.v1.json (U5, * astragenie/memory#671, astragenie/astramem-local#120) — cross-repo * cross-check lives in tests/contracts/mcp-tool-manifest-parity.test.ts. The * list below is a human-readable summary kept in sync by that test, not a * second SoT. * * Exposes the following tools over the Streamable HTTP transport (POST /mcp). * The count is not restated here — it drifts the moment a tool is added and * nothing catches it. The actual count is enforced by two tests that read it * from the wire, not from a maintained number: * - tests/mcp/server.test.ts (compares tools/list against this file's own * cross-repo manifest, contracts/manifests/mcp-tools.v1.json) * - tests/contracts/mcp-tool-manifest-parity.test.ts (full name-level * parity between that manifest and tools/list) * - search_memory — hybrid FTS + vector search * - recall_memory — top-K semantic recall (alias of search with k default 15) * - remember — direct memory insert * - get_health — daemon health probe * - why_memory — provenance receipt (evidence, session, transcript ref) * - session_digest — per-session "what I learned" summary (derived at read time) * - agent_profile — per-agent "what has this agent learned" summary (derived at read time) * - user_profile — daemon-wide "what does this owner keep coming back to" summary (FEAT-451, derived at read time) * - get_entity_related — FEAT-481 SLICE-3: entity-to-entity relations (subject/object/both, bitemporal as_of), field-for-field parity with cloud's EntityTools.cs * - get_entity_timeline — FEAT-481 SLICE-3: memories mentioning an entity, newest-first, optional since (epoch-ms) lower bound * - invalidate_memory — lifecycle: mark a memory invalid (ADR-002 memory_events log) * - supersede_memory — lifecycle: replace one memory with another * - promote_memory — lifecycle: upward-only scope promotion (ADR-009) * - restore_memory — lifecycle: un-archive a memory archived by the W4.4 TTL policy (FEAT-416) * - memory_history — lifecycle: full event log for a memory (supersession chain) * - submit_feedback — ADR-010 explicit recall-used signal for a served memory (U5 canonical name) * - mark_memory_used — DEPRECATED one-release alias for submit_feedback (U5 collapse), same handler * - erase_memory — erasure v1 (ADR-006): hard-delete + tombstone * - list_consolidation_proposals / resolve_consolidation_proposal — stage-9 propose-only queue * (ADR-004): 'merge' near-duplicates and FEAT-456 judge-flagged 'contradiction' pairs, both * resolved identically (accept = merge-as-supersede, reject = no-op) * * FEAT-442 (autonomous consolidation auto-accept + reversal primitive) ships * REST-only this slice: `POST /memory/:id/unsupersede` * (src/server/routes/lifecycle.ts). No MCP tool is added here — this * manifest is a parity-CI-gated SoT (see header above), so a new tool name * is a bigger-than-trivial change; mirroring `unsupersede` to MCP is a * follow-up, not dropped scope. * * No HTTP self-calls: all tools call the internal service layer directly. * Auth is enforced at the Fastify route level via the existing preHandler. */ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { DB } from '../storage/db.js'; import type { EmbedProvider } from '../contracts/index.js'; import { type Config } from '../config/config.js'; export interface McpServerDeps { db: DB; embed: EmbedProvider; config?: Config; } /** * Build and return a configured McpServer instance. * Caller is responsible for connecting it to a transport. */ export declare function buildMcpServer(deps: McpServerDeps): McpServer;