PHP MCP Server
基于 PHP 实现的 MCP (Model Control Protocol) 服务器框架,通过注解优雅地定义 MCP 服务,支持 Tool、Prompt、Resource 三种处理器,支持Stdio、Sse 两种 transport。
Overview
PHP MCP Server is a sample project that implements a Model Control Protocol (MCP) server using PHP, providing a complete server implementation with various features.
To use PHP MCP Server, you can either install it locally by cloning the repository and running the server, or you can use Docker to build and run the server container.
- Prompt processor for handling prompt templates - Tool processor for executing simple operations like addition - Resource processor for accessing and reading resources - Complete logging system - Docker support for easy deployment
- Building applications that require a backend MCP server.
- Developing tools that utilize prompt and resource processing.
- Testing and experimenting with MCP functionalities in a controlled environment.
Add to your AI client
Use these steps to connect PHP MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"php-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-php-mcp-server-he426100"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"php-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-php-mcp-server-he426100"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"php-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-php-mcp-server-he426100"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"php-mcp-server-he426100": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-php-mcp-server-he426100"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"php-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-php-mcp-server-he426100"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"php-mcp-server-he426100": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-php-mcp-server-he426100"
]
}
}
}FAQ
What are the system requirements for PHP MCP Server?
PHP >= 8.1 and Composer are required, Docker is optional.
How can I install PHP MCP Server?
You can install it locally or via Docker as described in the installation section.
Is there any logging feature?
Yes, the server includes a complete logging system that can be configured.