API and MCP Integration

MemorySmith exposes both REST APIs and an MCP endpoint so local automation and AI tools can use the same data and service layer as the UI.

Integration Flow

Mermaid diagram 1

[!NOTE] Screenshot placeholder [FEAT-API-01]: API route explorer view showing major /api/* surfaces.

What It Does

Why It Matters

This feature makes MemorySmith usable by scripts, local tools, and AI agents without creating a separate backend product.

Key Capabilities

Search Contract

MemorySmith search APIs and MCP tools accept plain text plus explicit filters. They do not expose a full Lucene query-parser language.

Structured Search Output

Surface Structured options Notes
POST /api/memories/search* format=envelope, format=json-v2 Returns memorysmith.retrieval-results.v1. Default remains the compatible result array.
GET /api/pages format=json, format=envelope, format=json-v2 Returns memorysmith.page-results.v1 for list/search responses.
memorysmith_search, memorysmith_semantic_search, memorysmith_hybrid_search format=json, format=envelope Both currently return the same structured retrieval envelope.
memorysmith_context_pack format=json Returns memorysmith.context-pack.v1.
memorysmith_unified_search format=json, format=envelope Returns memorysmith.unified-search.v1.

Score contract:

MCP Authorization Contract

Tool family Contract
Memory search, semantic, hybrid, context-pack, and get Requires the caller to satisfy the MemorySmith view policy.
Page search, page get, and unified page results Requires view access and filters by page minimum visibility: Anonymous, Authenticated, or Admin.
Task list and get Requires view access and returns task summaries/full records from the same task service used by /tasks and /api/tasks.
Task create, update, status, comment, and attachment tools Requires edit permission and reuses task-service validation, persistence, and activity-history writes.
Page save and delete Requires edit permission; Admin-only page visibility remains limited to Admin callers.
Source bundle and find-by-source Requires the source-bundle policy because resolved source links may include local file content. These tools are MCP-only, not chat-requested model tools. Editor and Admin callers satisfy this policy; configured API-key requests and auth-disabled local installs also satisfy it. Viewer callers, including the default anonymous Viewer role, do not.

MemorySmith:Mcp:DisabledTools removes named tools from MCP discovery and direct execution; MemorySmith:Mcp:EnabledTools opts in descriptor-level default-off tools. Disabled wins if both lists name the same tool.

For external agents, use memorysmith_context_pack to narrow evidence before calling memorysmith_source_bundle. Treat missing page hits or source entries as a possible permission/filtering outcome, not only as absent content.

For the full search format matrix and concrete examples, use Search and Chat. For the search-engine behavior itself, use Search System.

[!NOTE] Screenshot placeholder [FEAT-API-02]: MCP tool list and endpoint details. [!NOTE] Screenshot placeholder [FEAT-API-03]: /api/health/readiness successful response example. [!NOTE] Screenshot placeholder [FEAT-API-04]: example unified search API response payload.

Screenshot Backlog Template