News Turn any service into MCP tools - Released EE v2.12

Document updated on Sep 17, 2025

MCP Server

The MCP Server feature exposes any of your existing use cases as MCP tools so you can allow to AI MCP Agents to access any of the systems you have already, or create new ones easily, whether it is based on legacy services and data or not.

With the MCP Server of KrakenD, you instantly add MCP to all your stack regardless of their native MCP compatibility or not. This unlocks effortless AI-driven integrations by bridging any service with MCP through declarative configuration.

ai-gateway-mcp-server.mmd diagram

As KrakenD can expose through MCP any kind of service, you can start offering endless use cases, and is a game changer to start publishing AI services inside enterprise architectures with no effort.

The key concepts of the MCP server are:

  • Build on-the-fly MCP servers: Declare and run MCP servers that fetch and send data from and to multiple places.
  • Protocol translation: Offer MCP, consume anything. E.g., connect to a SOAP service and offer it to Claude via MCP.
  • KrakenD ecosystem compatibility: MCP servers are first-class citizens and enjoy authorization, throttling, data modification, validation, caching, monitoring, workflows and everything else on KrakenD.
  • Declarative simplicity: Minimal config additions get powerful AI-optimized APIs in front of any service.
  • Multi-tool support: Expose multiple AI tools with individual input/output JSON schemas and workflows per MCP server, including mediatypes like audio and images.
  • Stateless or stateful operations: Choose behavior to align with backend semantics, SSE available too.

MCP Server configuration overview

To start serving MCP on KrakenD, two main configuration sections define MCP Servers:

  1. MCP server declaration (root extra_config with ai/mcp)
  2. MCP entrypoint configuration (endpoint’s extra_config with ai/mcp)

MCP Server configuration

The ai/mcp namespace at the root level contains all the configuration related to MCP. In this section you declare the list of servers available to agents, and plug them to specific services.

Here’s a real world configuration example you can test:

