MCP

The NLX MCP Interface exposes your AI app's capabilities as standard Model Context Protocol 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

  • Agent Integration: Allow autonomous agents (like AutoGen or LangChain agents) to use your NLX app as a toolkit.

  • Tool Discovery: Dynamically query what your AI app can do (e.g., "CheckInventory", "ResetPassword") and retrieve the schema for those actions.

Configuration

Setting

Value

Base URL

https://apps.nlx.ai/c/mcp/{deploymentKey}/{channelKey}-{languageCode}

Header

nlx-api-key: YOUR_API_KEY

Important: As with other endpoints, append the language code (e.g., -en-US) to the channel key.

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

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

Response Example:

{
  "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.

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:

{
  "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.

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: Returns text/event-stream chunks prefixed with data:.

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

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

Last updated