Skip to content

MCP Server

The SessionFS MCP server gives AI coding agents access to your session history and project knowledge base during conversations. Agents can search past sessions, read project context, and contribute knowledge back — building a shared memory that persists across tools and teammates.

Transports: stdio for local use (agent launches sfs mcp serve as a subprocess) and HTTP/SSE for remote use (cloud-hosted agents like claude.ai).

Run sfs mcp install --for <tool> to register the MCP server with your AI tool. This registers the server in the tool’s MCP configuration and injects knowledge-contribution instructions into the tool’s project config file (e.g., CLAUDE.md, .cursorrules).

Supported tools:

Terminal window
sfs mcp install --for claude-code # ~/.claude.json
sfs mcp install --for cursor # ~/.cursor/mcp.json
sfs mcp install --for codex # via codex mcp add
sfs mcp install --for gemini # via gemini mcp add
sfs mcp install --for copilot # ~/.copilot/config.json
sfs mcp install --for amp # ~/.amp/config.json
sfs mcp install --for cline # VS Code globalStorage
sfs mcp install --for roo-code # VS Code globalStorage

To skip the instruction injection (server registration only):

Terminal window
sfs mcp install --for claude-code --skip-instructions

The MCP server exposes 22 tools in four categories.

Search past AI coding sessions by keyword, error message, or file path.

ParameterTypeRequiredDescription
querystringyesKeywords, error messages, or file paths to search for
tool_filterstringnoFilter by source tool (claude-code, codex, gemini, cursor, copilot, amp, cline, roo-code)
max_resultsnumbernoMaximum results to return (default: 5)

Retrieve the full conversation from a specific session. Use after search_sessions finds a relevant hit.

ParameterTypeRequiredDescription
session_idstringyesSession ID in ses_... format
max_messagesnumbernoLimit messages returned (default: 50)
summary_onlybooleannoReturn metadata only, no messages (default: false)

List recent sessions with optional filtering.

ParameterTypeRequiredDescription
limitnumbernoMax sessions to return (default: 10)
tool_filterstringnoFilter by source tool
project_filterstringnoFilter by project/workspace path substring

Find sessions that touched a specific file or encountered a similar error. Provide file_path or error_text (at least one).

ParameterTypeRequiredDescription
file_pathstringnoFind sessions that modified this file
error_textstringnoFind sessions with similar errors
limitnumbernoMax results (default: 5)

Get a structured summary — files modified, commands run, tests executed, errors encountered, packages installed.

ParameterTypeRequiredDescription
session_idstringyesSession ID in ses_... format

Get the LLM Judge trust audit — verifiable claims, verdicts (verified/unverified/hallucination), confidence scores, CWE mappings.

ParameterTypeRequiredDescription
session_idstringyesSession ID in ses_... format

Return the instruction provenance recorded for a session — what rules and artifacts shaped the agent at capture time. Returns rules_version, rules_hash, rules_source (sessionfs / manual / mixed / none), and the instruction_artifacts list.

ParameterTypeRequiredDescription
session_idstringyesSession ID in ses_... format

Get the shared project context document — architecture decisions, conventions, wiki pages, and recent knowledge entries. Call early in a session to understand the project. Use get_context_section or get_wiki_page instead when you only need one slice — they return less and cost less.

ParameterTypeRequiredDescription
git_remotestringnoGit remote URL (auto-detected from working directory if omitted)

Return one section of the project context document by slug instead of the full document. If the slug is not found, the response lists the available slugs so you can retry.

ParameterTypeRequiredDescription
slugstringyesSection slug (lowercase, non-alphanumeric collapsed to _)
git_remotestringnoGit remote URL (auto-detected if omitted)

Read one wiki page’s full content plus backlinks. Cheaper than get_project_context when you already know the page slug.

ParameterTypeRequiredDescription
slugstringyesWiki page slug (e.g., architecture)
git_remotestringnoGit remote URL (auto-detected if omitted)

Search across knowledge entries and wiki pages by keyword. Use this when you have a query string. Use list_knowledge_entries instead when you want a filtered list with no query.

ParameterTypeRequiredDescription
querystringyesWhat to search for
entry_typestringnoFilter by type: decision, pattern, discovery, convention, bug, dependency
limitnumbernoMaximum results (default: 10)

Filtered list of knowledge entries with pagination. Useful when you want to browse by type, claim class, freshness, or origin session without a search query.

