Skip to main content

KnowledgeSmith MCP Server

MCP Server for Graphiti memory and document chunking. Previously included RBT document editing tools (now archived).

📦 Archive Notice

RBT Document Editor Tools (Archived 2025-10-09)

The RBT document editing功能已於 2025-10-09 封存,改用原生 Claude Code Read/Edit/Write 工具以降低維護成本和 token 使用。

封存內容:

  • document_service.py - 文件服務
  • document_parser.py - 文件解析器
  • 11 個 editor MCP 工具(get_outline, read_content, update_block 等)
  • templates/ - 文件模板
  • cache.py - 文件快取

保留功能:

  • ✅ chunking/ - 文件分塊與同步功能
  • ✅ graphiti_tools.py - Graphiti 記憶體功能(8 個工具)

如何恢復封存的代碼:

# 查看封存版本
git show v-with-editor

# 恢復特定檔案
git checkout v-with-editor -- rbt_mcp_server/document_service.py

# 或建立分支使用完整封存版本
git checkout -b restore-editor v-with-editor

🎯 Current Features

Graphiti Knowledge Graph Integration

  • Intelligent Chunking: Automatically split documents into semantic chunks based on document structure (sections for RBT, H3 headings for Markdown)
  • Incremental Sync: Only update changed chunks, preserving unchanged content
  • Neo4j Backend: Store document chunks as episodes in Graphiti knowledge graph
  • graphiti-memory Compatible: Drop-in replacement with same search_nodes/search_facts API
  • 8 MCP Tools: add_document, search_memory_nodes, search_memory_facts, get_episodes, delete_episode, get_entity_edge, delete_entity_edge, clear_graph

📦 Installation

Prerequisites

1. Setup Neo4j Database

Using Docker (recommended):

docker run \
  -p 7474:7474 \
  -p 7687:7687 \
  -e NEO4J_AUTH=neo4j/your-password \
  --name neo4j \
  neo4j:latest

Verify at: http://localhost:7474

2. Get OpenAI API Key

Required for Graphiti embeddings and graph operations.

Install MCP Server

Option 1: Install from source (uv)

# Clone repository
git clone https://github.com/yourusername/KnowledgeSmith.git
cd KnowledgeSmith

# Install with uv
uv pip install -e .

Option 2: Direct installation

uv pip install rbt-mcp-server

🚀 Quick Start

1. Configure Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "graphiti-memory-server": {
      "type": "stdio",
      "command": "rbt-mcp-server",
      "env": {
        "RBT_ROOT_DIR": "/path/to/your/document/root",
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USER": "neo4j",
        "NEO4J_PASSWORD": "your-password",
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

Required Environment Variables:

  • RBT_ROOT_DIR: Root directory for document comparison (required for add_document tool)
  • NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD: Neo4j database connection
  • OPENAI_API_KEY: OpenAI API key for Graphiti embeddings

Or use full uv command:

{
  "mcpServers": {
    "graphiti-memory-server": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "rbt-mcp-server"],
      "env": {
        "RBT_ROOT_DIR": "/path/to/your/document/root",
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USER": "neo4j",
        "NEO4J_PASSWORD": "your-password",
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

2. Set Environment Variables (Optional - if not using Claude Desktop)

# Required for add_document tool
export RBT_ROOT_DIR=/path/to/your/document/root

# Required for Graphiti integration
export NEO4J_URI=bolt://localhost:7687
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=your-password
export OPENAI_API_KEY=your-openai-api-key

3. Test the Server

rbt-mcp-server

📚 Available MCP Tools

Document Management

  1. add_document - Sync documents to knowledge graph with automatic chunking
    • Supports Markdown (chunked by H3 headings) and RBT documents
    • Incremental sync: only updates changed chunks

Knowledge Graph Query

  1. search_memory_nodes - Search knowledge graph nodes (entities, preferences, procedures)
  2. search_memory_facts - Search knowledge graph facts (relationships)
  3. get_episodes - Retrieve recent memory episodes

Data Management

  1. delete_episode - Delete specific episode
  2. get_entity_edge - Get entity relationship edge by UUID
  3. delete_entity_edge - Delete entity relationship edge
  4. clear_graph - Clear all data from knowledge graph (⚠️ irreversible)

🔗 Graphiti Integration Usage

Adding Documents to Knowledge Graph

General Markdown Documents:

add_document(
    new_file_path="/absolute/path/to/document.md",
    project_id="my-project",
    file_path="docs/guide.md"  # relative path for general docs
)

RBT Documents (REQ/BP/TASK):

add_document(
    new_file_path="/absolute/path/to/TASK-001.md",
    project_id="knowledge-smith",
    feature_id="my-feature",
    rbt_type="TASK",
    file_path="001"  # task number for TASK documents
)

Searching Knowledge

# Search for nodes (entities, preferences, procedures)
results = await search_nodes(
    query="documentation preferences",
    group_ids=["knowledge-smith"],
    entity="Preference",
    max_nodes=10
)

# Search for facts (relationships)
facts = await search_facts(
    query="task dependencies",
    group_ids=["knowledge-smith"],
    max_facts=10
)

Difference from graphiti-memory MCP

This MCP server extends the original graphiti-memory MCP with document chunking capabilities:

  • Original graphiti-memory: Stores entire documents as single episodes
  • This MCP (graphiti-chunk-mcp): Automatically chunks documents into semantic sections
    • RBT documents: Split by section (sec-*)
    • Markdown documents: Split by H3 headings (###)
    • Incremental updates: Only sync changed chunks

API Compatibility: All search_nodes, search_facts, get_episodes functions maintain the same interface as graphiti-memory.

📖 Documentation

🧪 Development

Install development dependencies:

uv sync --dev

Run tests:

RBT_ROOT_DIR=/test/root uv run pytest -v

Test coverage:

RBT_ROOT_DIR=/test/root uv run pytest --cov=rbt_mcp_server --cov-report=html

📝 License

MIT License

🤝 Contributing

Contributions welcome! Please open an issue or submit a pull request.

Metadata

Release files for rbt-mcp-server 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rbt-mcp-server 0.3.2
File Size Uploaded Provenance Actions
rbt_mcp_server-0.3.2.tar.gz 164.2 kB Without provenance Details for rbt_mcp_server-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rbt-mcp-server 0.3.2
File Interpreter ABI Platform Actions
rbt_mcp_server-0.3.2-py3-none-any.whl Python 3 none any Details for rbt_mcp_server-0.3.2-py3-none-any.whl

Total release size: 206.4 kB

Release files / rbt_mcp_server-0.3.2.tar.gz

Download URL rbt_mcp_server-0.3.2.tar.gz
Size 164.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6f986bb3954a3225b7b249776e76c0380e55743d1e80dbf681c7a39a5c291ed8
BLAKE2b-256 checksum
How to use checksums
420f2a82098fe1a72d833dfb839f82b741768abd781528685e93a7ffcb6e38d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.19

Release files / rbt_mcp_server-0.3.2-py3-none-any.whl

Download URL rbt_mcp_server-0.3.2-py3-none-any.whl
Size 42.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b03ab90f5db71ae64b55aac224d4ec64e706f8e24d7aa51d0ee7ce183ec565b
BLAKE2b-256 checksum
How to use checksums
0f9fe2a2d367a108acad8b9b7f8a73e5bd742ee6db5c2e6a5ffd69b804545dbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.19

Security for rbt-mcp-server 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page