Discover MCPs & agents
Loading MCPs and agentsβ¦
Loading MCPs and agentsβ¦
PHP implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools. β¨ Features π Complete MCP Protocol Support - Full implementation of the MCP specification π§ Type-Safe - Leverages PHP 8.1+ type system with enums, union types, and strict typing β‘ Async First
Jump to setup instructionsNo tool list is on record. This does not mean the server has no tools. Tools were not run.
No setup evidence yet No matching config or report on record. This does not mean the server is incompatible.
Same catalog task: AI & machine learning.
.prompts, the home to all your AI prompts, everywhere you need them.
Same catalog task: AI & machine learning.
Real MCP server (stdio + @modelcontextprotocol/sdk) that exposes x402-paywalled HTTP endpoints as MCP tools. Drop into Claude Desktop, Cursor, or any MCP client.
Same catalog task: AI & machine learning.
Standalone MCP (Model Context Protocol) server - stdio/http/websocket transports, connection pooling, tool registry
Fetched from the repository for this visit.
PHP implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.
composer require dalehurley/php-mcp-sdk
composer require dalehurley/php-mcp-sdk:dev-main
#!/usr/bin/env php
<?php
require_once __DIR__ . '/vendor/autoload.php';
use MCP\Server\McpServer;
use MCP\Server\Transport\StdioServerTransport;
use MCP\Types\Implementation;
use function Amp\async;
// Create the simplest possible MCP server
$server = new McpServer(
new Implementation(
'hello-world-server',
'1.0.0'
)
);
// Add a simple "say_hello" tool
$server->tool(
'say_hello',
'Says hello to someone',
[
'type' => 'object',
'properties' => [
'name' => [
'type' => 'string',
'description' => 'Name of the person to greet'
]
],
'required' => ['name']
],
function (array $args): array {
$name = $args['name'] ?? 'World';
return [
'content' => [
[
'type' => 'text',
'text' => "Hello, {$name}! π Welcome to MCP!"
]
]
];
}
);
// Start the server
async(function () use ($server) {
echo "π Hello World MCP Server starting...\n";
$transport = new StdioServerTransport();
$server->connect($transport)->await();
})->await();
#!/usr/bin/env php
<?php
require_once __DIR__ . '/vendor/autoload.php';
use MCP\Client\Client;
use MCP\Client\Transport\StdioClientTransport;
use MCP\Types\Implementation;
use Amp\Loop;
// Create client
$client = new Client(
new Implementation('weather-client', '1.0.0')
);
// Connect to weather server
$transport = new StdioClientTransport([
'command' => 'php',
'args' => [__DIR__ . '/weather-server.php']
]);
Amp\async(function() use ($client, $transport) {
try {
// Connect to server
yield $client->connect($transport);
echo "β
Connected to weather server\n";
// List available tools
$result = yield $client->listTools();
echo "π Available tools:\n";
foreach ($result['tools'] as $tool) {
echo " - {$tool['name']}: {$tool['description']}\n";
}
// Call the weather tool
$result = yield $client->callTool('get-weather', [
'location' => 'London, UK'
]);
echo "\nπ€οΈ Weather result:\n";
echo $result['content'][0]['text'] . "\n";
yield $client->close();
} catch (\Exception $error) {
echo "β Error: " . $error->getMessage() . "\n";
} finally {
Loop::stop();
}
});
Loop::run();
# Run the hello-world server
php examples/getting-started/hello-world-server.php
# Test with Claude Desktop by adding to your configuration:
{
"mcpServers": {
"hello-world": {
"command": "php",
"args": ["/path/to/examples/getting-started/hello-world-server.php"]
}
}
}
# Or test with the MCP Inspector (Node.js required)
npx @modelcontextprotocol/inspector examples/getting-started/hello-world-server.php
The PHP MCP SDK includes 20+ comprehensive examples across all skill levels:
All examples are tested and working! π
The PHP MCP SDK is designed to work with any PHP framework through its PSR-compliant architecture.
You can use the core PHP MCP SDK directly in Laravel applications:
composer require dalehurley/php-mcp-sdk
// In a Laravel controller or service
use MCP\Server\McpServer;
use MCP\Types\Implementation;
class McpController extends Controller
{
public function createServer()
{
$server = new McpServer(
new Implementation('my-laravel-app', '1.0.0')
);
// Register your tools, resources, and prompts
$server->tool('search-users', 'Search for users', [
'type' => 'object',
'properties' => [
'query' => ['type' => 'string', 'description' => 'Search query']
]
], function($params) {
return [
'content' => [
[
'type' => 'text',
'text' => json_encode(User::where('name', 'like', "%{$params['query']}%")->get())
]
]
];
});
return $server;
}
}
For a complete Laravel package with service providers, Artisan commands, and Laravel-specific features, see the separate laravel-mcp-sdk package.
The most comprehensive MCP SDK documentation in the ecosystem is available in the docs/ directory:
# Run tests
composer test
# Run tests with coverage
composer test-coverage
# Run static analysis
composer phpstan
composer psalm
# Fix code style
composer cs-fix
# Run all checks
composer check
Contributions are welcome! Please read our Contributing Guide for details.
All notable changes to this project are documented in the CHANGELOG.md. Please update it when making changes.
This project is licensed under the MIT License - see the LICENSE file for details.
Loading reviews...
GitHub checked 207h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.