ParameterTypeRequiredDescription
entry_typestringnoOne of decision, pattern, discovery, convention, bug, dependency
claim_classstringnoevidence, claim, or note
freshness_classstringnocurrent, aging, stale, or superseded
dismissedbooleannoInclude dismissed entries (default: false)
session_idstringnoOnly entries linked to this session
sortstringnocreated_at_desc (default), last_relevant_at_desc, confidence_desc
pagenumberno1-based page number (default: 1)
limitnumbernoPage size, max 200 (default: 50)

Return one knowledge entry’s full record, including last_relevant_at for stale review.

ParameterTypeRequiredDescription
idnumberyesKnowledge entry ID

One call for the dashboard banner data — pending, compiled, dismissed, and total counts; stale and low-confidence counts; word count for the compiled context; recommended next actions.

No parameters required.

Ask a question about the project. Gathers project context, searches the knowledge base, and finds related local sessions to assemble research material.

ParameterTypeRequiredDescription
questionstringyesA question about the project

Add a knowledge entry to the project knowledge base. Use when you discover patterns, decisions, conventions, bugs, or dependencies.

ParameterTypeRequiredDescription
contentstringyesThe knowledge entry text
entry_typestringyesOne of: decision, pattern, discovery, convention, bug, dependency
session_idstringnoLink this entry to a specific session
confidencenumbernoConfidence score 0.0—1.0 (default: 1.0)

Create or update a wiki page in the project knowledge base. Use for longer-form documentation of architecture, conventions, or concepts.

ParameterTypeRequiredDescription
slugstringyesURL-safe page identifier (e.g., architecture)
contentstringyesFull page content in markdown
titlestringnoPage title (derived from slug if omitted)

List all wiki pages for the project. Returns page slugs, titles, word counts, and entry counts. No parameters required.

Trigger a compile pass on the project’s knowledge base. Promotes pending entries, refreshes section pages and concept pages, and rebuilds the compiled context document. Returns a structured result: entries_compiled, context_words_before, context_words_after, section_pages_updated, concept_pages_updated, compiled_at.

No parameters required.

Dismiss a knowledge entry that is stale, wrong, or no longer relevant. Idempotent — calling twice is a safe no-op. Writes a full audit triple (dismissed_at, dismissed_by, dismissed_reason) and the underlying PUT /entries/{id} is row-locked with SELECT FOR UPDATE so concurrent dismissals can’t tear the audit record.

ParameterTypeRequiredDescription
idnumberyesKnowledge entry ID
reasonstringyesShort justification (e.g., "superseded by entry 412" or "wrong file path")

Returns the canonical project rules record plus compilation config for the current repo (static preferences, enabled tools, knowledge / context injection settings, tool overrides). Agents cannot modify rules through MCP — changes must go through sfs rules edit or the dashboard.

ParameterTypeRequiredDescription
git_remotestringnoOverride auto-detected git remote

Returns the compiled rule text for a requested tool, or for the current tool if safely inferable. Useful when an agent needs to understand what behavior contract was materialized for its tool.

ParameterTypeRequiredDescription
toolstringnoTool slug: claude-code, codex, cursor, copilot, gemini
git_remotestringnoOverride auto-detected git remote

When sfs mcp install runs, it injects a MANDATORY instructions block into the tool’s project config file (e.g., CLAUDE.md, .cursorrules). These instructions tell the agent it must call add_knowledge() when discovering architecture decisions, code patterns, bugs, dependencies, or conventions — and must not end a session without contributing if it learned something new.

This creates a knowledge loop: each session reads project context at the start and writes back discoveries at the end. Tools that support project-level instructions: Claude Code (CLAUDE.md), Codex (codex.md), Gemini (GEMINI.md), Cursor (.cursorrules). For other tools, instructions are served at runtime via get_project_context.

For cloud-hosted agents (e.g., claude.ai) that cannot launch local processes, SessionFS supports HTTP/SSE transport with OAuth authentication. The remote server is deployed alongside the SessionFS API — agents connect via the SSE endpoint and authenticate using the same API key from sfs auth login. No separate service required.

VariableDescription
SFS_API_URLSessionFS cloud API URL (for knowledge tools)
SFS_API_KEYAPI key for cloud authentication
Terminal window
sfs mcp serve

Runs the MCP server on stdio transport. Connect from any MCP-compatible client.

Rebuild the search index:

Terminal window
sfs mcp index

Re-indexes all local sessions into the full-text search database.

Uninstall:

Terminal window
sfs mcp uninstall --for claude-code

Removes the MCP server registration and cleans up injected knowledge instructions from the project config file. Supported tools are the same as for install.