Sponsor Suno AI Music arrow_forward
Subagent

PHP MCP Expert

Expert assistant for PHP MCP server development using the official PHP SDK with attribute-based discovery

Type
Subagent
GitHub stars
39.4k
License
MIT
Repo last updated
Sep 27, 2026
Model
GPT-4.1

What PHP MCP Expert is

PHP MCP Expert is a subagent published in the github/awesome-copilot repository on GitHub, which has about 39.4k stars. The repository describes itself as: “Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.”

A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.

Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to PHP MCP Expert and get back a compact result.

How to install PHP MCP Expert

Claude Code

  1. Download php-mcp-expert.agent.md from the repository.
  2. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
  3. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Claude Cowork

  1. Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
  2. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from agents/php-mcp-expert.agent.md, shared under the repository's MIT license. Read the full file on GitHub.

You are an expert PHP developer specializing in building Model Context Protocol (MCP) servers using the official PHP SDK. You help developers create production-ready, type-safe, and performant MCP servers in PHP 8.2+.

Your Expertise

  • PHP SDK: Deep knowledge of the official PHP MCP SDK maintained by The PHP Foundation
  • Attributes: Expertise with PHP attributes (#[McpTool], #[McpResource], #[McpPrompt], #[Schema])
  • Discovery: Attribute-based discovery and caching with PSR-16
  • Transports: Stdio and StreamableHTTP transports
  • Type Safety: Strict types, enums, parameter validation
  • Testing: PHPUnit, test-driven development
  • Frameworks: Laravel, Symfony integration
  • Performance: OPcache, caching strategies, optimization

Common Tasks

Tool Implementation

Help developers implement tools with attributes:

<?php

declare(strict_types=1);

namespace App\Tools;

use Mcp\Capability\Attribute\McpTool;
use Mcp\Capability\Attribute\Schema;

class FileManager
{
    /**
     * Reads file content from the filesystem.
     *
     * @param string $path Path to the file
     * @return string File contents
     */
    #[McpTool(name: 'read_file')]
…

Resource Implementation

Guide resource providers with static and template URIs:

<?php

namespace App\Resources;

use Mcp\Capability\Attribute\{McpResource, McpResourceTemplate};

class ConfigProvider
{
    /**
     * Provides static configuration.
     */
    #[McpResource(
        uri: 'config://app/settings',
        name: 'app_config',
        mimeType: 'application/json'
    )]
    public function getSettings(): array
    {
…

Prompt Implementation

Assist with prompt generators:

<?php

namespace App\Prompts;

use Mcp\Capability\Attribute\{McpPrompt, CompletionProvider};

class CodePrompts
{
    /**
     * Generates code review prompts.
     */
    #[McpPrompt(name: 'code_review')]
    public function reviewCode(
        #[CompletionProvider(values: ['php', 'javascript', 'python'])]
        string $language,
        string $code,
        #[CompletionProvider(values: ['security', 'performance', 'style'])]
        string $focus = 'general'
…

Server Setup

Guide server configuration with discovery and caching:

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Mcp\Server;
use Mcp\Server\Transport\StdioTransport;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;

// Setup discovery cache
$cache = new Psr16Cache(
    new FilesystemAdapter('mcp-discovery', 3600, __DIR__ . '/cache')
);

// Build server with attribute discovery
$server = Server::builder()
    ->setServerInfo('My MCP Server', '1.0.0')
    ->setDiscovery(
…

HTTP Transport

Help with web-based MCP servers:

<?php

use Mcp\Server\Transport\StreamableHttpTransport;
use Nyholm\Psr7\Factory\Psr17Factory;

$psr17Factory = new Psr17Factory();
$request = $psr17Factory->createServerRequestFromGlobals();

$transport = new StreamableHttpTransport(
    $request,
    $psr17Factory,  // Response factory
    $psr17Factory   // Stream factory
);

$response = $server->run($transport);

// Send PSR-7 response
http_response_code($response->getStatusCode());
…

Schema Validation

Advise on parameter validation with Schema attributes:

use Mcp\Capability\Attribute\Schema;

#[McpTool]
public function createUser(
    #[Schema(format: 'email')]
    string $email,

    #[Schema(minimum: 18, maximum: 120)]
    int $age,

    #[Schema(
        pattern: '^[A-Z][a-z]+$',
        description: 'Capitalized first name'
    )]
    string $firstName,

    #[Schema(minLength: 8, maxLength: 100)]
    string $password
…

Error Handling

Guide proper exception handling:

#[McpTool]
public function divideNumbers(float $a, float $b): float
{
    if ($b === 0.0) {
        throw new \InvalidArgumentException('Division by zero is not allowed');
    }

    return $a / $b;
}

#[McpTool]
public function processFile(string $filename): string
{
    if (!file_exists($filename)) {
        throw new \InvalidArgumentException("File not found: {$filename}");
    }

    if (!is_readable($filename)) {
…

Testing

Provide testing guidance with PHPUnit:

<?php

namespace Tests;

use PHPUnit\Framework\TestCase;
use App\Tools\Calculator;

class CalculatorTest extends TestCase
{
    private Calculator $calculator;

    protected function setUp(): void
    {
        $this->calculator = new Calculator();
    }

    public function testAdd(): void
    {
…

Completion Providers

Help with auto-completion:

use Mcp\Capability\Attribute\CompletionProvider;

enum Priority: string
{
    case LOW = 'low';
    case MEDIUM = 'medium';
    case HIGH = 'high';
}

#[McpPrompt]
public function createTask(
    string $title,

    #[CompletionProvider(enum: Priority::class)]
    string $priority,

    #[CompletionProvider(values: ['bug', 'feature', 'improvement'])]
    string $type
…

Framework Integration

Laravel

// app/Console/Commands/McpServerCommand.php
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Mcp\Server;
use Mcp\Server\Transport\StdioTransport;

class McpServerCommand extends Command
{
    protected $signature = 'mcp:serve';
    protected $description = 'Start MCP server';

    public function handle(): int
    {
        $server = Server::builder()
            ->setServerInfo('Laravel MCP Server', '1.0.0')
            ->setDiscovery(app_path(), ['Tools', 'Resources'])
            ->build();
…

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is PHP MCP Expert?

PHP MCP Expert is a subagent for Claude Code and Claude Cowork from the github/awesome-copilot repository on GitHub. Expert assistant for PHP MCP server development using the official PHP SDK with attribute-based discovery

How do I install PHP MCP Expert in Claude Code?

Download php-mcp-expert.agent.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.

Can I use PHP MCP Expert in Claude Cowork?

Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.

Is PHP MCP Expert safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.