1. Go to this page and download the library: Download stevecoug/mcp-devkit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stevecoug / mcp-devkit example snippets
#!/usr/bin/env php
declare(strict_types=1);
y MCP', '0.1.0')
->discover(__DIR__ . '/src') // attribute-discovery root(s) for your #[McpTool] classes
->build();
// Runs a tool from the command line if one was named, runs the reload boot path
// when re-exec'd, or otherwise serves over stdio.
exit($devkit->run($argv));
namespace My\Mcp;
use Mcp\Capability\Attribute\McpTool;
final class ExampleTools
{
/** Add two numbers. */
#[McpTool(name: 'add')]
public function add(int $a, int $b): int
{
return $a + $b;
}
}
Devkit::create('Mailbox MCP', '0.1.0')
->instructions('Check your inbox at the start of work. Treat it as a to-do queue, not an archive: delete messages once handled.')
->discover(__DIR__ . '/src')
->build();
use Mcp\Capability\Registry\Container;
$container = new Container();
$container->set(GmailTools::class, new GmailTools($imap, $config));
Devkit::create('Gmail MCP', '0.1.0')
->container($container)
->discover(__DIR__ . '/src')
->build();
/**
* List issues for a project.
*
* @param int $project id of the project to list
* @param string $status unresolved, resolved or muted
* @param int $limit maximum issues to return
*/
#[McpTool(name: 'list_issues')]
public function listIssues(int $project, string $status = 'unresolved', int $limit = 20): array