Back to Home
dalehurley icon

php-mcp-sdk

Verified Safe

by dalehurley

Overview

A PHP SDK for building Model Context Protocol (MCP) servers that expose AI capabilities (tools, prompts, sampling) and data resources to clients, facilitating AI agent orchestration and structured human-AI interaction.

Installation

Run Command
php examples/server/simple-server.php

Environment Variables

  • MCP_SERVER_HOST
  • MCP_SERVER_PORT
  • MCP_OAUTH_ISSUER_URL
  • MCP_OAUTH_CLIENT_ID
  • MCP_OAUTH_CLIENT_SECRET
  • MCP_TLS_CERT_PATH
  • MCP_TLS_KEY_PATH

Security Notes

The SDK demonstrates a strong focus on security, employing robust input validation using `InvalidArgumentException` and `JsonSchemaValidator`, structured error handling (`McpError`), and network security features in its transport layers (`allowedHosts`, `allowedOrigins`, `enableDnsRebindingProtection` for HTTP/WebSocket). The OAuth implementation includes client authentication, token verification, PKCE support (configurable for proxy scenarios), and metadata endpoints, showing a good understanding of OAuth best practices. While complex OAuth flows always carry inherent configuration risks, the SDK provides the necessary primitives to implement them securely. No `eval()` or direct code injection vulnerabilities were found. URI validation for `Root` objects also adds a layer of safety.

Similar Servers

Stats

Interest Score47
Security Score9
Cost ClassMedium
Avg Tokens2000
Stars24
Forks1
Last Update2025-11-25

Tags

PHPSDKModel Context ProtocolAI ServerAPIJSON-RPCToolsResourcesPromptsAsynchronousBackend