Observe MCP Traffic with Access Control Enabled

Deployment Platform
Related Resources
Minimum Version
Kong Gateway - 3.13
TL;DR

Use the File Log plugin to write MCP tool activity to a local file. Inspect the entries to see which tools each Consumer or Consumer Group accessed. Confirm the RPC calls that Chatwise sends to your MCP server.

Prerequisites

decK is a CLI tool for managing Kong Gateway declaratively with state files. To complete this tutorial, install decK version 1.43 or later.

This guide uses deck gateway apply, which directly applies entity configuration to your Gateway instance. We recommend upgrading your decK installation to take advantage of this tool.

You can check your current decK version with deck version.

For this tutorial, you’ll need Kong Gateway entities, like Gateway Services and Routes, pre-configured. These entities are essential for Kong Gateway to function but installing them isn’t the focus of this guide. Follow these steps to pre-configure them:

  1. Run the following command:

    echo '
    _format_version: "3.0"
    services:
      - name: mcp-acl-service
        url: http://host.docker.internal:3001/mcp
    routes:
      - name: mcp-acl-route
        paths:
        - "/mcp"
        service:
          name: mcp-acl-service
    ' | deck gateway apply -
    

To learn more about entities, you can read our entities documentation.

Download and install ChatWise for your OS.

After installation:

  1. Launch the app.
  2. In Settings > Providers, configure your AI provider endpoint and API key.

Configure MCP tools in Chatwise

  1. Open Chatwise and go to Settings > MCP:

    1. Click + at the bottom of the window and choose HTTP server (http) from the Type dropdown.
    2. Enter a user-friendly name in the Name field.
    3. Enter http://localhost:8000/mcp in the URL field.
    4. Enable the Run tools automatically option.
    5. Click + next to the HTTP headers section and add:

      • KEY: api-key
      • VALUE: alice-key
    6. Click the Verify (view tools) button. You should see the following tools:

      • list_users
      • get_user
      • list_orders
      • list_orders_for_user
      • search_orders
    7. Close Settings.
    8. In the chat window, click the hammer icon to enable tools.
    9. Toggle your MCP server on. You should see 1 next to the hammer icon. Click the icon to view the server name and the number of available tools.

Configure the File Log plugin

Now, let’s configure the File Log plugin:

echo '
_format_version: "3.0"
plugins:
  - name: file-log
    config:
      path: "/tmp/mcp.json"
' | deck gateway apply -

Test MCP tools

Let’s generate MCP traffic and verify it appears in the logs. In Chatwise, enter the following:

How many orders are there in my marketplace?

You should see Chatwise successfully call the list_users tool with a response like:

There are 27 orders in your marketplace.

Next, check the audit logs in your Docker container:

docker exec -it kong-quickstart-gateway cat /tmp/mcp.json

You should see output similar to:

{
  "ai": {
    "mcp": {
      "rpc": [
        {
          "method": "tools/call",
          "latency": 6,
          "id": "2",
          "response_body_size": 5030,
          "tool_name": "list_orders"
        }
      ],
      "audit": [
        {
          "primitive_name": "list_orders",
          "consumer": {
            "id": "6c95a611-9991-407b-b1c3-bc608d3bccc3",
            "name": "admin",
            "identifier": "consumer_group"
          },
          "scope": "primitive",
          "primitive": "tool",
          "action": "allow"
        }
      ]
    }
  },
      "rpc": [
        {
          "method": "tools/call",
          "id": "1",
          "latency": 3,
          "tool_name": "list_orders",
          "response_body_size": 5030
        }
      ]
    }
  }
}
Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!