# Symfony Plugin MCP Tools

**MCP Tools** (Model Context Protocol) provide AI assistants with structured access to project information like Symfony routes, services, Doctrine entities, and Twig extensions.

### Enabling MCP Server

To use MCP tools, enable the built-in MCP Server in IntelliJ IDEA / PhpStorm:

1. Go to **Settings | Tools | MCP Server**
2. Click **Enable MCP Server**
3. In **Clients Auto-Configuration**, click **Auto-Configure** for each client you want to set up

For more details, see the [official documentation](https://www.jetbrains.com/help/idea/mcp-server.html).

---

## Symfony Console Commands MCP Tool

**Feature ID:** `CommandMcpToolset`  
**Date:** 2026-01-11  
**Feature Page:** [Symfony Console Commands MCP Tool](https://espend.de/phpstorm/plugin/symfony#command-mcp-toolset)  

Lists all Symfony console commands available in the project. This MCP tool provides access to configured console commands with their class names, file paths, options, and arguments.

The tool accepts an Ant-style `fileGlob` on command class paths for scoped command inventories.

### Code Examples

```
# Example
name,className,filePath,options,arguments
cache:clear,\App\Command\CacheClearCommand,src/Command/CacheClearCommand.php,,
app:sync,\App\Command\SyncCommand,src/Command/SyncCommand.php,"[{name: --dry-run}]","[{name: target}]"
```

---

## Doctrine Entity Fields MCP Tool

**Feature ID:** `DoctrineEntityFieldsMcpToolset`  
**Date:** 2026-01-11  
**Feature Page:** [Doctrine Entity Fields MCP Tool](https://espend.de/phpstorm/plugin/symfony#doctrine-entity-fields-mcp-toolset)  

Lists all fields of a Doctrine entity as CSV. This MCP tool provides detailed field information for a specific entity class including field names, column names, types, and relations.

The tool returns CSV format with columns: `name`, `column`, `type`, `relation`, `relationType`, `enumType`, `propertyType`.

### Code Examples

```
# Example
name,column,type,relation,relationType,enumType,propertyType
id,id,integer,,,,int
username,username,string,,,string
status,status,string,,,\App\Enum\Status,\App\Enum\Status
orders,orders,,App\Entity\Order,OneToMany,,
```

---

## Doctrine Entities MCP Tool

**Feature ID:** `DoctrineEntityMcpToolset`  
**Date:** 2026-01-11  
**Feature Page:** [Doctrine Entities MCP Tool](https://espend.de/phpstorm/plugin/symfony#doctrine-entity-mcp-toolset)  

Lists all Doctrine ORM entities in the project as CSV. This MCP tool provides access to all configured Doctrine entities with their class names and file paths.

The tool returns CSV format with columns: `className`, `filePath`.

### Code Examples

```
# Example
className,filePath
App\Entity\User,src/Entity/User.php
App\Entity\Product,src/Entity/Product.php
App\Entity\Order,src/Entity/Order.php
```

---

## Symfony Form Types MCP Tool

**Feature ID:** `FormTypeMcpToolset`  
**Date:** 2026-01-11  
**Feature Page:** [Symfony Form Types MCP Tool](https://espend.de/phpstorm/plugin/symfony#form-type-mcp-toolset)  

Lists all Symfony form types configured in the project. This MCP tool provides access to form type aliases, class names, and their file locations.

The tool returns CSV format with columns: `name`, `className`, `filePath`.

### Code Examples

```
# Example
name,className,filePath
user,App\Form\UserType,src/Form/UserType.php
email,Symfony\Component\Form\Extension\Core\Type\EmailType,vendor/symfony/form/Extension/Core/Type/EmailType.php
```

---

## Symfony Form Type Options MCP Tool

**Feature ID:** `FormTypeOptionsMcpToolset`  
**Date:** 2026-01-14  
**Feature Page:** [Symfony Form Type Options MCP Tool](https://espend.de/phpstorm/plugin/symfony#form-type-options-mcp-toolset)  

Lists all available options for a specific Symfony form type. This MCP tool provides detailed information about option names, their types (DEFAULT, REQUIRED, DEFINED), and the source classes that define them.

The tool accepts a form type name or FQN and returns CSV format with columns: `name`, `type`, `source`.

### Code Examples

```
# Example
name,type,source
label,DEFAULT,Symfony\Component\Form\Extension\Core\Type\FormType
required,DEFAULT,Symfony\Component\Form\Extension\Core\Type\FormType
data,DEFAULT,Symfony\Component\Form\Extension\Core\Type\FormType
```

---

## Symfony Profiler Requests MCP Tool

**Feature ID:** `ProfilerRequestsMcpToolset`  
**Date:** 2026-01-14  
**Feature Page:** [Symfony Profiler Requests MCP Tool](https://espend.de/phpstorm/plugin/symfony#profiler-requests-mcp-toolset)  

Lists the last 10 Symfony profiler requests with detailed information about HTTP requests, controllers, routes, templates, and form types used. This MCP tool provides optional filtering by URL, hash, controller, and route name.

The tool returns CSV format with columns: `hash`, `method`, `url`, `statusCode`, `profilerUrl`, `controller`, `route`, `template`, `formTypes`.

### Code Examples

```
# Example
hash,method,url,statusCode,profilerUrl,controller,route,template,formTypes
18e6b8,GET,http://127.0.0.1:8000/user/1,200,_profiler/18e6b8,App\Controller\UserController::show,user_show,user/show.html.twig,
```

---

## Symfony MCP exposed tools integration

**Feature ID:** `SymfonyMcpToolsetIntegration`  
**Date:** 2026-04-02  
**Feature Page:** [Symfony MCP exposed tools integration](https://espend.de/phpstorm/plugin/symfony#symfony-mcp-toolset-integration)  

Registers Symfony MCP tools through JetBrains' MCP server toolset API, so Symfony tools are managed from the IDE's exposed tools UI instead of a plugin-specific tool registry.

Route, command, template usage, and template variable tools also support Ant-style `fileGlob` filters for scoped project analysis.

### Code Examples

```
# Scoped MCP requests:
list_symfony_routes_url_controllers
fileGlob: src/Controller/Admin/**/*.php

list_symfony_commands
fileGlob: src/Command/**/*.php

list_twig_template_variables
fileGlob: templates/admin/**/*.html.twig
```

---

## Symfony Routes and URL MCP Tool

**Feature ID:** `RouteMcpToolset`  
**Date:** 2026-04-02  
**Feature Page:** [Symfony Routes and URL MCP Tool](https://espend.de/phpstorm/plugin/symfony#route-mcp-toolset)  

Lists Symfony routes with URL mappings, controller mappings, file paths, line numbers, and rendered Twig templates.

The unified route tool supports filtering by route name, controller, URL path, or Ant-style controller `fileGlob`, so AI assistants can move from request URLs to controllers, source locations, and templates without a second lookup.

### Code Examples

```
# Example
name,controller,path,filePath,lineNumber,templates
app_home,App\Controller\HomeController::index,/,src/Controller/HomeController.php,12,home/index.html.twig
api_users_list,App\Controller\UserController::list,/api/users,src/Controller/UserController.php,28,user/list.html.twig;user/_pagination.html.twig
```

---

## Symfony Service Definition Generator MCP Tool

**Feature ID:** `ServiceDefinitionMcpToolset`  
**Date:** 2026-04-02  
**Feature Page:** [Symfony Service Definition Generator MCP Tool](https://espend.de/phpstorm/plugin/symfony#service-definition-mcp-toolset)  

Generates Symfony service definitions for one or more PHP classes. This MCP tool analyzes constructors and setter methods to identify dependencies and creates explicit service arguments.

The tool supports YAML, XML, PHP array, and PHP fluent output, with per-argument suggestions and service-ID strategy options.

### Code Examples

```
# Example
App\Service\EmailService:
    arguments: ['@mailer', '@logger']
```

---

## Symfony Service Container MCP Tool

**Feature ID:** `ServiceMcpToolset`  
**Date:** 2026-04-08  
**Feature Page:** [Symfony Service Container MCP Tool](https://espend.de/phpstorm/plugin/symfony#service-mcp-toolset)  

Locates where a Symfony service is defined in configuration files by service name or class name. This MCP tool provides access to service definitions with their file paths and line numbers.

The service-locator output now uses structured text as well, so agents can read locator mappings without guessing from raw dumps.

The tool returns CSV format with columns: `serviceName`, `className`, `filePath`, `lineNumber`.

### Code Examples

```
# Example
serviceName,className,filePath,lineNumber
app.service.my_service,\App\Service\MyService,config/services.yaml,15
app.my_service_alias,\App\Service\MyService,config/services.yaml,25

serviceLocator,serviceName,className,filePath,lineNumber
App\Controller\ProductController::getSubscribedServices,product.repository,\App\Repository\ProductRepository,config/services.yaml,42
```

---

## Twig Extensions MCP Tool

**Feature ID:** `TwigExtensionMcpToolset`  
**Date:** 2026-01-11  
**Feature Page:** [Twig Extensions MCP Tool](https://espend.de/phpstorm/plugin/symfony#twig-extension-mcp-toolset)  

Lists available Twig template extensions for code generation and template assistance. This MCP tool provides unified access to all Twig extensions including filters, functions, tests, and tags.

The tool returns CSV format with columns: `extension_type`, `name`, `className`, `methodName`, `parameters`.

### Code Examples

```
# Example
extension_type,name,className,methodName,parameters
filter,upper,\Twig\Extension\CoreExtension,upper,"value,encoding"
function,path,\Twig\Extension\AssetExtension,path,"url,name"
filter,date,\Twig\Extension\CoreExtension,date,"date,format"
```

---

## Symfony UX Twig Components MCP Tool

**Feature ID:** `TwigComponentMcpToolset`  
**Date:** 2026-02-28  
**Feature Page:** [Symfony UX Twig Components MCP Tool](https://espend.de/phpstorm/plugin/symfony#twig-component-mcp-toolset)  

Lists Symfony UX Twig components and their composition metadata. This MCP tool provides access to all Twig components with their templates, syntax variants, props, and blocks.

Supports partial component name search (case-insensitive).

### Code Examples

```
# Example
component_name,template_relative_path,component_tag,twig_component_syntax,component_print_block_syntax,twig_tag_composition_syntax,props,template_blocks
Alert,templates/components/Alert.html.twig,,{{ component('Alert') }},{{ block('footer') }},{% component 'Alert' %}...{% endcomponent %},message;type,content;footer
Admin:Card,templates/components/Admin/Card.html.twig,,{{ component('Admin:Card') }},,{% component 'Admin:Card' %}...{% endcomponent %},title,body
```

---

## Twig Template Usages MCP Tool

**Feature ID:** `TwigTemplateUsageMcpToolset`  
**Date:** 2026-02-28  
**Feature Page:** [Twig Template Usages MCP Tool](https://espend.de/phpstorm/plugin/symfony#twig-template-usage-mcp-toolset)  

Lists usages of Twig templates across the project. This MCP tool finds all locations where a template is used, including controllers, includes, extends, embeds, and more.

Accepts a partial template name, a project-relative file path (e.g. `"templates/home/index.html.twig"` resolves to `"home/index.html.twig"`), or an Ant-style `fileGlob` for scoped template usage scans.

**Includes Symfony route information:** For templates rendered by controllers, the output includes the associated route name and path.

### Code Examples

```
# Example
template,controller,twig_include,twig_embed,twig_extends,twig_import,twig_use,twig_form_theme,twig_component,route_name,route_path
partials/nav.html.twig,App\Controller\BaseController::index,templates/layouts/base.html.twig,,,,,,,app_base_index,/
layouts/base.html.twig,,,,,templates/pages/home.html.twig;templates/pages/about.html.twig,,,,
```

---

## Twig Template Variables MCP Tool

**Feature ID:** `TwigTemplateVariablesMcpToolset`  
**Date:** 2026-04-12  
**Feature Page:** [Twig Template Variables MCP Tool](https://espend.de/phpstorm/plugin/symfony#twig-template-variables-mcp-toolset)  

Lists all variables available in one or more Twig templates with their PHP types and first-level accessible properties. Accepts template names, project-relative file paths, or Ant-style `fileGlob` filters.

Variables are collected from controller render calls, include/embed contexts, Twig `{% types %}` tags, and `@var` annotations.

### Code Examples

```
# Example
variable,type,properties
user,\App\Entity\User,"id,email,name,roles,createdAt"
app,\Symfony\Bridge\Twig\AppVariable,"user,request,session,environment,debug,token,flashes"
products,\App\Entity\Product[],"id,title,price,category,isActive"
```

---

