Skip to content

Commit d8d3c6d

Browse files
committed
Add comprehensive docs/ documentation, rebuild root docs, fix outdated references
- Create 37 documentation files in docs/ (~6000 lines) covering: architecture, configuration, CLI, indexer, watcher, all 6 graph types, search algorithms, embeddings, REST API, MCP tools guide, WebSocket, authentication, security, file mirror, team management, npm, Docker, UI architecture/features/patterns, API patterns, testing - Add concept docs: docs indexing, code indexing, tasks, skills, knowledge graph, file index — explaining design principles - Rebuild README.md, CLAUDE.md, ARCHITECTURE.md, SPEC.md — minimal with links to docs/ - Fix ts-morph → tree-sitter references across all docs and UI help - Fix SkillSource: manual/imported → user/learned - Fix test counts: 1240 tests, 28 suites - Fix MCP client config: Claude Desktop HTTP via Settings > Connectors, Claude Code .mcp.json with type: http/stdio - Fix skill embedding input docs (title + description, not triggers/tags) - Update UI help: auth config with passwordHash/jwtSecret, per-graph embedding format, npm bin commands
1 parent 708bb4a commit d8d3c6d

50 files changed

Lines changed: 6415 additions & 2980 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ARCHITECTURE.md

Lines changed: 22 additions & 1085 deletions
Large diffs are not rendered by default.

CLAUDE.md

Lines changed: 34 additions & 363 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 140 additions & 534 deletions
Large diffs are not rendered by default.

SPEC.md

Lines changed: 55 additions & 943 deletions
Large diffs are not rendered by default.

docs/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Documentation
2+
3+
## General
4+
5+
- [Overview](overview.md) — what mcp-graph-memory is and what it does
6+
- [Architecture](architecture.md) — system architecture, layers, data flow, directory structure
7+
8+
## Concepts
9+
10+
- [How Documentation Indexing Works](concepts-docs-indexing.md) — from markdown to semantic graph: parsing, chunking, links, code blocks
11+
- [How Code Indexing Works](concepts-code-indexing.md) — from source to graph: tree-sitter AST, symbols, imports, relationships
12+
- [Task Management — Principles](concepts-tasks.md) — kanban workflow, priorities, relationships, cross-graph context
13+
- [Skills — Purpose and Design](concepts-skills.md) — reusable recipes, triggers, recall, usage tracking
14+
- [Knowledge Graph — Purpose and Design](concepts-knowledge.md) — persistent memory layer, cross-graph links, proxy lifecycle
15+
- [File Index — Purpose and Design](concepts-file-index.md) — complete project map, metadata, directory hierarchy
16+
17+
## Server
18+
19+
- [CLI](cli.md) — CLI commands (`serve`, `mcp`, `index`, `users add`), startup sequences
20+
- [Configuration](configuration.md) — full `graph-memory.yaml` reference
21+
22+
## Indexing
23+
24+
- [Indexer](indexer.md) — indexing pipeline, three serial queues, dispatch logic
25+
- [Watcher](watcher.md) — file watching, real-time indexing, mirror file reverse import
26+
27+
## Graphs
28+
29+
- [Graphs Overview](graphs-overview.md) — six graph types, managers, persistence, cross-graph links, node IDs
30+
- [DocGraph](graph-docs.md) — markdown document chunks, parsing, code block extraction
31+
- [CodeGraph](graph-code.md) — AST symbols, tree-sitter parsing, supported languages
32+
- [KnowledgeGraph](graph-knowledge.md) — user/LLM notes, relations, cross-graph links, attachments
33+
- [FileIndexGraph](graph-file-index.md) — all project files, directory hierarchy, language/MIME detection
34+
- [TaskGraph](graph-tasks.md) — kanban tasks, priorities, assignees, cross-graph links
35+
- [SkillGraph](graph-skills.md) — reusable recipes, triggers, usage tracking
36+
37+
## Search & Embeddings
38+
39+
- [Search](search.md) — hybrid BM25 + vector search, BFS expansion, RRF fusion
40+
- [Embeddings](embeddings.md) — embedding models, configuration, remote embedding, embedding API
41+
42+
## API
43+
44+
- [REST API](api-rest.md) — full endpoint reference
45+
- [REST API Patterns](api-patterns.md) — middleware chain, validation, auth, error handling, mutation serialization
46+
- [MCP Tools Reference](api-mcp.md) — all 58 MCP tools with input/output schemas
47+
- [MCP Tools Guide](mcp-tools-guide.md) — detailed descriptions, when to use, best practices
48+
- [WebSocket](api-websocket.md) — real-time event types and format
49+
50+
## Auth & Security
51+
52+
- [Authentication](authentication.md) — password login, JWT cookies, API keys, ACL resolution
53+
- [Security](security.md) — CSRF, XSS, timing attacks, SSRF, path traversal protections
54+
55+
## Features
56+
57+
- [File Mirror](file-mirror.md) — markdown mirroring for notes/tasks/skills, reverse import from IDE
58+
- [Team Management](team.md)`.team/` directory, task assignees
59+
60+
## Deployment
61+
62+
- [npm Package](npm-package.md)`@prih/mcp-graph-memory` installation and usage
63+
- [Docker](docker.md) — Docker image, Docker Compose, volume mounts
64+
65+
## UI
66+
67+
- [UI Architecture](ui-architecture.md) — React + MUI + FSD stack, routing, auth flow
68+
- [UI Features](ui-features.md) — all pages: dashboard, kanban, graph viz, prompt generator, etc.
69+
- [UI Patterns](ui-patterns.md) — FSD conventions, page patterns, hooks, state management, WebSocket, ACL
70+
71+
## Development
72+
73+
- [Testing](testing.md) — Jest test suites, test patterns, CI

