Download the PHP package fastmcphp/fastmcphp without Composer
On this page you can find all versions of the php package fastmcphp/fastmcphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package fastmcphp
Fastmcphp
NOTE:
- sse is deprecated according to anthropic: https://code.claude.com/docs/en/mcp#option-2%3A-add-a-remote-sse-server
- use http instead
A PHP 8.2+ implementation of the Model Context Protocol (MCP).
Inspired by FastMCP for Python.
Requirements
- PHP 8.2+
- Swoole 5.0+ or OpenSwoole 4.0+ (optional, recommended for production HTTP/SSE)
Installation
Quick Start
Features
Tools
Define callable functions that can be invoked by MCP clients:
Resources
Expose data via URI-based resources:
Prompts
Define reusable prompt templates:
Transports
Three transport modes are supported:
The HTTP transport automatically detects whether Swoole/OpenSwoole is installed. With Swoole, it runs a high-performance async server with multiple workers. Without Swoole, it uses ReactPHP's event-loop-based HTTP server (async, single-process). Swoole is recommended for production deployments.
Authentication
Implement custom authentication providers for bearer tokens, API keys, or any auth system:
AuthRequest
AuthRequest is the abstraction layer between transports and authentication. It normalizes request data from any transport (Swoole HTTP, built-in PHP HTTP, SSE) so auth providers don't need to know transport details.
Token extraction — use getToken() for automatic priority-based lookup:
X-API-TOKENheader (viagetApiToken())Authorization: Bearer <token>header (viagetBearerToken())?key=<token>query parameter (viagetApiKeyFromQuery())
Available methods:
| Method | Description |
|---|---|
getToken() |
Get token from any source (priority order above) |
getHeader(string $name) |
Get any header value (case-insensitive) |
getBearerToken() |
Extract token from Authorization: Bearer header |
getApiToken() |
Get X-API-TOKEN header value |
getApiKeyFromQuery(string $param = 'key') |
Get token from query parameter |
getQuery(string $key) |
Get any query parameter |
Sending tokens from clients:
Per-Tool Authorization
Control access to individual tools, resources, or prompts:
Middleware
Intercept and modify requests/responses:
Multi-Tenant Workspace Support
Fastmcphp supports multi-tenant architectures through the authentication system:
Usage with Claude Code
Add your MCP server to .mcp.json in your project root (or ~/.claude/.mcp.json for global access):
Stdio transport (subprocess — Claude Code manages the process):
HTTP transport (remote — start the server separately):
HTTP with authentication:
Testing
MCP Protocol Support
| Feature | Status |
|---|---|
| Tools | ✅ |
| Resources | ✅ |
| Resource Templates | ✅ |
| Prompts | ✅ |
| Stdio Transport | ✅ |
| HTTP Transport | ✅ |
| SSE Transport | ✅ |
| Authentication | ✅ |
| Middleware | ✅ |
| Per-Component Auth | ✅ |
| Scopes | ✅ |
| Multi-Tenant | ✅ |
| Pagination | ❌ |
License
MIT