NervusDB MCP Server
Enables building and querying code knowledge graphs for project analysis, with tools for exploring code relationships, managing workflows, and automating development tasks. Integrates with Git and GitHub for branch management and pull request creation.
README
@nervusdb/mcp
Official MCP server for NervusDB - Code knowledge graph with repomix integration
Features
- Code Knowledge Graph: Build cross-language code knowledge graphs using
@nervusdb/coreandrepomix - Project Insights: Analyze code impact, find related files, and explore project structure
- Workflow Automation: Task management with branch creation and PR submission
- Code Operations: Read, write files, and run tests with safety checks
- Database Tools: Query and maintain the knowledge graph index
- Shadow Index Strategy: Ensures reliable indexing with fingerprint validation
Prerequisites
- Node.js 20.0.0 or higher
- pnpm 8.0.0 or higher
Quick Start
Install Dependencies
pnpm install
Run the Server
# For development
pnpm start:stdio
# Build for production
pnpm build
Index a Project
pnpm synapse:index -p /path/to/your/project
Claude Desktop Integration
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"nervusdb-mcp": {
"command": "npx",
"args": ["-y", "@nervusdb/mcp"]
}
}
}
Alternatively, if you've installed the package globally:
{
"mcpServers": {
"nervusdb-mcp": {
"command": "nervusdb-mcp"
}
}
}
Installation Options:
# Option 1: Use npx (recommended, no installation needed)
# Just add the config above, Claude will run it automatically
# Option 2: Install globally for faster startup
npm install -g @nervusdb/mcp
Configuration
GitHub Authentication (for Workflow Tools)
Workflow tools (workflow.submitForReview) require GitHub authentication to create pull requests. The server supports 3 authentication methods with automatic fallback:
Method 1: Environment Variables (Recommended for CI/CD)
# Set GITHUB_TOKEN or GH_TOKEN
export GITHUB_TOKEN=ghp_your_personal_access_token
# Or in your shell profile (~/.zshrc or ~/.bashrc)
echo 'export GITHUB_TOKEN=ghp_xxx' >> ~/.zshrc
Method 2: GitHub CLI (Recommended for Local Development)
# Install gh CLI
brew install gh # macOS
# Or see https://cli.github.com/ for other platforms
# Authenticate
gh auth login
Method 3: Claude Desktop Configuration
Add environment variables to Claude Desktop config:
{
"mcpServers": {
"nervusdb-mcp": {
"command": "npx",
"args": ["-y", "@nervusdb/mcp"],
"env": {
"GITHUB_TOKEN": "ghp_your_personal_access_token"
}
}
}
}
Authentication Priority:
GITHUB_TOKENenvironment variable (highest priority)GH_TOKENenvironment variablegh auth tokencommand (if gh CLI is authenticated)
If no authentication is available, workflow tools will provide clear error messages with setup instructions.
Available Tools
The NervusDB MCP server provides 13 tools across 4 categories:
1. Workflow Tools ⚙️
workflow.startTask- Create task branch and update ledgerworkflow.submitForReview- Push branch and create pull request (requires GitHub authentication)
2. Project Tools
project.getStructure- Get project file structure with statisticsproject.analyzeImpact- Analyze code impact based on knowledge graphproject.findRelatedFiles- Find files related to a target fileproject.readFile- Read arbitrary file content
3. Code Tools
code.readFile- Read project file contentcode.writeFile- Write content to project file (requires confirmation)code.runTests- Run tests using Vitest and return results
4. Database Tools
db.getStats- Get index metadata and statisticsdb.query- Execute typed or raw queries against knowledge graphdb.rebuildIndex- Rebuild project index with telemetrydb.getHealth- Check index health with fingerprint validation
Usage Example
// 1. Start a new task
workflow.startTask({
taskId: '42',
owner: 'alice',
designDoc: 'docs/design/feature-42.md',
});
// 2. Analyze code impact
project.analyzeImpact({
projectPath: '/workspace/my-project',
functionName: 'calculateTotal',
limit: 20,
});
// 3. Read a file
code.readFile({
projectPath: '/workspace/my-project',
file: 'src/services/orderService.ts',
});
// 4. Run tests
code.runTests({
projectPath: '/workspace/my-project',
filter: 'orderService',
});
// 5. Query the knowledge graph
db.query({
projectPath: '/workspace/my-project',
query: {
type: 'typed',
filter: { predicate: 'CONTAINS' },
options: { limit: 100 },
},
});
// 6. Submit for review
workflow.submitForReview({
confirm: true,
title: 'feat: optimize order calculation',
reviewers: ['bob'],
});
How It Works
- Indexing: Uses
repomixto collect project files and@nervusdb/coreto build a knowledge graph - Storage: Maintains shadow indices with fingerprint validation for data integrity
- Query: Provides typed and raw query interfaces to explore code relationships
- Workflow: Integrates with Git workflows for task management
Project Structure
nervusdb-mcp/
├── src/
│ ├── server/ # MCP server implementation
│ ├── tools/ # Tool implementations (workflow, project, code, db)
│ ├── services/ # Business logic services
│ ├── domain/ # Core domain logic (indexing, query)
│ └── utils/ # Shared utilities
├── bin/ # CLI executables
├── docs/ # Documentation
└── tests/ # Test suites
Development
# Install dependencies
pnpm install
# Run tests
pnpm test
# Check code quality
pnpm check
# Build for production
pnpm build
Documentation
- Tools Overview - Detailed documentation for all 13 tools
- Architecture Design
- Quality Guidelines
- Build and Release
Contributing
See CONTRIBUTING.md for development guidelines.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。