MCP Filesystem Server
Provides LLM-optimized tools for advanced code analysis, repository complexity evaluation, and call graph generation. It enables users to visualize directory structures, detect code patterns, and build semantic context with significant token savings.
README
RIG MCP Tools
A Model Context Protocol (MCP) server providing intelligent code analysis, graph-based architecture insights, and file operations for AI assistants.
Overview
RIG MCP Tools combines two layers of intelligence:
- Static analysis — A Repository Intelligence Graph (RIG) built from AST parsing (ts-morph, tree-sitter) stored in SQLite, enabling graph queries with zero LLM cost.
- LLM-powered tools — A subset of tools that call a configurable GLM-compatible API for natural language reasoning over code.
Installation
From npm
npx rig-mcp-tools
From source
git clone <repository-url>
cd rig-mcp-tools
npm install
npm run build
Docker
docker build -t rig-mcp-tools .
docker run rig-mcp-tools
Configuration
MCP client (Claude Desktop, Cursor, etc.)
{
"mcpServers": {
"rig-tools": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"env": {
"WORKSPACE_PATH": "/your/project",
"GLM_API_URL": "https://api.z.ai/v1/chat/completions",
"GLM_MODEL": "GLM-4.5-Air"
}
}
}
}
Environment variables
| Variable | Default | Description |
|---|---|---|
WORKSPACE_PATH |
/workspace |
Root workspace path |
GLM_API_URL |
https://api.z.ai/v1/chat/completions |
LLM API endpoint (OpenAI-compatible) |
GLM_MODEL |
GLM-4.5-Air |
Model to use for LLM-powered tools |
LLM-powered tools are optional — all other tools work without any API key.
Available Tools
RIG — Graph Analysis
These tools index the repository into a SQLite graph via AST parsing and query it without calling any LLM.
get_smart_context
Retrieve the most relevant files and symbols for a query using graph centrality and keyword scoring.
{ "rootPath": "/project", "text": "authentication flow" }
get_architectural_metrics
Executive summary of repository architecture: core hubs, entry points, and stable foundations ranked by graph centrality.
{ "rootPath": "/project" }
graph_analyzer
Component-level complexity analysis with hotspot detection and refactor recommendations.
{ "rootPath": "/project" }
generate_call_graph
Generate call graphs or dependency diagrams between components, files, or symbols.
{
"rootPath": "/project",
"level": "component",
"format": "mermaid",
"maxDepth": 5
}
level: "component" | "file" | "symbol"
format: "mermaid" | "dot" | "json"
generate_diagram
Generate C4 architecture diagrams, sequence diagrams, call graphs, or dependency visualizations from the RIG.
{
"rootPath": "/project",
"type": "c4-container",
"format": "mermaid",
"focus": "auth",
"maxDepth": 3,
"style": "default"
}
type: "c4-context" | "c4-container" | "c4-component" | "sequence" | "call-graph" | "dependency-graph"
format: "mermaid" | "plantuml" | "dot"
style: "default" | "compact" | "detailed"
extract_method
Surgically extract a function or class from a source file to a target file using RIG symbol coordinates.
{
"rootPath": "/project",
"sourceFile": "src/utils/helpers.ts",
"symbolName": "formatDate",
"targetFile": "src/utils/date.ts"
}
File Operations
Pure filesystem tools, no graph or LLM required.
read_files
Read content of up to 10 files in a single call.
{ "files": ["src/index.ts", "src/config.ts"] }
write_code_unit
Write or overwrite a file with specific content. Creates parent directories as needed.
{ "path": "src/utils/new-file.ts", "content": "export const foo = 1;" }
ls_tree
List directory structure as an ASCII tree.
{ "path": "/project/src", "maxDepth": 3 }
search_code
Search text or regex patterns recursively across the codebase.
{ "path": "/project/src", "pattern": "useEffect", "useRegex": false }
inspect_symbols
Extract class and function signatures from a file using AST analysis (ts-morph).
{ "file": "src/tools/index.ts" }
run_shell_task
Execute allowed shell commands. Whitelisted commands only: npm test, npm run lint, npm run build, tsc, git status, git diff, git log, ls -la, pwd.
{ "command": "npm run build", "timeout": 60000 }
Quality Analysis
Static analysis tools, no LLM required.
detect_patterns
Detect anti-patterns, code smells, and security issues using Babel AST analysis.
{ "sourceCode": "...", "filePath": "src/auth/login.ts" }
suggest_refactor
Detect refactoring opportunities: long functions, deep nesting, magic numbers, duplicate code, and missing type annotations.
{
"file_path": "src/services/user.ts",
"max_suggestions": 10,
"min_priority": 3,
"include_diff": true
}
Either file_path or code_snippet must be provided.
analyze_dependencies
Build a lightweight dependency graph of TypeScript files via import analysis. Returns nodes, circular dependencies, and DOT format for Graphviz.
{ "rootPath": "/project/src" }
LLM-Powered
These tools require GLM_API_URL and GLM_MODEL to be configured.
analyze_logic
Ask a natural language question about a piece of code. Uses the configured LLM to reason about behavior, intent, or logic.
{
"code": "function debounce(fn, delay) { ... }",
"question": "What edge cases does this miss?"
}
smart_summarize
Generate an intelligent summary of a code file including imports, exports, purpose, and key dependencies.
{ "code": "...", "maxLength": 200 }
Architecture
src/
├── cli/ # rig-indexer CLI (pre-index a repo into .rig/index.db)
├── graph/ # RIG graph engine (indexer, parsers, SQLite storage, types)
├── security/ # Path validation and safe extension checks
└── tools/ # MCP tool implementations (17 tools)
Pre-indexing a repository
For large codebases, pre-index before using RIG tools:
npx tsx src/cli/index.ts /path/to/project --db /path/to/project/.rig/index.db
Options: --max-files <n>, --include-tests, --json
Development
npm run build # Compile TypeScript
npm run dev # Run in development mode
npm test # Run test suite
npm run clean # Clean build artifacts
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 模型以安全和受控的方式获取实时的网络信息。