{"id":26945559,"url":"https://github.com/prism-php/relay","last_synced_at":"2026-03-02T00:01:06.453Z","repository":{"id":285791837,"uuid":"957584795","full_name":"prism-php/relay","owner":"prism-php","description":"An MCP client tool for Prism","archived":false,"fork":false,"pushed_at":"2026-01-21T18:00:10.000Z","size":373,"stargazers_count":149,"open_issues_count":15,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-24T00:58:39.741Z","etag":null,"topics":["ai","laravel","llm","mcp","mcp-client","prism"],"latest_commit_sha":null,"homepage":"https://prismphp.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prism-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"sixlive"}},"created_at":"2025-03-30T18:12:36.000Z","updated_at":"2026-02-19T15:59:19.000Z","dependencies_parsed_at":"2025-04-02T18:34:48.463Z","dependency_job_id":null,"html_url":"https://github.com/prism-php/relay","commit_stats":null,"previous_names":["prism-php/relay"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/prism-php/relay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prism-php%2Frelay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prism-php%2Frelay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prism-php%2Frelay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prism-php%2Frelay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prism-php","download_url":"https://codeload.github.com/prism-php/relay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prism-php%2Frelay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29987726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T22:42:38.399Z","status":"ssl_error","status_checked_at":"2026-03-01T22:41:51.863Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","laravel","llm","mcp","mcp-client","prism"],"created_at":"2025-04-02T19:15:19.278Z","updated_at":"2026-03-02T00:01:01.266Z","avatar_url":"https://github.com/prism-php.png","language":"PHP","funding_links":["https://github.com/sponsors/sixlive"],"categories":["📚 Projects (2474 total)"],"sub_categories":["MCP Servers"],"readme":"![](assets/relay-banner.webp)\n\n# Relay\n\nA seamless integration between [Prism](https://github.com/prism-php/prism) and Model Context Protocol (MCP) servers that empowers your AI applications with powerful, external tool capabilities.\n\n## Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require prism-php/relay\n```\n\nAfter installation, publish the configuration file:\n\n```bash\nphp artisan vendor:publish --tag=\"relay-config\"\n```\n\n## Configuration\n\nThe published config file (`config/relay.php`) is where you'll define your MCP server connections.\n\n### Configuring Servers\n\nYou must define each MCP server explicitly in the config file. Each server needs a unique name and the appropriate configuration parameters:\n\n```php\nreturn [\n    'servers' =\u003e [\n        'puppeteer' =\u003e [\n            'command' =\u003e ['npx', '-y', '@modelcontextprotocol/server-puppeteer'],\n            'timeout' =\u003e 30,\n            'transport' =\u003e \\Prism\\Relay\\Enums\\Transport::Stdio,\n        ],\n        'github' =\u003e [\n            'url' =\u003e env('RELAY_GITHUB_SERVER_URL', 'http://localhost:8001/api'),\n            'timeout' =\u003e 30,\n            'transport' =\u003e \\Prism\\Relay\\Enums\\Transport::Http,\n        ],\n    ],\n    'cache_duration' =\u003e env('RELAY_TOOLS_CACHE_DURATION', 60), // in minutes (0 to disable)\n];\n```\n\n## Basic Usage\n\nHere's how you can integrate MCP tools into your Prism agent:\n\n```php\n\u003c?php\n\nuse Prism\\Prism\\Prism;\nuse Prism\\Relay\\Facades\\Relay;\nuse Prism\\Prism\\Enums\\Provider;\n\n$response = Prism::text()\n    -\u003eusing(Provider::Anthropic, 'claude-3-7-sonnet-latest')\n    -\u003ewithPrompt('Find information about Laravel on the web')\n    -\u003ewithTools(Relay::tools('puppeteer'))\n    -\u003easText();\n\nreturn $response-\u003etext;\n```\n\nThe agent can now use any tools provided by the Puppeteer MCP server, such as navigating to webpages, taking screenshots, clicking buttons, and more.\n\n## Real-World Example\n\nHere's a practical example of creating a Laravel command that uses MCP tools with Prism:\n\n```php\nnamespace App\\Console\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Prism\\Relay\\Facades\\Relay;\nuse Prism\\Prism\\Enums\\Provider;\nuse Prism\\Prism\\Prism;\nuse Prism\\Prism\\Text\\PendingRequest;\n\nuse function Laravel\\Prompts\\note;\nuse function Laravel\\Prompts\\textarea;\n\nclass MCP extends Command\n{\n    protected $signature = 'prism:mcp';\n\n    public function handle()\n    {\n        $response = $this-\u003eagent(textarea('Prompt'))-\u003easText();\n\n        note($response-\u003etext);\n    }\n\n    protected function agent(string $prompt): PendingRequest\n    {\n        return Prism::text()\n            -\u003eusing(Provider::Anthropic, 'claude-3-7-sonnet-latest')\n            -\u003ewithSystemPrompt(view('prompts.nova-v2'))\n            -\u003ewithPrompt($prompt)\n            -\u003ewithTools([\n                ...Relay::tools('puppeteer'),\n            ])\n            -\u003eusingTopP(1)\n            -\u003ewithMaxSteps(99)\n            -\u003ewithMaxTokens(8192);\n    }\n}\n```\n\nThis command creates an interactive CLI that lets you input prompts that will be sent to Claude. The agent can use Puppeteer tools to browse the web, complete tasks, and return the results.\n\n## Transport Types\n\nArc supports multiple transport mechanisms:\n\n### HTTP Transport\n\nFor MCP servers that communicate over HTTP:\n\n```php\n'github' =\u003e [\n    'url' =\u003e env('RELAY_GITHUB_SERVER_URL', 'http://localhost:8000/api'),\n    'api_key' =\u003e env('RELAY_GITHUB_SERVER_API_KEY'),\n    'timeout' =\u003e 30,\n    'transport' =\u003e Transport::Http,\n],\n```\n\n### STDIO Transport\n\nFor locally running MCP servers that communicate via standard I/O:\n\n```php\n'puppeteer' =\u003e [\n    'command' =\u003e ['npx', '-y', '@modelcontextprotocol/server-puppeteer'],\n    'timeout' =\u003e 30,\n    'transport' =\u003e Transport::Stdio,\n],\n```\n\n\u003e [!NOTE]\n\u003e The STDIO transport launches a subprocess and communicates with it through standard input/output. This is perfect for running tools directly on your application server.\n\n## Advanced Usage\n\n### Using Multiple MCP Servers\n\nYou can combine tools from multiple MCP servers in a single Prism agent:\n\n```php\nuse Prism\\Prism\\Prism;\nuse Prism\\Relay\\Facades\\Relay;\nuse Prism\\Prism\\Enums\\Provider;\n\n$response = Prism::text()\n    -\u003eusing(Provider::Anthropic, 'claude-3-7-sonnet-latest')\n    -\u003ewithTools([\n        ...Relay::tools('github'),\n        ...Relay::tools('puppeteer')\n    ])\n    -\u003ewithPrompt('Find and take screenshots of Laravel repositories')\n    -\u003easText();\n```\n\n### Error Handling\n\nThe package uses specific exception types for better error handling:\n\n```php\nuse Prism\\Relay\\Exceptions\\RelayException;\nuse Prism\\Relay\\Exceptions\\ServerConfigurationException;\nuse Prism\\Relay\\Exceptions\\ToolCallException;\nuse Prism\\Relay\\Exceptions\\ToolDefinitionException;\nuse Prism\\Relay\\Exceptions\\TransportException;\n\ntry {\n    $tools = Relay::tools('puppeteer');\n    // Use the tools...\n} catch (ServerConfigurationException $e) {\n    // Handle configuration errors (missing server, invalid settings)\n    Log::error('MCP Server configuration error: ' . $e-\u003egetMessage());\n} catch (ToolDefinitionException $e) {\n    // Handle issues with tool definitions from the MCP server\n    Log::error('MCP Tool definition error: ' . $e-\u003egetMessage());\n} catch (TransportException $e) {\n    // Handle communication errors with the MCP server\n    Log::error('MCP Transport error: ' . $e-\u003egetMessage());\n} catch (ToolCallException $e) {\n    // Handle errors when calling a specific tool\n    Log::error('MCP Tool call error: ' . $e-\u003egetMessage());\n} catch (RelayException $e) {\n    // Handle any other MCP-related errors\n    Log::error('Relay general error: ' . $e-\u003egetMessage());\n}\n```\n\n## License\n\nThe MIT License (MIT). Please see the [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprism-php%2Frelay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprism-php%2Frelay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprism-php%2Frelay/lists"}