# agent-knowledge MCP server

> Provides cross-session memory and semantic search for AI coding assistants using a git-synced knowledge graph.

- Repository: https://github.com/keshrath/agent-knowledge
- Page: https://hostedmcp.org/servers/keshrath/agent-knowledge
- Transport: stdio
- Stars: 19
- License: MIT
- Latest version: 3.0.0

## Install

### Claude Code

```sh
claude mcp add agent-knowledge -- npx -y agent-knowledge
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "agent-knowledge": {
      "command": "npx",
      "args": [
        "-y",
        "agent-knowledge"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "agent-knowledge": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "agent-knowledge"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"agent-knowledge","type":"stdio","command":"npx","args":["-y","agent-knowledge"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "agent-knowledge": {
      "command": "npx",
      "args": [
        "-y",
        "agent-knowledge"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add agent-knowledge -- npx -y agent-knowledge
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.agent-knowledge]
command = "npx"
args = ["-y", "agent-knowledge"]
```

### Gemini CLI

```sh
gemini mcp add -s user agent-knowledge npx -- -y agent-knowledge
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "agent-knowledge": {
      "command": "npx",
      "args": [
        "-y",
        "agent-knowledge"
      ]
    }
  }
}
```

## Tools (6)

- `knowledge`: Knowledge base CRUD, sync, and session-start hydration. Actions: "list" (browse entries), "read" (get entry content), "write" (create/update entry, auto git sync), "delete" (remove entry, auto git sync), "sync" (manual git pull + push), "wakeup" (return token-budgeted section-priority context bundle — identity, active_tasks, recent_decisions, known_gotchas, last_session_summary, top_weighted, semantic_fallback — call once at session start).
- `knowledge_search`: Search across sessions AND knowledge entries. Returns `{mode, sessions, knowledge}`. General mode (no `scope`): hybrid TF-IDF + semantic over both sources, with optional MMR diversity and category boost. Scoped mode (`scope` set): sessions-only filtered recall for a specific domain (errors, plans, configs, tools, files, decisions).
- `knowledge_session`: Session operations: list sessions, get a full conversation, or get a summary. Use action "list" to browse sessions, "get" to retrieve messages, "summary" for a quick overview.
- `knowledge_admin`: Admin operations: view vector store stats, view/update configuration, rebuild embeddings, prune orphan session embeddings, or VACUUM the database. Use action "status" for index stats, "config" to view or update settings, "rebuild_embeddings" to re-embed all knowledge entries (useful when switching providers), "prune_orphans" to delete embeddings for sessions no longer present on disk, "vacuum" to reclaim free pages.
- `knowledge_graph`: Knowledge graph operations with temporal validity and code structure support. Create/remove edges, traverse via directed BFS, bulk-import code graph edges. Relationship types: related_to, supersedes, depends_on, contradicts, specializes, part_of, alternative_to, builds_on, calls, imports, inherits. Code structure types (calls/imports/inherits) are created by knowledge-ingest and use "code:" prefixed node IDs.
- `knowledge_analyze`: Analysis tools: find duplicates, unconnected entries, most-connected concepts (god nodes), bridge entries, knowledge gaps, zero-result search queries, stale-by-code-activity entries, or generate a compact knowledge brief. Actions: consolidate, reflect, god_nodes, bridges, gaps, brief, search_gaps, stale_by_code_activity.

## FAQ

### What AI coding assistants are supported?

It works out of the box with Claude Code, Cursor, OpenCode, Cline, Continue.dev, and Aider.

### Can I use it offline?

Yes, the benchmark runs entirely offline without requiring an LLM or an API key.

### How is the knowledge base synchronized across different machines?

The knowledge base is a git-synced markdown vault that persists across sessions and machines.
