code-ast-mcp
Code AST MCP Server (code-ast-mcp)
code-ast-mcp ist ein Architektur-MCP-Server (Model Context Protocol), der mit Pythons nativem Abstract-Syntax-Tree-Parser (ast) erstellt wurde. Er ermöglicht KI-Modellen (in Claude Desktop, Cursor, Antigravity oder benutzerdefinierten MCP-Clients), lokale Python-Codebasisstrukturen zu analysieren, Symboldefinitionen zu suchen, Abhängigkeitsgraphen zu erstellen, die Docstring-Abdeckung zu prüfen und Code umzugestalten, ohne vollständige rohe Quelldateien in die LLM-Kontextfenster zu laden.
🔗 Live-Repository: https://github.com/m-sameerkhan/code-ast-mcp
🔗 Smithery Registry: https://smithery.ai/servers/sameerbalouch758/code-ast-mcp
⚡ Funktionen & Fähigkeiten
🛠️ Tools
analyze_file_ast(file_path: str)Parst eine
.py-Datei in eine saubere AST-Gliederung.Extrahiert Modul-Docstrings, Zeilenzahlen, Importe, Funktionen auf oberster Ebene, Klassen, Methoden und Variablen.
find_class_methods(file_path: str, class_name: str)Lokalisiert eine bestimmte Klasse und gibt Methodensignaturen, Typannotationen, Zeilenbereiche und Docstrings zurück.
find_symbol(target_dir: str, symbol_name: str)Durchsucht ein Verzeichnis rekursiv nach Klassen, Funktionen, Methoden oder Variablenzuweisungen, die mit
symbol_nameübereinstimmen.
get_imports_graph(target_dir: str)Scannt Python-Dateien, um eine Abhängigkeits-Importkarte zu erstellen, und gibt einen Mermaid-Diagramm-String aus.
find_missing_docstrings(target_dir: str, include_private: bool = False)Prüft die Docstrings der Codebasis und berechnet die gesamte Docstring-Abdeckung in Prozent.
📝 Prompts
refactor_code_summary(file_path: str)Erzeugt einen strukturierten Prompt, der das LLM anweist, die AST-Gliederung einer Datei zu überprüfen und Refactoring, Verbesserungen von Entwurfsmustern und Dokumentationskorrekturen vorzuschlagen.
📊 Ressourcen
codeast://statsLive-JSON-Ressource, die Arbeitsbereichsstatistiken bereitstellt (gescannte Dateien insgesamt, Docstring-Abdeckung in %, Anzahl fehlender Elemente).
Related MCP server: codeweave-mcp
🚀 Schnellstart & Installation
Option 1: Installation über die Smithery-CLI
smithery mcp add sameerbalouch758/code-ast-mcpOption 2: Lokale Installation aus dem Quellcode
Klonen Sie das Repository und installieren Sie die Abhängigkeiten im Editable-Modus:
git clone https://github.com/m-sameerkhan/code-ast-mcp.git
cd code-ast-mcp
# Create & activate virtual environment (or Conda)
python -m venv .venv
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
# Install project and dependencies
pip install -r requirements.txt
pip install -e .Option 3: Als MCP-Bundle (.mcpb) paketieren
Für Desktop-Clients, die MCP-Bundles unterstützen (z. B. Claude Desktop):
# Install MCPB toolchain
npm install -g @anthropic-ai/mcpb
# Build bundle
mcpb pack . code-ast-mcp.mcpb🧪 Lokales Testen
Unit-Tests ausführen
pytestMit dem MCP Inspector testen
Verwenden Sie den offiziellen MCP Inspector, um Tools und Ressourcen interaktiv zu testen:
npx @modelcontextprotocol/inspector python -m code_ast_mcp.server⚙️ Client-Konfiguration
Integration in Claude Desktop / Cursor / Antigravity
Fügen Sie code-ast-mcp zu Ihrer Client-Konfigurationsdatei hinzu (claude_desktop_config.json oder mcp_config.json):
{
"mcpServers": {
"code-ast-mcp": {
"command": "python",
"args": [
"-m",
"code_ast_mcp.server"
],
"cwd": "/path/to/code-ast-mcp"
}
}
}Hinweis für Windows-Benutzer: Sie können "command" auf den Pfad Ihrer virtuellen Umgebung oder den Conda-Python-Pfad einstellen (z. B. C:/Users/<Username>/.conda/envs/code-ast-mcp/python.exe oder D:/my_mcp/.venv/Scripts/python.exe).
📦 Projektstruktur
code-ast-mcp/
├── code_ast_mcp/ # Core package
│ ├── __init__.py # Package exports
│ ├── analyzer.py # Python AST parsing & static analysis engine
│ └── server.py # FastMCP server definition & tool handlers
├── tests/ # Test suite
│ └── test_analyzer.py # Unit tests with pytest
├── manifest.json # MCPB extension manifest
├── smithery.yaml # Smithery registry configuration
├── Dockerfile # Container image definition
├── pyproject.toml # Packaging & metadata
└── requirements.txt # Dependencies📄 Lizenz
MIT-Lizenz. Erstellt von m-sameerkhan.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBqualityDmaintenanceAn MCP server that enables LLMs to understand and analyze code structure through function call graphs, allowing AI assistants to explore relationships between functions and analyze dependencies in Python repositories.618
- Alicense-qualityCmaintenanceAn MCP server that gives AI agents structured code understanding and precise code intelligence via local indexing of AST, call graphs, and semantic search.1084Apache 2.0
- -license-quality-maintenanceAn advanced MCP server that provides deep code understanding and analysis using GraphRAG, AST parsing, and semantic memory, enabling AI agents to query and interact with complex codebases.
- Alicense-qualityCmaintenanceUniversal MCP server that analyzes any codebase and provides structured context to AI assistants. Dynamic, accurate, and token-efficient.19MIT
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Hosted MCP server for structured code review passes on human- and AI-written code. Free tier.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/m-sameerkhan/code-ast-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server