docs/api-mcp.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# MCP Tools Reference
2+
3+
**Files**: `src/api/index.ts`, `src/api/tools/`
4+
5+
58 MCP tools exposed via stdio and HTTP transports.
6+
7+
## Tool groups
8+
9+
| Group | Count | Condition | File |
10+
|-------|-------|-----------|------|
11+
| Context | 1 | always | `tools/context/` |
12+
| Docs | 5 | docs graph enabled | `tools/docs/` |
13+
| Code blocks | 4 | docs graph enabled | `tools/docs/` |
14+
| Cross-graph | 1 | docs + code enabled | `tools/docs/` |
15+
| Code | 5 | code graph enabled | `tools/code/` |
16+
| File index | 3 | always | `tools/file-index/` |
17+
| Knowledge | 12 | always | `tools/knowledge/` |
18+
| Tasks | 13 | always | `tools/tasks/` |
19+
| Skills | 14 | always | `tools/skills/` |
20+
21+
## Context tool
22+
23+
| Tool | Input | Output |
24+
|------|-------|--------|
25+
| `get_context` || `{ projectId, workspaceId?, workspaceProjects?, availableGraphs }` |
26+
27+
## Docs tools
28+
29+
| Tool | Input | Output |
30+
|------|-------|--------|
31+
| `list_topics` || `[{ fileId, title, chunks }]` |
32+
| `get_toc` | `fileId` | `[{ id, title, level }]` |
33+
| `search` | `query` + optional `topK`, `bfsDepth`, `maxResults`, `minScore`, `bfsDecay`, `searchMode` | `[{ id, fileId, title, content, level, score }]` |
34+
| `get_node` | `nodeId` | `{ id, fileId, title, content, level, mtime }` |
35+
| `search_topic_files` | `query` + optional `topK`, `minScore` | `[{ fileId, title, score }]` |
36+
37+
## Code block tools
38+
39+
| Tool | Input | Output |
40+
|------|-------|--------|
41+
| `find_examples` | `symbol` + optional `language`, `fileId` | `[{ id, fileId, language, symbols, content, parentId, parentTitle }]` |
42+
| `search_snippets` | `query` + optional `topK`, `minScore` | `[{ id, fileId, language, symbols, content, score }]` |
43+
| `list_snippets` | optional `fileId`, `language`, `filter` | `[{ id, fileId, language, symbols, preview }]` |
44+
| `explain_symbol` | `symbol` + optional `fileId` | `{ codeBlock, explanation, fileId }` |
45+
46+
## Cross-graph tools
47+
48+
| Tool | Input | Output |
49+
|------|-------|--------|
50+
| `cross_references` | `symbol` | `{ definitions, documentation, examples }` |
51+
52+
Requires both DocGraph and CodeGraph to be enabled. Bridges code definitions with documentation examples.
53+
54+
## Code tools
55+
56+
| Tool | Input | Output |
57+
|------|-------|--------|
58+
| `list_files` || `[{ fileId, symbolCount }]` |
59+
| `get_file_symbols` | `fileId` | `[{ id, kind, name, signature, startLine, endLine, isExported }]` |
60+
| `search_code` | `query` + optional search params | `[{ id, fileId, kind, name, signature, docComment, startLine, endLine, score }]` |
61+
| `get_symbol` | `nodeId` | `{ id, fileId, kind, name, signature, docComment, body, startLine, endLine, isExported }` |
62+
| `search_files` | `query` + optional `topK`, `minScore` | `[{ fileId, score }]` |
63+
64+
## File index tools
65+
66+
| Tool | Input | Output |
67+
|------|-------|--------|
68+
| `list_all_files` | optional `directory`, `extension`, `language`, `filter`, `limit` | `[{ filePath, kind, fileName, extension, language, mimeType, size, fileCount }]` |
69+
| `search_all_files` | `query` + optional `topK`, `minScore` | `[{ filePath, fileName, extension, language, size, score }]` |
70+
| `get_file_info` | `filePath` | `{ filePath, kind, fileName, directory, extension, language, mimeType, size, fileCount, mtime }` |
71+
72+
## Knowledge tools
73+
74+
| Tool | Input | Output |
75+
|------|-------|--------|
76+
| `create_note` | `title`, `content`, optional `tags` | `{ noteId }` |
77+
| `update_note` | `noteId` + optional `title`, `content`, `tags` | `{ noteId, updated }` |
78+
| `delete_note` | `noteId` | `{ noteId, deleted }` |
79+
| `get_note` | `noteId` | `{ id, title, content, tags, createdAt, updatedAt }` |
80+
| `list_notes` | optional `filter`, `tag`, `limit` | `[{ id, title, tags, updatedAt }]` |
81+
| `search_notes` | `query` + optional search params | `[{ id, title, content, tags, score }]` |
82+
| `create_relation` | `fromId`, `toId`, `kind` + optional `targetGraph` | `{ fromId, toId, kind, targetGraph?, created }` |
83+
| `delete_relation` | `fromId`, `toId` + optional `targetGraph` | `{ fromId, toId, deleted }` |
84+
| `list_relations` | `noteId` | `[{ fromId, toId, kind, targetGraph? }]` |
85+
| `find_linked_notes` | `targetId`, `targetGraph` | `[{ noteId, kind }]` |
86+
| `add_note_attachment` | `noteId`, `filename`, `content` (base64) | `{ noteId, filename, added }` |
87+
| `remove_note_attachment` | `noteId`, `filename` | `{ noteId, filename, removed }` |
88+
89+
## Task tools
90+
91+
| Tool | Input | Output |
92+
|------|-------|--------|
93+
| `create_task` | `title` + optional `description`, `status`, `priority`, `tags`, `dueDate`, `estimate`, `assignee` | `{ taskId }` |
94+
| `update_task` | `taskId` + optional fields | `{ taskId, updated }` |
95+
| `delete_task` | `taskId` | `{ taskId, deleted }` |
96+
| `get_task` | `taskId` | `{ id, title, description, status, priority, tags, dueDate, estimate, assignee, completedAt, createdAt, updatedAt, subtasks, blockedBy, blocks, related }` |
97+
| `list_tasks` | optional `status`, `priority`, `tag`, `filter`, `assignee`, `limit` | `[{ id, title, status, priority, tags, dueDate, estimate, assignee, completedAt }]` |
98+
| `search_tasks` | `query` + optional search params | `[{ id, title, description, status, priority, tags, score }]` |
99+
| `move_task` | `taskId`, `status` | `{ taskId, status, completedAt }` |
100+
| `link_task` | `fromId`, `toId`, `kind` (`subtask_of`, `blocks`, `related_to`) | `{ fromId, toId, kind, created }` |
101+
| `create_task_link` | `taskId`, `targetId`, `targetGraph` | `{ taskId, targetId, targetGraph, created }` |
102+
| `delete_task_link` | `taskId`, `targetId`, `targetGraph` | `{ taskId, targetId, deleted }` |
103+
| `find_linked_tasks` | `targetId`, `targetGraph` | `[{ taskId, kind }]` |
104+
| `add_task_attachment` | `taskId`, `filename`, `content` (base64) | `{ taskId, filename, added }` |
105+
| `remove_task_attachment` | `taskId`, `filename` | `{ taskId, filename, removed }` |
106+
107+
## Skill tools
108+
109+
| Tool | Input | Output |
110+
|------|-------|--------|
111+
| `create_skill` | `title` + optional `description`, `steps`, `triggers`, `source`, `tags` | `{ skillId }` |
112+
| `update_skill` | `skillId` + optional fields | `{ skillId, updated }` |
113+
| `delete_skill` | `skillId` | `{ skillId, deleted }` |
114+
| `get_skill` | `skillId` | `{ id, title, description, steps, triggers, source, tags, usageCount, lastUsedAt, createdAt, updatedAt, dependsOn, dependedBy, related, variants }` |
115+
| `list_skills` | optional `source`, `tag`, `filter`, `limit` | `[{ id, title, source, tags, usageCount, lastUsedAt }]` |
116+
| `search_skills` | `query` + optional search params | `[{ id, title, description, source, tags, score }]` |
117+
| `recall_skills` | `query` + optional `topK`, `maxResults` | `[{ id, title, description, steps, triggers, source, tags, score }]` |
118+
| `bump_skill_usage` | `skillId` | `{ skillId, usageCount, lastUsedAt }` |
119+
| `link_skill` | `fromId`, `toId`, `kind` (`depends_on`, `related_to`, `variant_of`) | `{ fromId, toId, kind, created }` |
120+
| `create_skill_link` | `skillId`, `targetId`, `targetGraph` | `{ skillId, targetId, targetGraph, created }` |
121+
| `delete_skill_link` | `skillId`, `targetId`, `targetGraph` | `{ skillId, targetId, deleted }` |
122+
| `find_linked_skills` | `targetId`, `targetGraph` | `[{ skillId, kind }]` |
123+
| `add_skill_attachment` | `skillId`, `filename`, `content` (base64) | `{ skillId, filename, added }` |
124+
| `remove_skill_attachment` | `skillId`, `filename` | `{ skillId, filename, removed }` |
125+
126+
## Mutation serialization
127+
128+
Mutation tools (create/update/delete) are wrapped via `createMutationServer()` — a proxy that enqueues every mutation handler into a `PromiseQueue`. This prevents race conditions from parallel MCP sessions.
129+
130+
Read-only tools (list, get, search) run freely without queueing.
131+
132+
## Transports
133+
134+
| Transport | Method | Use case |
135+
|-----------|--------|----------|
136+
| **stdio** | `startStdioServer()` | IDE integration, single project |
137+
| **HTTP** | `startMultiProjectHttpServer()` | Multi-project, remote clients |
138+
139+
### HTTP session management
140+
141+
- Route: `/mcp/{projectId}`
142+
- Each POST creates a new session (`randomUUID()`), returned via `mcp-session-id` header
143+
- Sessions share graph instances via `ProjectManager`
144+
- Idle session sweep every 60s (configurable timeout, default 30 min)

0 commit comments

Comments
 (0)