1. Conduid
  2. AI
  3. Relay
MCP server · AI

Relay

An MCP client tool for Prism

Unclaimed last commit 7 months ago ailaravelllmmcpmcp-clientprism
52Fair

Scored yesterday · breakdown

About Relay

Relay is an MCP server published by prism-php in the AI category: an MCP client tool for Prism.

The repository has 153 stars and 21 forks, with the last commit 7 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/prism-php/relay

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Relay

Powered by Claude · Grounded in docs

I know everything about Relay. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 23 hours ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • !Dependencies pinnedNo lockfile. Installs can pull different code over time.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.

1 check has not been run yet.

Releases

v1.8.0v1.8.0 · 20 Mar 2026What's Changed Support Laravel 13 by @stuartbrameld in https://github.com/prism-php/relay/pull/36 New Contributors @stuartbrameld made their first contribution in https://github.com/prism-php/relay/pull/36 Full Changelog:…
v1.7.0v1.7.0 · 1 Mar 2026What's Changed Add OAuth 2.1 Bearer token support for HTTP transport by @pushpak1300 in https://github.com/prism-php/relay/pull/32 Feat: Http SSE transport as per '2024-11-05' MCP spec by @vinitkadam03 in…
v1.6.0v1.6.0 · 21 Jan 2026What's Changed (feat) any of schema support by @patrickbrouwers in https://github.com/prism-php/relay/pull/29 New Contributors @patrickbrouwers made their first contribution in https://github.com/prism-php/relay/pull/29 Full Changelog:…
v1.5.0v1.5.0 · 21 Jan 2026What's Changed Feature: Add support for passing headers with HTTP Transport by @michaeldyrynda in https://github.com/prism-php/relay/pull/30 New Contributors @michaeldyrynda made their first contribution in…
v1.4.0v1.4.0 · 11 Nov 2025What's Changed fix: Handling of more parameter types. by @hipig in https://github.com/prism-php/relay/pull/26 New Contributors @hipig made their first contribution in https://github.com/prism-php/relay/pull/26 Full Changelog:…

README

Relay

A seamless integration between Prism and Model Context Protocol (MCP) servers that empowers your AI applications with powerful, external tool capabilities.

Installation

You can install the package via Composer:

composer require prism-php/relay

After installation, publish the configuration file:

php artisan vendor:publish --tag="relay-config"

Configuration

The published config file (config/relay.php) is where you'll define your MCP server connections.

Configuring Servers

You must define each MCP server explicitly in the config file. Each server needs a unique name and the appropriate configuration parameters:

return [
    'servers' => [
        'puppeteer' => [
            'command' => ['npx', '-y', '@modelcontextprotocol/server-puppeteer'],
            'timeout' => 30,
            'env' => [],
            'transport' => \Prism\Relay\Enums\Transport::Stdio,
        ],
        'github' => [
            'url' => env('RELAY_GITHUB_SERVER_URL', 'http://localhost:8001/api'),
            'timeout' => 30,
            'transport' => \Prism\Relay\Enums\Transport::Http,
        ],
    ],
    'cache_duration' => env('RELAY_TOOLS_CACHE_DURATION', 60), // in minutes (0 to disable)
];

Basic Usage

Here's how you can integrate MCP tools into your Prism agent:

use Prism\Prism\Prism;
use Prism\Relay\Facades\Relay;
use Prism\Prism\Enums\Provider;

$response = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-7-sonnet-latest')
    ->withPrompt('Find information about Laravel on the web')
    ->withTools(Relay::tools('puppeteer'))
    ->asText();

return $response->text;

The agent can now use any tools provided by the Puppeteer MCP server, such as navigating to webpages, taking screenshots, clicking buttons, and more.

Real-World Example

Here's a practical example of creating a Laravel command that uses MCP tools with Prism:

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Prism\Relay\Facades\Relay;
use Prism\Prism\Enums\Provider;
use Prism\Prism\Prism;
use Prism\Prism\Text\PendingRequest;

use function Laravel\Prompts\note;
use function Laravel\Prompts\textarea;

class MCP extends Command
{
    protected $signature = 'prism:mcp';

    public function handle()
    {
        $response = $this->agent(textarea('Prompt'))->asText();

        note($response->text);
    }

    protected function agent(string $prompt): PendingRequest
    {
        return Prism::text()
            ->using(Provider::Anthropic, 'claude-3-7-sonnet-latest')
            ->withSystemPrompt(view('prompts.nova-v2'))
            ->withPrompt($prompt)
            ->withTools([
                ...Relay::tools('puppeteer'),
            ])
            ->usingTopP(1)
            ->withMaxSteps(99)
            ->withMaxTokens(8192);
    }
}

This 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.

Transport Types

Relay supports multiple transport mechanisms:

HTTP Transport

For MCP servers that communicate over HTTP:

'github' => [
    'url' => env('RELAY_GITHUB_SERVER_URL', 'http://localhost:8000/api'),
    'api_key' => env('RELAY_GITHUB_SERVER_API_KEY'),
    'timeout' => 30,
    'transport' => Transport::Http,
    'headers' => [
        'User-Agent' => 'prism-php-relay/1.0',
    ]
],

OAuth / Bearer Token Authentication

