-
-
Notifications
You must be signed in to change notification settings - Fork 148
[Mate] Add AI Mate component for MCP server integration #1146
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?
[Mate] Add AI Mate component for MCP server integration #1146
Conversation
|
A special thanks goes to @Nyholm which was a great companion during the prototype phase and discussion partner on the symfony con in amsterdam where this ideas was born |
|
Johannes and I have been working on this together for the past few weeks. The idea of AI Mate is to create a framework agnostic platform where we easily can integrate with Symfony/Sulu/Laravel/Whatever specific features. |
|
Coming out of stealth mode - hitting Awesome stuff - thanks for driving that and spinning it up only in two weeks since SymfonyCon - will give it a deeper read, when you ping me 👍 |
6f175e1 to
da96bfe
Compare
| { | ||
| "name": "vendor/my-extension", | ||
| "type": "library", |
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.
we could also go with a specific type here, similar to phpstan:
| "type": "library", | |
| "type": "mate-extension", |
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.
@chr-hertel do you think we should also add that to the dicsovery?
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.
@Nyholm and i also discussed that - what do you think?
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.
Yeah. I imagine some packages just adding one file to their existing repo. They would not change the package type. So we cannot use it anyways. So why bother?
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.
@chr-hertel i also think it could make sense to have the tools also included in a "bigger" repo and so i would also ignore the package type
|
Hey @wachterjohannes, thanks again, one rather conceptual question. In understand this PR now like mate would integrate with the dependencies of the main application, right? did you consider installing it as a phar to get rid of that dependency range? |
yes absolutly - this should be a point on the list in the next weeks - but i think for now we could go with that and collect feedback! |
a33b39d to
17ca459
Compare
|
@chr-hertel @Nyholm @OskarStark i have tested it in my test repository - please take a look at the last 3 commit which contains a view necessary changes for the final touch.
Not sure why there around 400 checks 😂 but that seems normal |
|
Can you please rebase? Thanks |
This adds a new standalone component that provides an MCP (Model Context Protocol) server enabling AI assistants to interact with PHP applications. The component includes: - Core MCP server with extension discovery system - Symfony bridge for container introspection - Monolog bridge for log search and analysis - Built-in tools for PHP environment information - Comprehensive documentation
- Rename mcp.json to .mcp.json following MCP convention - Standardize parameter naming: use mate.root_dir consistently - Follow Symfony directory conventions: var/cache and var/log paths - Improve DI configuration with explicit args() and service() helpers - Ensure service visibility by setting public flag on existing services
- Rename resources/.mcp.json to resources/mcp.json as primary template - Update InitCommand to create mcp.json and symlink .mcp.json to it - Add symlink handling in InitCommand with user confirmation - Update tests to verify mcp.json creation and .mcp.json symlink - Improve removeDirectory helper to handle symlinks properly
- Change DEBUG to MATE_DEBUG for debug logging - Change FILE_LOG to MATE_FILE_LOG for file output - Update Logger service to use new variable names - Update troubleshooting documentation with new names - More specific names avoid conflicts with other tools
a25ff5e to
3c44ba9
Compare
| "phpstan/phpstan": "^2.0", | ||
| "phpstan/phpstan-strict-rules": "^2.0", | ||
| "phpunit/phpunit": "^11.5", | ||
| "symfony/dotenv": "^7.4|^8.0" |
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.
Why 7.4 for dotenv and console devs?
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.
no special reason
| ], | ||
| "require": { | ||
| "php": ">=8.2", | ||
| "mcp/sdk": "^0.1.0", |
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.
| "mcp/sdk": "^0.1.0", | |
| "mcp/sdk": "^0.1", |
| }, | ||
| "require-dev": { | ||
| "ext-simplexml": "*", | ||
| "phpstan/phpstan": "^2.0", |
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.
| "phpstan/phpstan": "^2.0", | |
| "phpstan/phpstan": "^2.1", |
| @@ -0,0 +1,27 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
| xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd" | |||
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.
please use the local namespace location, like done in all other phpunnit.xml files
| failOnRisky="true" | ||
| failOnWarning="true"> | ||
| <testsuites> | ||
| <testsuite name="AI Mate Test Suite"> |
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.
| <testsuite name="AI Mate Test Suite"> | |
| <testsuite name="Symony AI Mate Test Suite"> |
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.
please remove and add dedicated .gitignore files to the bridges
| 0.1 | ||
| --- | ||
|
|
||
| * Initial release |
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.
| * Initial release | |
| * Add bridge |
same for the other bridge
| /** | ||
| * @author Johannes Wachter <johannes@sulu.io> | ||
| */ | ||
| class LogSearchToolTest extends TestCase |
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.
lets make the tests final
| "name": "symfony/ai-monolog-mate", | ||
| "description": "Monolog bridge for AI Mate - provides log search and analysis tools", | ||
| "license": "MIT", | ||
| "type": "library", |
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.
"type": "symfony-ai-mate",
same for the other bridge
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.
@OskarStark there was already discussion about that:
#1146 (comment)
We can do that for the build in bridges but we should not make that a requirement
| "phpstan/phpstan": "^2.0", | ||
| "phpstan/phpstan-strict-rules": "^2.0" | ||
| }, | ||
| "repositories": [ |
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.
should be removed
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.
currrently neccesary so that the tests are running - shouldnt we remove that with a follow up PR when the packages are published on packagist?
| ->set('ai_mate_monolog.log_dir', '%mate.root_dir%/var/log'); | ||
|
|
||
| $configurator->services() | ||
| ->set(Monolog\Service\LogParser::class) |
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.
why not importing the namespaces?
| $ vendor/bin/mate serve | ||
| Adding Custom Tools |
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.
Add Custom Tools
| "name": "vendor/my-extension", | ||
| "type": "library", | ||
| "require": { | ||
| "symfony/ai-mate": "^1.0" |
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.
| "symfony/ai-mate": "^1.0" | |
| "symfony/ai-mate": "^0.1" |
| $services = $configurator->services(); | ||
|
|
||
| // Register a service with parameters | ||
| $services->set(MyApiClient::class) |
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.
Add a use statement for this class like App\MyApiClient;

Description
This PR introduces the AI Mate component (
symfony/ai-mate), a standalone MCP server that enables AI assistants (Claude, GitHub Copilot, JetBrains AI, Cursor) to interact with PHP/Symfony applications through standardized tools.Key Features
Core Server
extra.ai-mateincomposer.jsonphp-version,operating-system,php-extensionsSymfony Bridge (
symfony/ai-mate-symfony)symfony-servicestool for container introspectionMonolog Bridge (
symfony/ai-mate-monolog)monolog-search,monolog-search-regex,monolog-context-search,monolog-tail,monolog-list-files,monolog-list-channels,monolog-by-levelArchitecture
Unlike other Symfony AI components, Mate is standalone and does not integrate with the AI Bundle. It runs as an independent MCP server via stdio transport.
Usage Example
Creating custom tools:
Documentation
Comprehensive documentation added to
docs/components/mate.rst: