Connect an MCP tool
Describe a tool server, register a capability, and constrain an Agent to the allowed tool.
Tool boundaries
The MCPServer resource points to a transport and endpoint; the Tool resource identifies a tool on that server. The Agent lists Tool resource names; allowedTools lists MCP-advertised Tool.spec.toolName values when non-empty. The example assumes a server that actually advertises searxng_web_search, one of the tool names currently selected by the operator for the runner contract. Replace the endpoint with your own; arbitrary MCP tools are not automatically exposed through that contract. Tool-side authorization, network access, and tenant boundaries remain the responsibility of your integration.
Example resources
apiVersion: core.kaigents.io/v1alpha1
kind: MCPServer
metadata:
name: research-server
namespace: kaigents
spec:
transport: http
url: http://mcp-server.kaigents.svc.cluster.local/mcp
---
apiVersion: core.kaigents.io/v1alpha1
kind: Tool
metadata:
name: search-docs
namespace: kaigents
spec:
mcpServerRef: research-server
toolName: searxng_web_search
description: Search a permitted document collection
---
apiVersion: core.kaigents.io/v1alpha1
kind: Agent
metadata:
name: documentation-agent
namespace: kaigents
spec:
systemPrompt: "Answer from the permitted documents; cite your sources."
tools:
- name: search-docs
allowedTools:
- searxng_web_searchValidate before a Run
- Confirm that the server URL resolves from an execution pod and that the tool appears in its advertised contracts.
- Verify input schemas and test read-only calls first.
- Use a separate server-side identity for each tenant or workload; do not rely on model instructions for access control.
- Bound timeouts, returned content, and concurrency. Assume tool responses may contain prompt-injection attempts.
If invocation fails
Compare the Agent tool name, Tool.metadata.name, Tool.spec.toolName, and the MCP server’s advertised name. Check execution events for ToolFailed and inspect server-side logs. A registered Tool manifest does not guarantee that its server is running or authorized.