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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"guzzlehttp/guzzle": "^7.9",
"guzzlehttp/oauth-subscriber": "^0.9.1",
"laminas/laminas-ldap": "^2.19",
"mcp/sdk": "^0.6",
"mcp/sdk": "^0.7.1",
"pentatrion/vite-bundle": "^8.2",
"phpoffice/phpspreadsheet": "^5.0",
"phpstan/phpdoc-parser": "^2.2",
Expand All @@ -60,7 +60,7 @@
"symfony/dotenv": "^8.1",
"symfony/flex": "^2.8",
"symfony/framework-bundle": "^8.1",
"symfony/mcp-bundle": "^0.10",
"symfony/mcp-bundle": "^0.11",
"symfony/monolog-bundle": "^3.10|^4.0",
"symfony/object-mapper": "^8.1",
"symfony/polyfill-mbstring": "^1.33",
Expand Down
32 changes: 17 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions tests/Mcp/McpHttpEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use App\Service\ApiToken\ApiTokenService;
use Tests\AbstractWebTestCase;

use const JSON_THROW_ON_ERROR;

/**
* Functional tests for the /mcp HTTP endpoint (ADR-021 Phase 5), driving the full
* stack — the Bearer-PAT firewall, our McpEndpointController, and the SDK's
Expand Down Expand Up @@ -44,6 +46,30 @@ public function testDisallowedHostIsForbidden(): void
self::assertSame(403, $this->client->getResponse()->getStatusCode());
}

public function testToolsListExposesTheRegisteredTools(): void
{
// The SDK loads its element registry lazily since v0.7.0, so the tools only
// materialise on the first registry read — tools/list, not the handshake.
// The direct tool tests fetch the services from the container and would not
// notice an empty registry here.
$server = $this->mcpServer('localhost');
$this->client->request('POST', '/mcp', server: $server, content: self::INITIALIZE);
$sessionId = $this->client->getResponse()->headers->get('Mcp-Session-Id');
self::assertNotNull($sessionId, 'the handshake did not open a session');

$server['HTTP_MCP_SESSION_ID'] = $sessionId;
$this->client->request('POST', '/mcp', server: $server, content: '{"jsonrpc":"2.0","id":2,"method":"tools/list"}');

$response = $this->client->getResponse();
self::assertSame(200, $response->getStatusCode());

/** @var array{result: array{tools: list<array{name: string}>}} $payload */
$payload = json_decode((string) $response->getContent(), true, flags: JSON_THROW_ON_ERROR);
$names = array_column($payload['result']['tools'], 'name');
self::assertContains('get_day', $names);
self::assertContains('log_time', $names);
}

public function testBogusTokenIsUnauthorized(): void
{
// A tt_pat_ Bearer is claimed by the stateless api firewall; an invalid one
Expand Down
Loading