Skip to content

PHP MCPExpose your PHP application to AI agents, safely.

Framework-neutral MCP server runtime over the official mcp/sdk — with an OpenAPI bridge, Yii3 integration, and audit log, RBAC and telemetry bridges.

PHP MCP logo

The whole stack ​

AI agent (Claude Code, Claude Desktop, …)
      │  JSON-RPC over Streamable HTTP or stdio
      ▼
SharedSecretMiddleware  ── fail-closed shared-secret guard
      ▼
McpAction / McpServeCommand
      ▼
Mcp\Server\Server  ── built by McpServerFactory
      │
      ├─ your tool classes             (#[McpTool] methods, DI-resolved)
      ├─ OpenAPI-bridged operations    (OpenApiServerConfigurator)
      └─ interceptor chain
           budget → [tracing → audit → RBAC] → cache → size limit

The bracketed interceptors are the three bridges — nothing about them is special-cased in the core; each is an ordinary Interceptor\ToolCallInterceptorInterface.

Six packages ​

PackageWhat it is
rasuvaeff/mcpThe runtime, any framework
rasuvaeff/mcp-openapiOpenAPI operations as tools, any framework
rasuvaeff/yii3-mcpYii3 wiring
audit-log, RBAC, telemetry bridgesYii3 ecosystem
php
use Mcp\Server\Capability\Attribute\McpTool;

final readonly class OrderTools
{
    public function __construct(private OrderRepository $orders) {}

    #[McpTool(name: 'order.status')]
    public function status(string $orderId): string
    {
        return $this->orders->get($orderId)->status->value;
    }
}
php
use Rasuvaeff\Yii3McpRbacBridge\RequiredPermission;

#[McpTool(name: 'order.status')]
#[RequiredPermission('orders.view')]
public function status(string $orderId): string { /* … */ }
php
'rasuvaeff/yii3-mcp' => [
    'interceptors' => [AuditTrailInterceptor::class],
],
// every tools/call now writes an audit event: actor, tool, arguments,
// outcome, duration — masked, rethrown on failure
php
'rasuvaeff/yii3-mcp' => [
    'interceptors' => [
        TracingToolCallInterceptor::class,
        MetricsToolCallInterceptor::class,
    ],
],
// mcp.tool <name> span + mcp_tool_calls_total / mcp_tool_call_duration_seconds

See Bridges: overview for how they combine, and Getting started to wire the runtime on its own, or Yii3: getting started.