Context Mesh lets you turn enterprise assets (like MCP servers and APIs) into context that AI agents can call. It works by composing those assets, also called sources, into a single deployable Code Mode MCP server.r. You can attach skills to the server to give agents reusable instructions alongside the tools.
Context Mesh MCP servers
What are Context Mesh MCP servers
Context Mesh MCP servers are the result of bundling different sources together and deploying them as a single Code Mode MCP server. This becomes the source of truth for your agents after you deploy them on a control plane.
Each Context Mesh MCP server inherits the capabilities listed in each one of its sources as follows:
- API sources: each operation in the OpenAPI spec (a path and a method, for example
/flightandGET) becomes a capability. Context Mesh generates Python code that registers each API operation as an MCP tool. For example, an API source’sGET /flightsoperation becomes alistFlightstool. - MCP server sources: Context Mesh inherits the tools the remote MCP server already exposes and proxies them. You can’t define additional tools on the source from Context Mesh.
How agents use a Code Mode MCP server
Context Mesh generates every MCP server in Code Mode. The tools from your sources exist on the server, but the server doesn’t list them to the agent. Instead of calling these tools directly, agents find them with the Code Mode meta-tools and call them from code. The agent sees the following meta-tools:
|
Meta-tool |
What it does |
|---|---|
list_tools
|
Returns the full catalog of tools from all sources at once. |
search
|
Finds tools by keyword or natural-language query. |
get_schemas
|
Returns the parameters of specific tools. |
execute
|
Runs Python code written by the agent in a sandbox. Inside the sandbox, the code calls the tools from your sources and chains their results. |
To complete a task, the agent discovers the tools it needs, then writes one script that calls them with execute. Only the final result of the script returns to the model’s context window, instead of every intermediate response. The sandbox limits how long the code can run and how much memory it can use.
When you create a Context Mesh MCP server, you configure it with the following parameters:
|
Parameter |
Description |
Required |
|---|---|---|
| Sources | Context Mesh sources you’ve previously added. | Yes |
| Display name | MCP server’s name in the UI. | Yes |
| Name | Machine name. Must be unique within the org. Auto-populated from the Display name. | Yes |
| Description | The Context Mesh MCP server description. | No |
| Labels |
Key-value tags for filtering/searching across . Optional in the UI. The API requires this field, so send {} if you don’t want to add any labels.
|
No |
You can deploy the Context Mesh MCP server at creation or later.
Blocked capabilities
By default, a Context Mesh MCP server inherits everything a source can do. For example, if an API source contains 20 operations, the Context Mesh MCP server that uses it gives the agent access to the 20 operations. The same applies to all the tools a remote MCP server source exposes.
Blocked capabilities let you restrict specific paths, methods, and tools without changing the source itself. They block source items on one Context Mesh MCP server, so agents can’t access the blocked items through that server. Other MCP servers that use the same source aren’t affected.
What you can block depends on the type of source the Context Mesh MCP server uses:
|
Source type |
What you can block |
Examples |
|---|---|---|
| API sources |
|
|
| MCP server sources |
|
|
Deployments
To run the Context Mesh MCP server, you deploy it on a Control Plane. You can deploy a Context Mesh MCP server in two modes. Both modes require Kong Operator on the control plane. To install it, see Install Kong Operator.
|
Mode |
How it works |
|---|---|
| Basic | The default mode. Konnect handles the deployment: |
| Advanced Tech Preview | You control the deployment directly with Kong Operator custom resources instead of using the Konnect defaults. |
Use Basic mode unless you need to control the Kubernetes workload.
Use Advanced mode when you need to set the replica count, CPU and memory resources, or custom labels and annotations on the deployment. You can deploy the same Context Mesh MCP server to more than one control plane at once.
The MCP server reports a status so you can tell whether it’s up and working:
|
Status |
Description |
|---|---|
| Healthy | The MCP server is running and serving traffic. |
| Deploying | Konnect is rolling out the MCP server for the first time. |
| Upgrading | Konnect is rolling out a new version over a running MCP server. |
| Unhealthy | The MCP server is deployed but isn’t serving traffic correctly. |
| Pending | The MCP server is mapped to a control plane, but the rollout hasn’t started. |
You can see this status in the Konnect UI. To check the deployment outside the UI, check the MCP server pod in your cluster instead. Kong Operator runs each Context Mesh MCP server as a deployment with the mcpserver- prefix. To confirm the pod is running, replace NAMESPACE with your namespace and run the following command with kubectl:
kubectl get pods -n NAMESPACE | grep mcpserverA healthy MCP server shows 1/1 ready with the Running status. For example:
mcpserver-test-45675cb3-764b4d6d6c-q2gnp 1/1 Running 0 57mIf the pod stays in Pending or CrashLoopBackOff, check its logs with kubectl logs -n NAMESPACE POD_NAME.
To review the Python code Context Mesh generates for the MCP server, send a GET request to the Get generated Python code for the MCP Server endpoint.
For the full deployment flow, see Deploy an MCP server with Context Mesh and Kong Operator.
Set up a Context Mesh MCP server
Setting up a Context Mesh MCP server is a multi-step process. Add your sources first, then create the MCP server and map each source to it. Deploying to a control plane is the final step. To give agents reusable instructions, you can also add a skill.
The Context Mesh API uses
/v1/context-interfacesfor Context Mesh MCP servers. Wherever the endpoints refer to a context interface, that is a Context Mesh MCP server.
Create the MCP server
Get the MCP and source IDs
Mapping sources, deploying the MCP server, and adding skills all use the ID of the MCP server. Mapping sources also uses the ID of the source. Get both IDs from the API:
-
Send a
GETrequest to the List all Context Interfaces endpoint to list your MCP servers. Find your MCP server in the response and copy itsid:curl -X GET "https://us.api.konghq.com/v1/context-interfaces" \ --no-progress-meter --fail-with-body \ -H "Authorization: Bearer $KONNECT_TOKEN" \ | jq '.data[] | {display_name, name, id}'Export the ID as an environment variable, replacing
YOUR_INTERFACE_IDwith theidyou copied:export INTERFACE_ID='YOUR_INTERFACE_ID' -
Send a
GETrequest to the List Context Sources endpoint to list your sources. Find your source in the response and copy itsid:curl -X GET "https://us.api.konghq.com/v1/context-sources" \ --no-progress-meter --fail-with-body \ -H "Authorization: Bearer $KONNECT_TOKEN" \ | jq '.data[] | {display_name, name, id}'Export the ID as an environment variable, replacing
YOUR_SOURCE_IDwith theidyou copied:export SOURCE_ID='YOUR_SOURCE_ID'
Map the sources to the MCP server
Set up blocked capabilities
You block capabilities on a source mapping, so you need the ID of the mapping between the MCP server and the source. Send a GET request to the List Context Interface Source Mappings endpoint to list the sources mapped to the MCP server. The command saves the ID of the mapping for the source whose ID is in the SOURCE_ID environment variable as the MAPPING_ID environment variable:
MAPPING_ID=$(curl -X GET "https://us.api.konghq.com/v1/context-interfaces/$INTERFACE_ID/context-source-mappings" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN" | jq -r ".data[] | select(.context_source_id == \"$SOURCE_ID\") | .id"
)To change blocked capabilities later, send a PATCH request to the Update Interface-Source Capability Controls endpoint with the type and the deny keys you want to change:
- Omitted keys keep their existing value.
- An empty array clears that capability.
- A non-empty array replaces the existing list.
curl -X PATCH "https://us.api.konghq.com/v1/context-interfaces/$INTERFACE_ID/context-source-mappings/$MAPPING_ID/capability-controls" \
--no-progress-meter --fail-with-body \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"type": "mcp_server",
"deny": {
"prompts": [
"summarize-booking"
]
}
}'To see the current blocked capabilities, send a GET request to the Get Interface-Source Capability Controls endpoint.
Block capabilities from the UI
To set up blocked capabilities from the UI:
- In the Konnect API sidebar, click Context Mesh.
- In the Context Mesh sidebar, click MCP Servers.
- Click your MCP server.
- Click the Sources tab.
- In the source list, click a source. A sidebar dialog opens.
- In Blocked capabilities, click Edit.
- In the Add to blocklist field, add the API path, or the MCP tools, resources, or prompts you want to block.
- Select the call method or the tool type.
- Click Add.
- Click Save changes.
Deploy the MCP server
Deploy the MCP server by mapping it to an existing control plane that has Kong Operator installed on it. To install it, see Install Kong Operator.
Kong Operator must run with the Konnect controller enabled (
ENABLE_CONTROLLER_KONNECT=true) and themcp-serverfeature gate (FEATURE_GATES=mcp-server) to run a Context Mesh MCP server. For the full Helm command, see Install Kong Operator in the get-started guide. For the feature gates option, see the configuration options.
FAQs
What is a Code Mode MCP server?
In Code Mode, the MCP server doesn’t list its tools to the agent. Instead, the agent sees a few meta-tools: search, get_schemas, and list_tools to find the tools it needs, and execute to run short Python code in a sandbox that calls those tools.
The agent chains the calls in code, and only the final result returns to the context window.
This lets an agent work with a large API surface without flooding the model’s context. Context Mesh generates all of its MCP servers in Code Mode.
Can I add auth to a Context Mesh MCP server?
Not on the MCP server itself. You can set custom headers on a source, and Context Mesh attaches them to every request it sends to that source’s backing service. However, Context Mesh stores custom headers unencrypted, so you can’t use them for credentials such as API keys, bearer tokens, or passwords.