Skip to content

Commit 4e7011e

Browse files
Addressed comments
lint Apply suggestion from @chr-hertel Co-authored-by: Christopher Hertel <[email protected]> revert .gitignore
1 parent fe77d92 commit 4e7011e

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

demo/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,21 @@ docker compose exec app bin/console app:blog:query
9090
* The UI is coupled to a [Twig LiveComponent](https://symfony.com/bundles/ux-live-component/current/index.html), that integrates different `Chat` implementations on top of the user's session.
9191
* You can reset the chat context by hitting the `Reset` button in the top right corner.
9292
* You find three different usage scenarios in the upper navbar.
93+
94+
### MCP
95+
Demo MCP server added with a `current-time` tool to return the current time, with an optional format string.
96+
97+
To add the server, add the following configuration to your MCP Client's settings, e.g. your IDE:
98+
```json
99+
{
100+
"servers": {
101+
"symfony": {
102+
"command": "php",
103+
"args": [
104+
"/your/full/path/to/bin/console",
105+
"mcp:server"
106+
]
107+
}
108+
}
109+
}
110+
```

demo/config/bundles.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
return [
413
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
514
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],

demo/src/MCP/Tools/CurrentTimeTool.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace App\MCP\Tools;
1313

14-
use DateTime;
15-
use DateTimeZone;
1614
use Symfony\AI\McpSdk\Capability\Tool\MetadataInterface;
1715
use Symfony\AI\McpSdk\Capability\Tool\ToolCall;
1816
use Symfony\AI\McpSdk\Capability\Tool\ToolCallResult;
@@ -25,13 +23,13 @@ public function call(ToolCall $input): ToolCallResult
2523
$format = $input->arguments['format'] ?? 'Y-m-d H:i:s';
2624

2725
return new ToolCallResult(
28-
(new DateTime('now', new DateTimeZone('UTC')))->format($format)
26+
(new \DateTime('now', new \DateTimeZone('UTC')))->format($format)
2927
);
3028
}
3129

3230
public function getName(): string
3331
{
34-
return 'now-time';
32+
return 'current-time';
3533
}
3634

3735
public function getDescription(): string

0 commit comments

Comments
 (0)