# DIL MCP server

> For the complete documentation index, see [llms.txt](https://doc.ibexa.co/en/6.0/llms.txt).

TODO.

The Data Intelligence Layer come with a built-in MCP server helpin AI agents to fetch metrics and use them to provide content improvement suggestions or take actions.

## MCP server configuration

You can check the service existence with the following command:

```bash
php bin/console debug:container ibexa.mcp.server.default.data_intelligence_layer
```

You can check the route existence with the following command:

```bash
php bin/console debug:router ibexa.mcp.data_intelligence_layer
```

This MCP server need to be associated to some SiteAccesses and allowed to be accessed from some hosts. For details, see [Data Intelligence Layer configuration](https://doc.ibexa.co/en/6.0/content_management/data_intelligence_layer/dil_config/#mcp-server-configuration).

## MCP server test

You can use the MCP server from an agent CLI command. Like in the [Work with MCP servers example](https://doc.ibexa.co/en/6.0/ai/mcp/mcp_usage/#fully-scripted-variant), you can use a wrapper script to ease JWT token acquisition.

```bash
#!/bin/bash
set -e

export NODE_TLS_REJECT_UNAUTHORIZED=0

baseUrl='http://localhost' # Adapt to your test case
mcpServer="$baseUrl/admin/mcp/data-intelligence"

jwtToken=$(curl -s -X 'POST' \
  "$baseUrl/api/ibexa/v2/user/token/jwt" \
  -H "X-Siteaccess: admin" \
  -H 'Content-Type: application/vnd.ibexa.api.JWTInput+json' \
  -H 'Accept: application/vnd.ibexa.api.JWT+json' \
  -d '{
        "JWTInput": {
          "_media-type": "application/vnd.ibexa.api.JWTInput+json",
          "username": "admin",
          "password": "publish"
        }
      }' | jq -r .JWT.token)

exec npx -y supergateway \
  --streamableHttp "$mcpServer" \
  --oauth2Bearer "$jwtToken" \
  --header 'Accept-Language: en' \
  --logLevel none
```

Notice:

- the `admin` in MCP server URL as default [`URIElement: 1` SiteAccess matching](https://doc.ibexa.co/en/6.0/multisite/siteaccess/siteaccess_matching/#urielement) is used in this local test example
- the `X-Siteaccess: admin` header when requiring the JWT token TODO: mention this need in mcp_usage.md example instead.
- the `Accept-Language: en` header when establishing the gateway TODO: Why is it suddenly needed? Because it's the admin SiteAccess?

### Prompt examples

> How the French translation is covered?
>
> Pick me one random folder that need translation into French.
