
angrysky56/ast-mcp-server
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
ソースコードをクエリ可能なSemantic Graphと構造ASTに変換することで、このツールは「テキストの読み込み」と「構造の理解」の間のギャップを埋めます.
概要
MCP (Model Context Protocol) サーバは、Abstract Syntax Trees (AST) とAbstract Semantic Graphs (ASG) によるコード構造とセマンティック解析機能を提供します。 - コードからAbstract Syntax Trees (AST) - コードからAbstract Semantic Graphs(ASG)を生成 - コード構造と複雑性を分析 - 複数のプログラミング言語(Python、JavaScript、TypeScript、Go、Rust、C/C++、Java)のサポート - Claude Desktopや他のMCPクライアントと互換性のある - 大規模なファイルの高速処理のための包括的な解析 - スコープの処理を強化し、より完全なセマンティック分析 - リソースコードの変更を識別するためのリソースバージョンを向上 - パフォーマンスコードの変更を向上 - - Python 3.9 以上 - uv パッケージマネージャ (推奨) または pip 2. プロジェクトと依存関係をインストールします。 1。 設定ファイルを編集することにより、サーバーを使用するClaudeデスクトップの設定: - macOS:~/ Library/Application Support/claude-desktop/claude desktop config.json - Linux:~/.
概要(AI 翻訳)
MCP (Model Context Protocol) サーバは、Abstract Syntax Trees (AST) とAbstract Semantic Graphs (ASG) によるコード構造とセマンティック解析機能を提供します。
##特徴
- アブストラクト・シンタックス・ツリー(AST)にコードをパースする
- コードから抽象的なセマンティックグラフ(ASG)を生成
- コード構造と複雑性を分析
- 複数のプログラミング言語(Python、JavaScript、TypeScript、Go、Rust、C/C++、Java)のサポート
- Claudeデスクトップおよび他のMCPの顧客と互換性がある
- 大容量ファイルの処理を高速化するための包括的な解析
- スコープの処理を強化し、より完全なセマンティック分析
- コードバージョン間の変更を識別するASTの差分
- 改善された性能のための資源のキャッシュ
インストール
前提条件
- Python 3.9 以上
- uvパッケージマネージャ(推奨)またはピップ
uv の使用 (推奨)
-
このリポジトリをクローンする:
-
プロジェクトと依存関係をインストールします。
-
ツリー・シッターのパーサを造って下さい:
pip の使用 (代替)
Claudeデスクトップでの使用
1。 設定ファイルを編集することにより、サーバーを使用するClaudeデスクトップの設定:
設定ファイルの配置:
- macOS:
~/Library/Application Support/claude-desktop/claude_desktop_config.json
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
AST MCP Server
An MCP (Model Context Protocol) server that provides code structure and semantic analysis capabilities through Abstract Syntax Trees (AST) and Abstract Semantic Graphs (ASG).
Features
- Parse code into Abstract Syntax Trees (AST)
- Generate Abstract Semantic Graphs (ASG) from code
- Analyze code structure and complexity
- Support for multiple programming languages (Python, JavaScript, TypeScript, Go, Rust, C/C++, Java)
- Compatible with Claude Desktop and other MCP clients
- Incremental parsing for faster processing of large files
- Enhanced scope handling and more complete semantic analysis
- AST diffing to identify changes between code versions
- Resource caching for improved performance
Installation
Prerequisites
- Python 3.9 or higher
- uv package manager (recommended) or pip
Using uv (Recommended)
- Clone this repository:
git clone https://github.com/angrysky56/ast-mcp-server.git
cd ast-mcp-server
- Install the project and dependencies:
# Install the project in development mode with all dependencies
uv sync
# Or install with specific optional dependencies
uv sync --extra dev # Development tools
uv sync --extra testing # Testing dependencies
uv sync --extra docs # Documentation tools
- Build the tree-sitter parsers:
uv run build-parsers
Using pip (Alternative)
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e .
# Build parsers
python build_parsers.py
Usage with Claude Desktop
- Configure Claude Desktop to use the server by editing your configuration file:
Location of config file:
- macOS:
~/Library/Application Support/claude-desktop/claude_desktop_config.json - Linux:
~/.config/claude-desktop/claude_desktop_config.json - Windows:
%APPDATA%\claude-desktop\claude_desktop_config.json
- Add the AST MCP server configuration:
{
"mcpServers": {
"AstAnalyzer": {
"command": "uv",
"args": [
"--directory",
"/home/ty/Repositories/ai_workspace/ast-mcp-server/ast_mcp_server",
"run",
"server.py"
]
}
}
}
Important: Replace /absolute/path/to/ast-mcp-server with the actual absolute path on your system.
-
Restart Claude Desktop to load the new MCP server.
-
In Claude Desktop, you can now use the AST-based code analysis tools by referencing code files or pasting code snippets.
Development
Development Environment Setup
# Install with development dependencies
uv sync --extra dev
# Install pre-commit hooks (optional)
uv run pre-commit install
Running in Development Mode
To run the server in development mode with the MCP inspector:
# Using uv
uv run --extra dev -- -m mcp dev server.py
# Or using the development script
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"AstAnalyzer": {
"command": "uv",
"args": [
"--directory",
"/home/ty/Repositories/ai_workspace/ast-mcp-server/ast_mcp_server",
"run",
"server.py"
]
}
}
}