Skip to content

feat: MCP server forwarding in agent tools — pass mcpServers into query() options #184

@justrach

Description

@justrach

Summary

Allow any run_agent* tool to forward MCP server definitions into the agent's context, giving the agent access to external tools (databases, browsers, APIs) during its run.

Parameters added to all run_agent* tools

param type description
mcp_servers object Map of server name → {command, args} or {type: "http", url}

Example

{
  "prompt": "Open example.com and describe what you see",
  "mcp_servers": {
    "playwright": {"command": "npx", "args": ["@playwright/mcp@latest"]}
  }
}

Files

  • src/tools.zig: add mcp_servers param to run_agent, run_agent_hooks, run_agent_subagents, run_agent_session schemas and handlers
  • src/agent_sdk.zig: serialize mcp_servers into query() mcpServers option

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions