MCP Filesystem Server
RIG MCP Tools
AIアシスタント向けに、インテリジェントなコード分析、グラフベースのアーキテクチャ洞察、およびファイル操作を提供するModel Context Protocol (MCP) サーバーです。
概要
RIG MCP Toolsは、3つのインテリジェンス層を組み合わせています:
静的解析 — AST解析(ts-morph、tree-sitter)から構築され、SQLiteに保存されるリポジトリインテリジェンスグラフ(RIG)。LLMコストゼロでグラフクエリを実行可能です。
セマンティック検索 — ローカルモデル(nomic-embed-textまたは互換モデル)を使用した埋め込みベースのシンボル検索。埋め込みは初回実行後にSQLiteにキャッシュされます。ファイル全体ではなく正確なコードスニペットを返すため、トークン使用量を最小限に抑えます。
LLM駆動ツール — コードに関する自然言語推論のために、設定可能なOpenAI互換APIを呼び出すツール群です。
Related MCP server: CodeXRay
インストール
npmから
npx rig-mcp-toolsソースから
git clone <repository-url>
cd rig-mcp-tools
npm install
npm run buildDocker
docker build -t rig-mcp-tools .
docker run rig-mcp-tools設定
MCPクライアント (Claude Desktop, Cursorなど)
{
"mcpServers": {
"rig-tools": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"env": {
"WORKSPACE_PATH": "/your/project",
"GLM_API_URL": "http://localhost:1234/v1/chat/completions",
"GLM_MODEL": "qwen2.5-coder-7b-instruct-mlx@8bit",
"EMBEDDING_API_URL": "http://localhost:1234/v1/embeddings",
"EMBEDDING_MODEL": "text-embedding-nomic-embed-text-v1.5"
}
}
}
}環境変数
変数 | デフォルト | 説明 |
|
| ルートワークスペースパス |
|
| LLM APIエンドポイント (OpenAI互換) |
|
| LLM駆動ツール用モデル |
|
| 埋め込みAPIエンドポイント |
|
| セマンティック検索用モデル |
LLMおよび埋め込みツールはオプションです。すべての静的解析ツールはAPIなしでも動作します。
利用可能なツール
RIG — グラフ分析
これらのツールは、AST解析を通じてリポジトリをSQLiteグラフにインデックス化し、LLMを呼び出さずにクエリを実行します。
get_smart_context
グラフ中心性とキーワードスコアリングを使用して、クエリに関連する最も重要なファイルとシンボルを取得します。
{ "rootPath": "/project", "text": "authentication flow" }get_architectural_metrics
リポジトリアーキテクチャの要約:グラフ中心性によってランク付けされたコアハブ、エントリポイント、安定した基盤。
{ "rootPath": "/project" }graph_analyzer
ホットスポット検出とリファクタリングの推奨事項を含む、コンポーネントレベルの複雑性分析。
{ "rootPath": "/project" }generate_call_graph
コンポーネント、ファイル、またはシンボル間のコールグラフや依存関係図を生成します。
{
"rootPath": "/project",
"level": "component",
"format": "mermaid",
"maxDepth": 5
}level: "component" | "file" | "symbol"format: "mermaid" | "dot" | "json"
generate_diagram
RIGからC4アーキテクチャ図、シーケンス図、コールグラフ、または依存関係の可視化を生成します。
{
"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
RIGシンボル座標を使用して、ソースファイルから関数やクラスをターゲットファイルへ外科的に抽出します。
{
"rootPath": "/project",
"sourceFile": "src/utils/helpers.ts",
"symbolName": "formatDate",
"targetFile": "src/utils/date.ts"
}ファイル操作
純粋なファイルシステムツール。グラフやLLMは不要です。
read_files
1回の呼び出しで最大10ファイルの内容を読み取ります。
{ "files": ["src/index.ts", "src/config.ts"] }write_code_unit
特定のコンテンツでファイルを書き込みまたは上書きします。必要に応じて親ディレクトリを作成します。
{ "path": "src/utils/new-file.ts", "content": "export const foo = 1;" }ls_tree
ディレクトリ構造をASCIIツリーとしてリスト表示します。
{ "path": "/project/src", "maxDepth": 3 }search_code
コードベース全体でテキストまたは正規表現パターンを再帰的に検索します。
{ "path": "/project/src", "pattern": "useEffect", "useRegex": false }inspect_symbols
AST解析(ts-morph)を使用して、ファイルからクラスと関数のシグネチャを抽出します。
{ "file": "src/tools/index.ts" }run_shell_task
許可されたシェルコマンドを実行します。
{ "command": "npm run build", "timeout": 60000 }許可されたプレフィックス: npm test, npm run, npm list, npx vitest, npx tsc, npx eslint, node --version, tsc, git status, git diff, git log, git show, git blame, ls, pwd, cat, wc。
品質分析
静的解析ツール。LLMは不要です。
detect_patterns
Babel AST解析を使用して、アンチパターン、コードの臭い、セキュリティ上の問題を検出します。
{ "sourceCode": "...", "filePath": "src/auth/login.ts" }suggest_refactor
長い関数、深いネスト、マジックナンバー、重複コード、欠落している型注釈など、リファクタリングの機会を検出します。
{
"file_path": "src/services/user.ts",
"max_suggestions": 10,
"min_priority": 3,
"include_diff": true
}file_path または code_snippet のいずれかを提供する必要があります。
analyze_dependencies
インポート解析を通じてTypeScriptファイルの軽量な依存関係グラフを構築します。ノード、循環依存関係、およびGraphviz用のDOT形式を返します。
{ "rootPath": "/project/src" }埋め込み駆動
EMBEDDING_API_URL と EMBEDDING_MODEL が必要です。埋め込みはシンボルごとに1回生成され、.rig/index.db にキャッシュされます。以降のクエリではクエリ文字列のみが埋め込まれます。
search_semantic
ベクトル類似性を使用したセマンティックシンボル検索。最も関連性の高い関数やクラスをコードスニペットと共に返します。ファイル全体をコンテキストに読み込まないように、read_files の前にこれを使用してください。埋め込みはシンボルごとに1回生成され、.rig/index.db にキャッシュされます。
{
"repoPath": "/project",
"query": "how is authentication handled",
"maxResults": 5,
"threshold": 0.3
}LLM駆動
GLM_API_URL と GLM_MODEL が必要です。
analyze_logic
コードの一部について自然言語で質問します。設定されたLLMを使用して、動作、意図、またはロジックについて推論します。
{
"filePath": "/project/src/auth/login.ts",
"question": "What edge cases does this miss?"
}ファイルの内容をコンテキストに渡さないように、code よりも filePath を優先してください。
smart_summarize
インポート、エクスポート、目的、主要な依存関係を含む、コードファイルのインテリジェントな要約を生成します。
{ "filePath": "/project/src/services/user.ts", "maxLength": 200 }generate_unit_tests
特定の関数やクラスのvitestユニットテストを生成します。RIGインデックスを使用してメソッド本体のみ(ファイル全体ではなく)を抽出するため、トークン効率に優れています。正常系、境界値、エラーケースをカバーします。
{
"repoPath": "/project",
"symbolName": "createUser",
"filePath": "src/services/user.ts"
}filePath は、シンボルが複数のファイルに存在する場合にのみ必要です。
investigate_ts_fix
tsc --noEmit を実行し、LLMを使用して各TypeScriptエラーの説明と最小限の修正案を提示します。トークン効率:ファイル全体ではなく、エラー行周辺のスニペット(±8行)のみを渡します。
{
"repoPath": "/project",
"filePath": "src/services/user.ts",
"maxErrors": 5
}filePath と maxErrors はオプションです。filePath を省略すると、リポジトリ全体のすべてのエラーを調査します。
アーキテクチャ
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 (19 tools)リポジトリの事前インデックス作成
大規模なコードベースの場合、RIGツールを使用する前に事前インデックスを作成してください:
npx tsx src/cli/index.ts /path/to/project --db /path/to/project/.rig/index.dbオプション: --max-files <n>, --include-tests, --json
開発
npm run build # Compile TypeScript
npm run dev # Run in development mode
npm test # Run test suite
npm run clean # Clean build artifactsライセンス
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
AI-powered codebase analysis — call graphs, security, dead code, complexity. 150+ tools.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to perform high-performance code search and analysis across multiple languages using symbol indexing, regex text search, and structural AST pattern matching. It also provides tools for technology stack detection and dependency analysis with persistent caching for optimized performance.10MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to query a pre-built semantic knowledge graph of code, reducing token usage and tool calls. Supports 16 tools for code exploration, analysis, and context building.23 npm8MIT
- AlicenseNot gradedqualityCmaintenanceProvides a semantic understanding of your codebase by parsing with tree-sitter and building a graph of symbols and dependencies. Enables AI assistants to navigate code, analyze changes, and discover architecture using 18 tools with minimal context overhead.12 npm1MIT
- AlicenseNot gradedqualityAmaintenanceProvides a dependency graph of any local repository with tools for change impact, transitive dependents, health audits, and more, enabling AI coding agents to see structure and refactor safely.4,912 npm4MIT