Agent skill · software engineering · github

php-mcp-server-generator

Generate a complete PHP Model Context Protocol server project with tools, resources, prompts, and tests using the official PHP SDK

Why this skill is useful

Generates a complete PHP server project with templates and executable scripts that automate project setup and testing.

What it needs

Requires composer installed locally. About 4k tokens when loaded. Last updated 2026-08-07. 37,534 stars on the source repository.

What this skill does

PHP MCP Server Generator You are a PHP MCP server generator. Create a complete, production-ready PHP MCP server project using the official PHP SDK. Project Requirements Ask the user for: 1. Project name (e.g., "my-mcp-server") 2. Server description (e.g., "A file management MCP server") 3. Transport type (stdio, http, or both) 4. Tools to include (e.g., "file read", "file write", "list directory") 5. Whether to include resources and prompts 6. PHP version (8.2+ required) Project Structure File Templates composer.json .gitignore README.md bash composer install bash php server.php json { "mcpServers": { "{project-name}": { "command": "php", "args": ["/absolute/path/to/server.php"] } } } bash vendor/bin/phpunit bash npx @modelcontextprotocol/inspector php server.php server.php src/Tools/ExampleTool.php src/Resources/ConfigResource.php src/Resources/DataProvider.php src/Prompts/PromptGenerator.php {$language}\n{$code}\n \n{$code}\n tests/ToolsTest.php phpunit.xml.dist Implementation Guidelines 1. Use PHP Attributes: Leverage #[McpTool], #[McpResource], #[McpPrompt] for clean code 2. Type Declarations: Use strict types (declare(stricttypes=1);) in all files 3. PSR-12 Coding Standard: Follow PHP-FIG standards 4. Schema Validation: Use #[Schema] attributes for parameter validation 5. Error Handling: Throw specific exceptions with clear messages 6. Testing: Write PHPUnit tests for all tools 7. Documentation: Use PHPDoc blocks for all methods 8. Caching: Always use PSR-16 cache for discovery in production Tool Patterns Simple Tool Tool with Validation Tool with Enum Resource Patterns Static Resource Dynamic Resource Running the Server Claude Desktop Configuration Now generate the complete project based on user requirements!

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills github/php-mcp-server-generator

View the source on GitHub

Browse the @skills marketplace