The MCP 2025-11-25 authorization spec defines an OAuth 2.1 flow for HTTP-based transports. Relay handles only the last step — attaching the token to every request. Your application is responsible for running the full OAuth flow and supplying the resulting access token at runtime.

What your application must handle

Before calling withToken(), your code must:

  1. Discover the authorization server — make an unauthenticated request to the MCP server and read the WWW-Authenticate header from the 401 response, or probe /.well-known/oauth-protected-resource. The response contains the authorization server URL.
  2. Run the OAuth 2.1 authorization code flow — including PKCE (S256 code challenge is required by the spec) and the resource parameter (RFC 8707) identifying the MCP server.
  3. Exchange the code for a token and store/refresh it as needed. Tokens are short-lived; implement refresh token rotation.

[!NOTE] The spec covers this in detail: MCP Authorization — 2025-11-25.

Passing the token to Relay

Once you have a valid Bearer token, pass it to Relay at request time. The runtime token takes priority over any static api_key set in config.

use Prism\Relay\Facades\Relay;
use Prism\Relay\Exceptions\AuthorizationException;
use Prism\Relay\Exceptions\TransportException;

// Via the Facade (returns a RelayBuilder)
$tools = Relay::withToken($request->user()->mcp_token)->tools('github');

// Or on a Relay instance
$relay = Relay::make('github');
$tools = $relay->withToken($request->user()->mcp_token)->tools();

When the MCP server rejects the token with HTTP 401, Relay throws AuthorizationException. Use this to trigger a re-authorization flow in your app:

try {
    $tools = Relay::withToken($token)->tools('github');
} catch (AuthorizationException $e) {
    // Token is missing, expired, or rejected (HTTP 401)
    // Re-run the OAuth flow to get a fresh token
    return redirect('/oauth/reconnect');
} catch (TransportException $e) {
    // Other transport failure (non-401)
    Log::error('MCP Transport error: ' . $e->getMessage());
}

[!NOTE] OAuth tokens are only supported with HTTP transport. Passing a token to a Stdio-configured server throws a ServerConfigurationException. For Stdio servers, provide credentials via the env config key instead.

STDIO Transport

For locally running MCP servers that communicate via standard I/O:

'puppeteer' => [
    'command' => [
      'npx',
      '-y',
      '@modelcontextprotocol/server-puppeteer',
      '--options',
      // Array values are passed as JSON encoded strings
      [
        'debug' => env('MCP_PUPPETEER_DEBUG', false)
      ]
    ],
    'timeout' => 30,
    'transport' => Transport::Stdio,
    'env' => [
        'NODE_ENV' => 'production',  // Set Node environment
        'MCP_SERVER_PORT' => '3001',  // Set a custom port for the server
    ],
],

[!NOTE] 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.

[!TIP] The env option allows you to pass environment variables to the MCP server process. This is useful for configuring server behavior, enabling debugging, or setting authentication details.

Advanced Usage

Using Multiple MCP Servers

You can combine tools from multiple MCP servers in a single Prism agent:

use Prism\Prism\Prism;
use Prism\Relay\Facades\Relay;
use Prism\Prism\Enums\Provider;

$response = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-7-sonnet-latest')
    ->withTools([
        ...Relay::tools('github'),
        ...Relay::tools('puppeteer')
    ])
    ->withPrompt('Find and take screenshots of Laravel repositories')
    ->asText();

Error Handling

The package uses specific exception types for better error handling:

use Prism\Relay\Exceptions\AuthorizationException;
use Prism\Relay\Exceptions\RelayException;
use Prism\Relay\Exceptions\ServerConfigurationException;
use Prism\Relay\Exceptions\ToolCallException;
use Prism\Relay\Exceptions\ToolDefinitionException;
use Prism\Relay\Exceptions\TransportException;

try {
    $tools = Relay::tools('puppeteer');
    // Use the tools...
} catch (ServerConfigurationException $e) {
    // Handle configuration errors (missing server, invalid settings)
    Log::error('MCP Server configuration error: ' . $e->getMessage());
} catch (ToolDefinitionException $e) {
    // Handle issues with tool definitions from the MCP server
    Log::error('MCP Tool definition error: ' . $e->getMessage());
} catch (AuthorizationException $e) {
    // Handle HTTP 401 — token is missing, expired, or invalid
    return redirect('/oauth/reconnect');
} catch (TransportException $e) {
    // Handle communication errors with the MCP server
    Log::error('MCP Transport error: ' . $e->getMessage());
} catch (ToolCallException $e) {
    // Handle errors when calling a specific tool
    Log::error('MCP Tool call error: ' . $e->getMessage());
} catch (RelayException $e) {
    // Handle any other MCP-related errors
    Log::error('Relay general error: ' . $e->getMessage());
}

License

The MIT License (MIT). Please see the License File for more information.

README fetched from the repository 23 hours ago. The original is authoritative.

Questions

About Relay

How do I install Relay?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Relay safe to use with an AI agent?

Its trust score is 52 out of 100 (fair). It passes 3 of the 5 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Relay still maintained?

The last commit was 7 months ago and 13 open issues. That's long enough that you should check whether the maintainer is responding to issues before depending on it.