Principle:AIPentest CyberStrikeAI External MCP Federation
| Knowledge Sources | |
|---|---|
| Domains | MCP, Tool_Federation, Interoperability |
| Last Updated | 2026-10-19 04:10 GMT |
Overview
An integration pattern that bridges an external MCP server's tool manifest into an agent's tool set, routing execution through a conversation-scoped holder and an execution recorder so federated tools behave like builtins under the same governance.
Description
An agent's power comes from its tools, but not every useful tool should live in the host process. External MCP federation lets an operator register an external MCP server (stdio, SSE, or HTTP transport), discover its tool manifest, and expose those tools to the agent as Eino BaseTool instances. Each federated tool's InvokableRun routes back through the agent's ExecuteMCPToolForConversation using a conversation ID held in a thread-safe ConversationHolder, so the external server sees the correct conversation context.
Errors are soft: an IsError result from the external server is prefixed with a sentinel so the model can self-correct, rather than hard-stopping the run. Execution IDs are recorded via a callback so the run can correlate tool calls with monitoring entries. The federated tools sit behind the same RBAC/toolguard gates as builtins, but with a coarser mcp:external:execute global-scope permission because their effects are not individually modelled.
Usage
Use this principle when you want to extend an agent's tool set without shipping new code in the host binary, and you can enforce governance at the federation boundary. It is the right choice for adding domain-specific tool servers (e.g. a reverse-shell MCP, a pentest Claude agent) behind a uniform authorization gate.
Theoretical Basis
Federation is a manifest-to-tool adapter with conversation-scoped execution:
# Discovery
defs = externalServer.ListTools() -- OpenAI-style function defs
tools = ToolsFromDefinitions(agent, holder, defs, recorder, chunk, invokeNotify, agentName)
for d in defs:
info = toolInfoFromDefinition(d) -- JSON schema -> schema.ToolInfo
tools += mcpBridgeTool{ info, name, agent, holder, record, chunk, invokeNotify }
# Execution (per federated tool call)
func mcpBridgeTool.InvokableRun(ctx, argumentsInJSON):
toolCallID = compose.GetToolCallID(ctx)
res = agent.ExecuteMCPToolForConversation(ctx, holder.Get(), name, args)
if res.IsError: return ToolErrorPrefix + res.Result -- soft error
record(res.ExecutionID, toolCallID)
return res.Result
Governance: external tools require mcp:external:execute with global scope; toolguard regex rules still apply to name+args.
Practical Guide
- Hold the conversation ID in a thread-safe holder so concurrent tool calls route correctly.
- Prefix
IsErrorresults with a sentinel; return them as strings, not Go errors, so the model self-corrects. - Record execution IDs via a callback so monitoring and the run result stay correlated.
- Gate federated tools with a global-scope permission, since their effects are external to the host.