Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"laravel/prompts": "^0.3.5",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.0 || ^12.0",
"swisnl/mcp-client": "^0.4 || ^0.5",
"swisnl/mcp-client": "^0.5.1 || ^0.6",
"swisnl/php-http-fixture-client": "^3.1",
"symfony/console": "^7.2",
"vlucas/phpdotenv": "^5.6"
Expand Down
16 changes: 12 additions & 4 deletions src/Mcp/McpConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ public function __construct(
* Create a new MCP connection for a given Streamable HTTP endpoint
*
* @param string $endpoint
* @param array<string, string> $headers
* @return self
*/
public static function forStreamableHttp(string $endpoint): self
public static function forStreamableHttp(string $endpoint, array $headers = []): self
{
$client = Client::withStreamableHttp($endpoint);
$client = Client::withStreamableHttp(
endpoint: $endpoint,
headers: $headers,
);

$connection = new self($client, 'MCP server');
$connection->withCacheKey('mcp_tools_' . md5($endpoint));
Expand All @@ -86,11 +90,15 @@ public static function forStreamableHttp(string $endpoint): self
* Create a new MCP connection for a given SSE endpoint
*
* @param string $endpoint
* @param array<string, string> $headers
* @return self
*/
public static function forSse(string $endpoint): self
public static function forSse(string $endpoint, array $headers = []): self
{
$client = Client::withSse($endpoint);
$client = Client::withSse(
endpoint: $endpoint,
headers: $headers,
);

$connection = new self($client, 'MCP server');
$connection->withCacheKey('mcp_tools_' . md5($endpoint));
Expand Down