php-ast
MCP (Model Context Protocol) local server for PHP AST (Abstract Syntax Tree) analysis and visualization
claude mcp add --transport stdio nayte91-php-ast-mcp-server docker run -i nayte91/php-ast-mcp-server:latest
How to use
This MCP server exposes PHP AST analysis capabilities. It parses PHP source code into an Abstract Syntax Tree using the php-ast extension, analyzes code structure (classes, methods, functions, properties), and outputs JSON compatible with MCP clients. The server is designed to be run locally via Docker. You can feed it a PHP project directory and receive structured data about the codebase, with options to filter by visibility (public only or all) as described in the README. Use it to understand code organization, generate tooling data, or power code intelligence features in your MCP workflow.
How to install
Prerequisites:
- Docker installed and running
- Git (optional, for cloning the repository)
Installation steps:
- Pull or build the Docker image for the MCP server. If using the published image name from the README slug, you can pull directly: docker pull nayte91/php-ast-mcp-server:latest
- Run the server for local development. The server is configured to start serving PHP AST analysis via the container: docker run -p 8080:8080 -i nayte91/php-ast-mcp-server:latest
- If you prefer building from source, clone the repository and build the image according to the repository's Dockerfile instructions, then run as above.
- Verify the server is responsive by hitting the MCP endpoint from a client, for example via curl or your MCP tooling, and ensure you receive JSON output.
Notes:
- Ensure the php-ast PHP extension is available inside the container (as per the repository's Containerfile).
- The server serves locally; use localhost and the appropriate port configured by the container.
Additional notes
Tips and common issues:
- If you see token usage mismatches, verify that you’re using the public-only or all-visibility options as described in the README when requesting AST output.
- The Docker image name in use is nayte91/php-ast-mcp-server:latest; replace with a specific tag if needed.
- Ensure your MCP client configurations point to the server’s endpoint and expect JSON in the same structure as MCP standard outputs.
- For large PHP codebases, consider running the analysis on directories recursively and streaming results to the client to avoid heavy memory usage.
Related MCP Servers
drift
Codebase intelligence for AI. Detects patterns & conventions + remembers decisions across sessions. MCP server for any IDE. Offline CLI.
laravel
A Laravel package for implementing secure Model Context Protocol servers using Streamable HTTP and SSE transport, providing real-time communication and a scalable tool system for enterprise environments.
php
基于 PHP 实现的 MCP (Model Control Protocol) 服务器框架,通过注解优雅地定义 MCP 服务,支持 Tool、Prompt、Resource 三种处理器,支持Stdio、Sse 两种 transport。
mcp-profiler-bundle
The Symfony MCP Profiler Bundle mimics the WebProfiler Bundle. It bridges the gap between Profiler data and your favorite MCP-enabled AI-powered IDE.
elementor
Comprehensive Elementor MCP Server plugin.
mcp
Model Context Protocol for Hyperf