{
  "$schema": "https://krakend.io/schema/v2.12/krakend.json",
  "version": 3,
  "extra_config": {
    "ai/mcp": {
      "servers": [
        {
          "instructions": "Provides the current state of city webcams",
          "name": "webcam-status",
          "title": "Webcam tools",
          "version": "1.0.1",
          "tools": [
            {
              "name": "rovaniemi-webcam",
              "title": "Rovaniemi webcam",
              "description": "Get the latest image from the Rovaniemi webcam",
              "type": "image",
              "workflow": {
                "endpoint": "/__mcp/rovaniemi-webcam",
                "output_encoding": "no-op",
                "backend": [
                  {
                    "url_pattern": "/vi/Cp4RRAEgpeU/0.jpg",
                    "host": [
                      "https://img.youtube.com"
                    ]
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  },
  "endpoints": [
    {
      "endpoint": "/mcp",
      "method": "POST",
      "timeout": "10s",
      "backend": [
        {
          "url_pattern": "/ignore",
          "host": [
            "ignore"
          ]
        }
      ],
      "extra_config": {
        "ai/mcp": {
          "server_name": "webcam-status"
        }
      }
    }
  ]
}

The configuration above will allow you an interaction like this:

Example of MCP tool call from Claude Desktop

The list of available fields is:

Fields of MCP functionality
* required fields

servers * array
The array of MCP servers available for linking to endpoints. Each object represents a different MCP server. The entry is only the definition of the server. You must create an endpoint that serves as the entrypoint to each server.
Each item of servers accepts the following properties:
instructions string
The instructions are key for the AI client to understand how to use this server.
Defaults to ""
json_response boolean
Set to true if you want the response to be in JSON format. If set to false, the response will be in SSE format (text/event-stream).
Defaults to false
name * string
A unique name for MCP server configuration. This name is an identifier used in the logs or when a title is not provided.
Example: "stories-tracker"
ping_period string
Krakend will ping all connected clients from time to time to determine if the session must be kept alive. This duration strings sets the ping period KrakenD will do to its connected clients. When you don’t set a value, there is no ping process and KrakenD is unaware of disconnected clients, so it won’t report live notifications.
Specify units using ns (nanoseconds), us or µs (microseconds), ms (milliseconds), s (seconds), m (minutes), or h (hours).
Defaults to "0s"
stateless boolean
A stateless server does not validate the Mcp-Session-Id header, and uses a temporary session with default initialization parameters. Any server->client request is rejected immediately as there’s no way for the client to respond. Server->Client notifications may reach the client if they are made in the context of an incoming request
Defaults to false
title * string
The description of the purpose of this MCP Server. Provide a meaningful description to help AI understand its use case.
Example: "Story tracker tools"
tools array
The Model Context Protocol (MCP) allows servers to expose tools (RFC) that can be invoked by language models. Tools enable models to interact with internal/external systems. Each tool is uniquely identified by a name and includes metadata describing its schema.
Each item of tools accepts the following properties:
description * string
The description of the purpose of this MCP tool. Provide a meaningful description to help AI understand its use case.
Example: "Get a list of open stories in tracker matching a search query"
input_headers array
Defines the list of all headers allowed to reach the backend when passed.

By default, KrakenD won’t pass any header from the client to the backend. This list is case-insensitive. You can declare headers in lowercase, uppercase, or mixed.

An entry ["Cookie"] forwards all cookies, and a single star element ["*"] as value forwards everything to the backend (it’s safer to avoid this option), including cookies. See headers forwarding
Defaults to []
input_schema object
The input JSON schema to validate the input parameters sent by the AI client. The schema is essential in most clients to understand how to pass parameters to the MCP server. The schema must be a valid 2020-12 draft JSON Schema object.
name * string
A unique name for MCP tool configuration. This name is an identifier used in the logs or when a title is not provided.
Example: "stories-list"
output_schema object
The input JSON schema to validate the output parameters sent back to the AI client. The schema must be a valid 2020-12 draft JSON Schema object.
return_error_msg boolean
Set to true if you want the error message to be returned to the AI client. If set to false, the AI client will only receive a generic error message.
Defaults to false
title * string
The description of the purpose of this MCP tool. Provide a meaningful text to help AI understand its use case.
Example: "Story list"
type
The type of the response media.
Possible values are: "text" , "audio" , "image"
Defaults to "text"
workflow * object
This is the action/pipeline performed by the tool. While you can add a single action to the tool, because actions can be chained and have complex logic, we have called this a workflow, whether is connecting to a single remote service, many, aggreggating, or any other functionality supported by KrakenD. See the Workflow syntax
version * string
The version of the logic behind your MCP Server implementation. This version makes sense to your business and is not linked to anything else.
Example: "0.2.1"

MCP Entrypoint configuration

Finally, you need to provide a door to use the MCP servers you have defined. Endpoints serve as entrypoints, and you declare a route (most vendors use /mcp), and then plug it to the server you have defined above. Make sure to reuse the exact name you wrote in the server definition.

For example:

{ "version": 3,
  "endpoints": [
    {
      "endpoint": "/mcp",
      "method": "POST",
      "timeout": "10s",
      "backend": [
        {
          "url_pattern": "/ignore",
          "host": [
            "ignore"
          ]
        }
      ],
      "extra_config": {
        "ai/mcp": {
          "server_name": "webcam-status"
        }
      }
    },
    {
      "endpoint": "/mcp",
      "method": "DELETE",
      "@comment": "Allows the client to mark the session as deleted to free up memory",
      "backend": [
        {
          "url_pattern": "/ignore",
          "host": [
            "ignore"
          ]
        }
      ],
      "extra_config": {
        "ai/mcp": {
          "server_name": "webcam-status"
        }
      }
    }
  ]
}
Fields of MCP endpoint
* required fields

server_name *
The MCP server you want to attach to this endpoint. When you add this namespace, the endpoint becomes the MCP server entry point URL. The name used must match the name in the ai/mcp configuration in the root level.
Example: "stories-tracker"

You can write any value on the host and url_pattern of your backend, as once you add the ai/mcp these become irrelevant (the endpoint connects to the MCP server you just created). On the timeout make sure to use a value that is suitable for the services you are exposing through MCP.

Unresolved issues?

The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.

See all support channels