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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.