> For the complete documentation index, see [llms.txt](https://docs.nlx.ai/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nlx.ai/platform/developers/conversation-api/mcp.md).

# MCP

The NLX MCP Interface exposes your AI app's capabilities as standard [Model Context Protocol](https://modelcontextprotocol.io/) tools. This allows external Agents, LLMs, and MCP-compliant clients to discover and execute actions defined within your NLX deployment.

### When to use this API

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><i class="fa-brain-circuit">:brain-circuit:</i></td><td><strong>Agent integration</strong></td><td>Allow autonomous agents (like AutoGen or LangChain agents) to use your NLX app as a toolkit</td></tr><tr><td><i class="fa-head-side-gear">:head-side-gear:</i></td><td><strong>Tool discovery</strong></td><td>Dynamically query what your AI app can do (e.g., "CheckInventory", "ResetPassword") and retrieve the schema for those actions</td></tr></tbody></table>

### Configuration

| Setting      | Value                                                                   |
| ------------ | ----------------------------------------------------------------------- |
| **Base URL** | `https://apps.nlx.ai/c/mcp/{deploymentKey}/{channelKey}-{languageCode}` |
| **Header**   | `nlx-api-key: YOUR_API_KEY`                                             |

{% hint style="info" %}
As with other endpoints, append the language code (e.g., `-en-US`) to the channel key.
{% endhint %}

#### 1. List available tools (`GET`)

Retrieve a list of all tools exposed by this deployment, including their names, descriptions, and JSON schemas for arguments.

**Endpoint:** `GET /tools`

```bash
curl -X GET "https://apps.nlx.ai/c/mcp/xxxx/xxxx-en-US/tools" \
  -H "nlx-api-key: YOUR_API_KEY"
```

**Response example:**

```json
{
  "tools": [
    {
      "name": "check_order_status",
      "description": "Retrieves the status of a customer order",
      "inputSchema": {
        "type": "object",
        "properties": {
          "orderId": { "type": "string" }
        },
        "required": ["orderId"]
      }
    }
  ]
}
```

#### 2. Execute a tool (`POST`)

Invoke a specific tool by name. You pass the arguments defined in the tool's schema.

**Endpoint:** `POST /tools/{toolName}`

**Standard execution (JSON)**

Useful for single, synchronous results.

```bash
curl -X POST "https://apps.nlx.ai/c/mcp/xxxx/xxxx-en-US/tools/check_order_status" \
  -H "nlx-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "arguments": {
      "orderId": "ORD-12345"
    }
  }'
```

**Response example:**

```json
{
  "content": [
    {
      "type": "text",
      "text": "Order ORD-12345 is currently in transit."
    }
  ],
  "isError": false
}
```

**Streaming execution (SSE)**

If a tool produces long-running output or you want real-time feedback, enable streaming.

```bash
curl -N -X POST "https://apps.nlx.ai/c/mcp/xxxx/xxxx-en-US/tools/generate_report" \
  -H "nlx-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stream": true,
    "arguments": { "year": 2024 }
  }'
```

**Response example:** Returns `text/event-stream` chunks prefixed with `data:`.

```
data: {"content": [{"type": "text", "text": "Generating report..."}]}

data: {"content": [{"type": "text", "text": " Q1 Data analyzed."}]}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nlx.ai/platform/developers/conversation-api/mcp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
