phpustik MCP Server
Auto-detects CakePHP projects and provides integration with its console commands for project management and diagnostics.
Auto-detects CodeIgniter projects and enables integration with CodeIgniter's tools for routing and project management.
Manages Composer dependencies including validation, security audit, package installation, and updates.
Runs Laravel artisan commands, lists routes, and provides framework-aware static analysis and security scanning.
Runs Symfony console commands, detects Symfony projects, and integrates with Symfony's ecosystem for code analysis.
Auto-detects WordPress projects and applies specialized security and code quality scans tailored for WordPress.
Auto-detects Yii projects and provides integration with Yii's console tools for project management.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@phpustik MCP Serverrun PHPStan level 5 on the src directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🐘 phpustik — MCP Server for PHP
AI'nin PHP gözü, kulağı ve eli olacak.
MCP Sunucusu · Tek npx ile AI asistanınıza PHP runtime, statik analiz, güvenlik taraması, test koşucusu, Composer ve framework entegrasyonu kazandırır.
🏷️ MCP Server | PHP Tools | AI Integration | Static Analysis | Composer | Laravel | Symfony
"The bridge between AI assistants and the PHP ecosystem."
Production-grade MCP server that gives AI assistants deep visibility into the entire PHP ecosystem — runtime, linting, static analysis, security, testing, Composer and framework tools.
Works with Claude Desktop, Cursor, Claude Code, Opencode, Cline and any MCP-compatible client.
A Model Context Protocol server for PHP — written in TypeScript, shipped as a single
npx-able package, battle-tested on Windows, macOS and Linux.
🎯 Vision: Make every AI assistant a PHP expert — no Config, no Setup, justnpx phpustik.
Features · Installation · Usage · Tools · Resources · Prompts · Integrations
📑 Table of contents
Related MCP server: symfony-php-mcp
💡 Why phpustik?
AI assistants like Cursor, Claude Desktop, Claude Code and Opencode are increasingly good at writing PHP, but they remain blind to the runtime they target:
They don't know which PHP version is installed.
They cannot run
php -lto catch a missing semicolon.They cannot invoke PHPStan, Psalm, PHP-CS-Fixer, PHPUnit, Rector, PHPMD, PHPCS…
They cannot manage Composer packages, audit security, or detect the framework.
They cannot run Laravel artisan or Symfony console commands.
phpustik closes that gap. It is a self-contained MCP server that exposes 31 tools, 8 resources and 7 prompts to the model — across runtime, static analysis, security, testing, refactoring, dependency management and framework integration.
It is:
Production-ready — strict TypeScript, no
any, exhaustive error handling, structured logs.Cross-platform — Windows, macOS, Linux, WSL. Path handling is normalised centrally.
Safe by default —
execFile(no shell), deterministic timeouts, output capping,isError: trueon every failure.Honest — if a binary is missing, the model is told exactly which command to run.
📦 What's inside
Category | Count | Examples |
🛠 Tools | 33 |
|
📚 Resources | 8 |
|
💬 Prompts | 7 |
|
🧰 PHP tools wired | 11 | PHP, Composer, PHPStan, Psalm, PHPMD, PHPCS, PHPMND, Rector, PHP Insights, PHPCPD, PHPUnit |
🚀 Killer features | 2 |
|
📡 MCP v2 features | 3 | Logging notifications, progress reporting, cancellation |
✨ Features
Area | What you get |
MCP protocol | Implements |
Transport |
|
Validation | Zod v4 input validation on every tool — invalid calls are rejected before any IO. |
MCP logging | Real-time |
Progress |
|
Cancellation | AbortSignal-aware; long ops are tracked and can be killed if the user cancels. |
Structured output |
|
Error UX | Friendly, actionable messages for missing binaries, timeouts, permission errors. |
Cross-platform | POSIX, Windows, UNC, WSL, |
Security | No |
Observability | Stderr-only logger with |
Workspace-aware | Auto-detects project root from |
Framework-aware | Auto-detects Laravel, Symfony, WordPress, CodeIgniter, Yii, Slim, Laminas, Phalcon, CakePHP. |
Caching | TTL cache for expensive ops (composer info, phpstan, audits) — 60 s default. |
Distribution |
|
CI / Release | GitHub Actions matrix (3 OS × 3 Node versions), |
🩺 Killer features
phpustik_doctor — one-shot health check
A single tool call that runs the entire PHP quality pipeline and produces a prioritised Markdown + JSON report.
{
"tool": "phpustik_doctor",
"arguments": {
"category": "all",
"failOn": "high",
"skipTests": false,
"fix": false,
"json": false
}
}Runs
composer validate,composer audit,analyze_php_code,run_phpcs,run_phpmd,run_phpunit,scan_secrets,scan_vulnerable_functions,scan_sql_injection,scan_xss,check_php_compatibility,suggest_refactoring,get_php_ini,detect_framework,get_php_info— in order, with progress notifications.Returns a unified Markdown report plus a typed
DoctorReportstructured content (overall status, per-check severity, fixable count, recommendations).failOnlets the model or CI fail at a configurable severity threshold.json: truemode for CI pipelines (returns only the structured content).category: security|quality|styleto run a targeted subset.
phpustik_init — project bootstrap
Generates optimal config files for a PHP project, tailored to its framework and PHP version.
{
"tool": "phpustik_init",
"arguments": {
"dryRun": true,
"force": false,
"phpstanLevel": "5",
"psalmLevel": "4",
"phpVersions": "8.1,8.2,8.3,8.4"
}
}Detects
composer.json,composer.lock, framework, PHP version.Generates up to 11 config files:
phpstan.neon,psalm.xml,.php-cs-fixer.php,rector.php,phpmd.xml,phpcs.xml,phpunit.xml,.editorconfig,.gitattributes,.github/workflows/ci.yml,bin/pre-commit.All templates hand-tuned for low false-positive rate, modern PHP, PSR-12 + strict types.
dryRun: true(default) shows a unified diff without touching disk.force: trueoverwrites existing files; default is "keep what's there".only: "phpstan.neon,phpunit.xml"restricts to a subset.
🏗 Architecture
┌──────────────────────┐ JSON-RPC over stdio ┌────────────────────────────────────────┐
│ MCP client │ ◀────────────────────▶ │ phpustik server │
│ (Cursor / Claude / │ │ (TypeScript, ESM) │
│ Opencode / Cline) │ │ │
└──────────────────────┘ │ 33 tools │ 8 resources │ 7 prompts │
└──────────────────┬─────────────────────┘
│
┌──────────────────────────┬────────────────────────────┬──┴─────────────────────────────┐
│ │ │ │
▼ ▼ ▼ ▼
┌────────┐ ┌────────┐ ┌────────────┐ ┌────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐
│ php │ │ composer│ │ phpstan / │ │ phpcs / │ │ rector / │ │ laravel / │ │ pattern │
│ -v -m │ │ * │ │ psalm / │ │ phpmd / │ │ insights / │ │ symfony │ │ scanner │
│ -l -i │ │ │ │ phpmnd │ │ phpcpd │ │ phpcpd │ │ console │ │ (secrets, │
│ -r │ │ │ │ │ │ │ │ │ │ │ │ SQLi, XSS) │
└────────┘ └────────┘ └────────────┘ └────────────┘ └──────────────┘ └──────────────┘ └─────────────┘Source layout
src/
├── index.ts # entry point
├── server.ts # bootstrap (tools + resources + prompts)
├── constants.ts # binary names, install hints, timeouts
├── prompts.ts # 7 MCP prompts
├── resources.ts # 8 MCP resources
├── tools/
│ ├── get-php-info.ts
│ ├── lint-php-file.ts
│ ├── analyze-php-code.ts
│ ├── format-php-code.ts
│ ├── run-php-script.ts
│ ├── show-opcache-status.ts
│ ├── get-extension-info.ts
│ ├── get-php-ini.ts
│ ├── check-php-compatibility.ts
│ ├── run-phpunit.ts
│ ├── run-psalm.ts
│ ├── run-phpmd.ts
│ ├── run-phpcs.ts
│ ├── run-phpmnd.ts
│ ├── run-phpcpd.ts
│ ├── run-phpinsights.ts
│ ├── run-rector.ts
│ ├── composer.ts # 9 composer_* tools
│ ├── scan-security.ts # 4 scan_* tools
│ ├── codegen.ts # add_strict_types, generate_phpdoc, suggest_refactoring
│ ├── framework.ts # detect + Laravel + Symfony tools
│ ├── doctor.ts # phpustik_doctor
│ └── init.ts # phpustik_init
└── utils/
├── executor.ts # execFile wrapper, no shell, timeouts
├── paths.ts # cross-platform path normalisation
├── logger.ts # stderr-only structured logger
├── responses.ts # uniform MCP tool responses
├── workspace.ts # project root auto-detection
├── framework-detector.ts
├── patterns.ts # secrets / SQLi / XSS / vuln-func catalogues
├── scan-runner.ts # pattern-scan engine
├── file-scanner.ts # FS walker with skips
├── cache.ts # TTL cache
├── active-ops.ts # AbortController registry for cancellation
├── notification-sink.ts # MCP logging/progress bridge
└── config-templates.ts # init tool generators✅ Prerequisites
Software | Minimum | Required for |
Node.js | 20.0 LTS | Running the MCP server |
npm | 10 (bundled) | Package manager (or |
PHP | 8.0+ | All PHP-runtime tools |
Composer | 2.x |
|
PHPUnit | 10+ |
|
PHPStan | 1.x or 2.x |
|
Psalm | 5+ |
|
PHPMD | 2.x |
|
PHPCS | 3.x |
|
PHPMND | 3.x |
|
Rector | 1.x |
|
PHP Insights | 2.x |
|
PHPCPD | 6+ |
|
PHP-CS-Fixer | 3.x |
|
All of these are optional — phpustik will tell you which to install when a tool needs a missing binary.
Quick check
node -v # v20 or higher
php -v # PHP 8.0 or higher
composer --version🛠 Installation
1. Install PHP
OS | Command |
macOS |
|
Ubuntu/Zorin |
|
Fedora |
|
Alpine |
|
Windows | Download from https://windows.php.net/download/ or |
2. Install Composer
# macOS / Linux / WSL
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Windows (PowerShell)
Invoke-WebRequest https://getcomposer.org/installer -OutFile composer-setup.php
php composer-setup.php
Move-Item composer.phar C:\Program Files\composer\composer.exe3. Install all PHP tools (optional but recommended)
composer global require \
phpstan/phpstan \
vimeo/psalm \
phpmd/phpmd \
squizlabs/php_codesniffer \
povils/phpmnd \
sebastianbergmann/phpcpd \
nunomaduro/phpinsights \
rector/rector \
friendsofphp/php-cs-fixer \
phpcompatibility/php-compatibilityMake sure ~/.composer/vendor/bin (Linux/macOS) or %USERPROFILE%\Composer\vendor\bin (Windows) is on your PATH.
4. Install phpustik
# Option A: run on demand
npx -y phpustik
# Option B: install globally
npm install -g phpustik
phpustik🚀 Usage
Quick start with npx
npx -y phpustikYou'll see on stderr:
[INFO] server.boot {"name":"phpustik","version":"1.0.0"}
[INFO] server.php_detected {"version":"PHP 8.3.6 (cli)"}
[INFO] server.ready {"transport":"stdio"}Local development
git clone https://github.com/halitartuc/phpustik.git
cd phpustik
npm install
npm run dev # tsx, no buildInspect with the MCP Inspector
npm run inspectThis opens a local web UI where you can call every tool by hand.
🛠 Tools (33)
All tools accept JSON Schema (Zod-validated) input and return MCP text content (and, where useful, a typed structuredContent companion). Tools marked ⚠️ are destructive (they modify the filesystem). Tools marked 🔒 require project-level configuration.
🔍 PHP Runtime & Environment (5)
Tool | Purpose |
| PHP sürümü, modüller, INI. |
| OPcache + JIT (PHP 8+) durumu. |
| Tek bir eklentinin fonksiyon/sabit/INI detayı. |
| Aktif php.ini, tarama dizini, direktifler. |
| PHPCompatibility ile hedef PHP sürüm denetimi. |
🧪 Linting, Formatting & Syntax (4)
Tool | Purpose |
|
|
| PHP_CodeSniffer (PSR12, Squiz, vb.). |
| PHP-CS-Fixer (PSR-12) — dry-run veya apply. |
| Dosyaya |
📐 Static Analysis (6)
Tool | Purpose |
| PHPStan seviye 0–max. |
| Psalm seviye 1–8. |
| Mess Detector (karmaşıklık, unused code, design). |
| Magic number tespiti. |
| Copy-paste tespiti. |
| Genel kod kalite skoru (Code / Architecture / Style / Complexity). |
🛠 Refactoring & Codegen (3)
Tool | Purpose |
| Otomatik refactoring — |
| Eksik PHPDoc bloklarını raporlar. |
| Uzun metod, god class, derin nesting heuristik önerileri. |
▶️ Execution & Testing (2)
Tool | Purpose |
| İzole temp dosyada PHP kodu çalıştır. ⚠️ |
| PHPUnit testleri (filter, testdox, coverage). |
📦 Composer (9)
Tool | Purpose |
| Yüklü paketler / belirli paket bilgisi. |
|
|
| Bilinen CVE taraması. |
| Güncellenmesi gereken paketler. |
| Paket ekle. ⚠️ |
| Paket kaldır. ⚠️ |
|
|
|
|
|
|
🔐 Security (4)
Tool | Purpose |
| Hardcoded API key, private key, token, basic-auth URL. |
|
|
| Query string concatenation, |
| Unescaped |
🏗 Framework Integration (7)
Tool | Purpose |
| Laravel / Symfony / WordPress / … otomatik tespit. |
|
|
| Tüm route'lar (method, uri, name, action, middleware). |
|
|
|
|
|
|
🚀 Meta-tools (2)
Tool | Purpose |
| Tek çağrıda tüm kalite/güvenlik/test kontrollerini çalıştırır, priorize rapor döner. |
| PHPStan / Psalm / Rector / phpcs / phpunit / .editorconfig / .gitattributes / CI workflow üretir. |
📚 Resources (8)
Resources are server-side data the model can read on demand to enrich its context. No parameters required.
URI | MIME | Description |
|
| Aktif proje özeti (root, config dosyaları). |
|
| composer.json içeriği. |
|
| composer.json |
|
|
|
|
| Tespit edilen framework + sürüm. |
|
|
|
|
|
|
|
| Sistem + proje INI dosyaları. |
💬 Prompts (7)
Prompts are pre-baked, parameterised workflows the model can invoke.
Prompt | Arguments | Purpose |
|
| PSR-12, güvenlik ve performans review. |
|
| Satır satır kod açıklaması. |
|
| Somut refactoring önerileri + değişiklik örnekleri. |
|
| PHPUnit testi üret. |
|
| Pest testi üret. |
|
| 4'lü güvenlik taraması başlat. |
|
| PHP sürüm yükseltme yol haritası. |
🔌 Integrations
The server speaks stdio MCP — any client that supports MCP can use it.
Cursor
Settings → MCP → + Add new global MCP server:
{
"mcpServers": {
"phpustik": {
"command": "npx",
"args": ["-y", "phpustik"]
}
}
}Claude Desktop
Edit claude_desktop_config.json:
{
"mcpServers": {
"phpustik": {
"command": "npx",
"args": ["-y", "phpustik"]
}
}
}Claude Code (CLI)
claude mcp add phpustik -- npx -y phpustik
claude mcp listOpencode
~/.config/opencode/mcp.json:
{
"mcpServers": {
"phpustik": {
"command": "npx",
"args": ["-y", "phpustik"]
}
}
}Cline / Continue.dev
.vscode/cline_mcp_settings.json:
{
"mcpServers": {
"phpustik": { "command": "npx", "args": ["-y", "phpustik"] }
}
}⚙️ Configuration
All via env vars. Everything has a sensible default.
Variable | Default | Description |
|
|
|
|
| Tool result cache TTL (ms). |
|
| Default command timeout. |
|
| Override PHPStan binary path. |
|
| Override Psalm binary path. |
|
| Override PHPCS binary path. |
| — | The system PATH is used to find every PHP tool. |
🧯 Troubleshooting
Common issues & fixes:
Make sure the MCP client config is valid JSON. Trailing commas break it.
Restart the MCP client after editing the config.
Run the server manually:
npx -y phpustik. If it crashes, the issue is server-side.
composer global require phpstan/phpstanMake sure ~/.composer/vendor/bin is on your PATH. Restart the terminal and the MCP client.
Add C:\php to Path in System Environment Variables, then restart the terminal and the MCP client.
The server sends logs to stderr and protocol frames to stdout. If your client shows nothing, set PHPUSTIK_LOG_LEVEL=debug and check its log panel.
npm install @cfworker/json-schemaIt's a peer dep of the MCP SDK v2 alpha.
🔒 Security
No
shell: true. Every command runs throughexecFile— arguments are never parsed as shell.Every tool input goes through Zod validation before any IO.
File-system access is read-only by default. Destructive tools are clearly marked ⚠️.
Output buffers are capped at 1 MiB per stream.
File contents are never logged — only paths and metadata.
Please report security issues privately — see SECURITY.md.
🗺 Roadmap
php -Smanaged dev server toolphpdbginteractive debuggingphp -dini override previewDocker image:
phpustik/phpustik:latestwith every tool pre-installedHTTP/SSE transport for remote deployments
VS Code extension proxy
GitHub Actions annotation output for CI integration
🤝 Contributing
See CONTRIBUTING.md. Run npm run lint && npm run typecheck && npm run build before opening a PR.
📄 License
MIT — © 2024-2026 phpustik contributors.
🙏 Acknowledgements
The Model Context Protocol team for the spec and SDK.
PHPStan, Psalm, PHPMD, PHPCS, Rector, PHP Insights and PHP-CS-Fixer — every PHP tool that makes this server possible.
Composer for dependency management.
Everyone who ⭐️s, opens issues or sends PRs.
Made with ❤️ for the PHP + AI community.
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
- AlicenseAqualityDmaintenanceConnects AI assistants like Claude to PHP's XDebug debugger for runtime inspection, breakpoint control, and variable tracking, enabling natural language debugging of PHP applications.Last updated61Apache 2.0
- AlicenseAqualityCmaintenanceA production-ready Model Context Protocol (MCP) server that bridges your Symfony/PHP project with LLMs such as Claude. It exposes tools that let the AI read your project's routes, services, Twig templates, and PHP source code.Last updated8MIT
- Alicense-qualityCmaintenanceConnects Claude or any MCP client to Laravel Herd, providing 218 tools to manage PHP development environments, Laravel projects, sites, services, database, and more through natural language.Last updated1MIT
- FlicenseAqualityDmaintenanceAn MCP server that lets AI agents run PHP unit and integration tests inside Docker containers without local PHP or Composer.Last updated29
Related MCP Connectors
Package intelligence MCP for AI agents — 22 tools, 19 ecosystems, AGPL SDK, free.
Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.
Free public MCP for AI agents — 193 tools, 44 workflows. No API key.
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/halitartuc/phpustik'
If you have feedback or need assistance with the MCP directory API, please join our Discord server