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 examples/stdio-custom-dependencies/McpTaskHandlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use Mcp\Capability\Attribute\McpResource;
use Mcp\Capability\Attribute\McpTool;
use Mcp\Example\DependenciesStdioExample\Service\StatsServiceInterface;
use Mcp\Example\DependenciesStdioExample\Service\TaskRepositoryInterface;
use Mcp\Example\StdioCustomDependencies\Service\StatsServiceInterface;
use Mcp\Example\StdioCustomDependencies\Service\TaskRepositoryInterface;
use Psr\Log\LoggerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Mcp\Example\DependenciesStdioExample\Service;
namespace Mcp\Example\StdioCustomDependencies\Service;

use Psr\Log\LoggerInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Mcp\Example\DependenciesStdioExample\Service;
namespace Mcp\Example\StdioCustomDependencies\Service;

interface StatsServiceInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Mcp\Example\DependenciesStdioExample\Service;
namespace Mcp\Example\StdioCustomDependencies\Service;

final class SystemStatsService implements StatsServiceInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Mcp\Example\DependenciesStdioExample\Service;
namespace Mcp\Example\StdioCustomDependencies\Service;

/**
* @phpstan-type Task array{id: int, userId: string, description: string, completed: bool, createdAt: string}
Expand Down
8 changes: 4 additions & 4 deletions examples/stdio-custom-dependencies/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
require_once dirname(__DIR__).'/bootstrap.php';
chdir(__DIR__);

use Mcp\Example\DependenciesStdioExample\Service\InMemoryTaskRepository;
use Mcp\Example\DependenciesStdioExample\Service\StatsServiceInterface;
use Mcp\Example\DependenciesStdioExample\Service\SystemStatsService;
use Mcp\Example\DependenciesStdioExample\Service\TaskRepositoryInterface;
use Mcp\Example\StdioCustomDependencies\Service\InMemoryTaskRepository;
use Mcp\Example\StdioCustomDependencies\Service\StatsServiceInterface;
use Mcp\Example\StdioCustomDependencies\Service\SystemStatsService;
use Mcp\Example\StdioCustomDependencies\Service\TaskRepositoryInterface;
use Mcp\Server;
use Mcp\Server\Transport\StdioTransport;

Expand Down
29 changes: 29 additions & 0 deletions tests/Inspector/StdioCachedDiscoveryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the official PHP MCP SDK.
*
* A collaboration between Symfony and the PHP Foundation.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Inspector;

use Mcp\Tests\Inspector\InspectorSnapshotTestCase;

final class StdioCachedDiscoveryTest extends InspectorSnapshotTestCase
{
public static function provideMethods(): array
{
return [
...parent::provideListMethods(),
];
}

protected function getServerScript(): string
{
return \dirname(__DIR__, 2).'/examples/stdio-cached-discovery/server.php';
}
}
29 changes: 29 additions & 0 deletions tests/Inspector/StdioCustomDependenciesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the official PHP MCP SDK.
*
* A collaboration between Symfony and the PHP Foundation.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Inspector;

use Mcp\Tests\Inspector\InspectorSnapshotTestCase;

final class StdioCustomDependenciesTest extends InspectorSnapshotTestCase
{
public static function provideMethods(): array
{
return [
...parent::provideListMethods(),
];
}

protected function getServerScript(): string
{
return \dirname(__DIR__, 2).'/examples/stdio-custom-dependencies/server.php';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Mcp\Tests\Inspector;

final class StdioCalculatorExampleTest extends InspectorSnapshotTestCase
final class StdioDiscoveryCalculatorTest extends InspectorSnapshotTestCase
{
public static function provideMethods(): array
{
Expand Down
29 changes: 29 additions & 0 deletions tests/Inspector/StdioEnvVariablesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the official PHP MCP SDK.
*
* A collaboration between Symfony and the PHP Foundation.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Inspector;

use Mcp\Tests\Inspector\InspectorSnapshotTestCase;

final class StdioEnvVariablesTest extends InspectorSnapshotTestCase
{
public static function provideMethods(): array
{
return [
...parent::provideListMethods(),
];
}

protected function getServerScript(): string
{
return \dirname(__DIR__, 2).'/examples/stdio-env-variables/server.php';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Mcp\Tests\Inspector\InspectorSnapshotTestCase;

final class ManualStdioExampleTest extends InspectorSnapshotTestCase
final class StdioExplicitRegistrationTest extends InspectorSnapshotTestCase
{
public static function provideMethods(): array
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"prompts": []
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"resources": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"tools": [
{
"name": "add_numbers",
"inputSchema": {
"type": "object",
"properties": {
"a": {
"type": "integer"
},
"b": {
"type": "integer"
}
},
"required": [
"a",
"b"
]
}
},
{
"name": "multiply_numbers",
"inputSchema": {
"type": "object",
"properties": {
"a": {
"type": "integer"
},
"b": {
"type": "integer"
}
},
"required": [
"a",
"b"
]
}
},
{
"name": "divide_numbers",
"inputSchema": {
"type": "object",
"properties": {
"a": {
"type": "integer"
},
"b": {
"type": "integer"
}
},
"required": [
"a",
"b"
]
}
},
{
"name": "power",
"inputSchema": {
"type": "object",
"properties": {
"base": {
"type": "integer"
},
"exponent": {
"type": "integer"
}
},
"required": [
"base",
"exponent"
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"prompts": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"resources": [
{
"name": "system_stats",
"uri": "stats://system/overview",
"description": "Provides current system statistics.",
"mimeType": "application/json"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"resourceTemplates": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"tools": [
{
"name": "add_task",
"description": "Adds a new task for a given user.",
"inputSchema": {
"type": "object",
"properties": {
"userId": {
"type": "string",
"description": "the ID of the user"
},
"description": {
"type": "string",
"description": "the task description"
}
},
"required": [
"userId",
"description"
]
}
},
{
"name": "list_user_tasks",
"description": "Lists pending tasks for a specific user.",
"inputSchema": {
"type": "object",
"properties": {
"userId": {
"type": "string",
"description": "the ID of the user"
}
},
"required": [
"userId"
]
}
},
{
"name": "complete_task",
"description": "Marks a task as complete.",
"inputSchema": {
"type": "object",
"properties": {
"taskId": {
"type": "integer",
"description": "the ID of the task to complete"
}
},
"required": [
"taskId"
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"prompts": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"resourceTemplates": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"prompts": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"resources": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"resourceTemplates": []
}
20 changes: 20 additions & 0 deletions tests/Inspector/snapshots/StdioEnvVariablesTest-tools_list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"tools": [
{
"name": "process_data_by_mode",
"description": "Performs an action that can be modified by an environment variable.",
"inputSchema": {
"type": "object",
"properties": {
"input": {
"type": "string",
"description": "some input data"
}
},
"required": [
"input"
]
}
}
]
}