-
-
Notifications
You must be signed in to change notification settings - Fork 125
[MCP Bundle] Make MonologBundle optional #864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,12 +35,18 @@ public function __construct( | |
|
|
||
| public function handle(Request $request): Response | ||
| { | ||
| $transport = new StreamableHttpTransport( | ||
| $this->httpMessageFactory->createRequest($request), | ||
| $this->responseFactory, | ||
| $this->streamFactory, | ||
| logger: $this->logger, | ||
| ); | ||
| $transport = $this->logger | ||
| ? new StreamableHttpTransport( | ||
| $this->httpMessageFactory->createRequest($request), | ||
| $this->responseFactory, | ||
| $this->streamFactory, | ||
| logger: $this->logger, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here you can pass the NullLogger instead ? |
||
| ) | ||
| : new StreamableHttpTransport( | ||
| $this->httpMessageFactory->createRequest($request), | ||
| $this->responseFactory, | ||
| $this->streamFactory, | ||
| ); | ||
|
|
||
| return $this->httpFoundationFactory->createResponse( | ||
| $this->server->run($transport), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| use PHPUnit\Framework\Attributes\DataProvider; | ||
| use PHPUnit\Framework\TestCase; | ||
| use Symfony\AI\McpBundle\McpBundle; | ||
| use Symfony\Bundle\MonologBundle\MonologBundle; | ||
| use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
|
||
| class McpBundleTest extends TestCase | ||
|
|
@@ -49,6 +50,10 @@ public function testCustomConfiguration() | |
|
|
||
| public function testMcpLoggerServiceIsCreated() | ||
| { | ||
| if (!class_exists(MonologBundle::class)) { | ||
| $this->markTestSkipped('MonologBundle is not installed'); | ||
| } | ||
|
|
||
|
Comment on lines
+53
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since monolog is never installed on the ci, this test will be always skipped, so the rest of the test is useless. What do you think about requiring monolog on dev then?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| $container = $this->buildContainer([]); | ||
|
|
||
| $this->assertTrue($container->hasDefinition('monolog.logger.mcp')); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you thinks instead of having the NullLogger logic here: https://github.com/modelcontextprotocol/php-sdk/pull/152/files to have it here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry the reviews are in the wrong order I miss clicked 😅