### Install MCP Profiler Bundle
Source: https://github.com/killerwolf/mcp-profiler-bundle/blob/main/README.md
Installs the MCP Profiler Bundle using Composer. This is the primary method for adding the bundle to your Symfony project.
```bash
composer require killerwolf/mcp-profiler-bundle:^0.1
```
--------------------------------
### MCP Profiler Template Example
Source: https://github.com/killerwolf/mcp-profiler-bundle/blob/main/Resources/docs/data_collector.md
A basic Twig template for displaying the data collected by the MCPDataCollector in the Symfony profiler.
```twig
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
{% block toolbar %}
{% set icon %}
{{ collector.requestCount }} MCP
{% endset %}
{{ parent() }}
{% endblock %}
{% block panel %}
Bundle Information
Name: {{ collector.bundleName }}
Version: {{ collector.bundleVersion }}
Request Count: {{ collector.requestCount }}
Collected At: {{ collector.timestamp }}
{# Display custom data if available #}
{# {% if collector.customData is not null %} #}
{#
Custom Data
#}
{#
{{ collector.customData|json_encode(constant('JSON_PRETTY_PRINT')) }} #}
{# {% endif %} #}
{% endblock %}
```
--------------------------------
### MCPDataCollector Class Example
Source: https://github.com/killerwolf/mcp-profiler-bundle/blob/main/Resources/docs/data_collector.md
Illustrates how to extend the MCPDataCollector to include additional data. This involves adding properties in the collect() method and creating corresponding getter methods.
```php
bundleName = $bundleName;
$this->bundleVersion = $bundleVersion;
}
public function collect(Request $request, Response $response, Exception $exception = null): void
{
// Collect basic information
$this->data = [
'bundle_name' => $this->bundleName,
'bundle_version' => $this->bundleVersion,
'request_count' => ++$this->requestCount,
'timestamp' => (new DateTime())->format('Y-m-d H:i:s'),
];
// Add custom data here
// $this->data['custom_data'] = $this->getCustomData();
}
public function getBundleName(): string
{
return $this->data['bundle_name'];
}
public function getBundleVersion(): string
{
return $this->data['bundle_version'];
}
public function getRequestCount(): int
{
return $this->data['request_count'];
}
public function getTimestamp(): string
{
return $this->data['timestamp'];
}
// Add getter for custom data if implemented
// public function getCustomData(): mixed
// {
// return $this->data['custom_data'] ?? null;
// }
public function getName(): string
{
return 'mcp_profiler.mcp_data_collector';
}
}
```
--------------------------------
### Interact with Symfony Profiler via CLI
Source: https://github.com/killerwolf/mcp-profiler-bundle/blob/main/README.md
Demonstrates how to use the Symfony console command provided by the bundle to interact with the profiler. Includes listing recent entries and showing specific profile details.
```bash
# List recent profiler entries
bin/console mcp:profiler list --limit=20
# Show details for a specific profile
bin/console mcp:profiler show