Skip to content

API Reference parrot.integrations.agentd.mcp_server

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.integrations.agentd.mcp_server

View source

MCP stdio proxy — expose an agentd daemon to external LLMs.

Implements Module 8 of sdd/specs/agent-cli-daemon.spec.md. An MCP client (Claude Code, another LLM) launches parrot mcp-serve <name> (CLI wiring is TASK-2216) as a stdio server; internally it is a thin proxy: MCP tool call -> AgentDaemonClient -> daemon. Built on the CORE StdioMCPServer (the integrations-local mcp/ package only holds OAuth helpers, NOT a stdio server).

All logging goes to stderr -- stdout is the MCP JSON-RPC channel, per LocalMCPServerBase's convention.

Class AgentInfoTool

Get information about the daemon's agent: name, class, LLM, tool count, uptime.

Class AskAgentTool

Ask the daemon's agent a question and get its response.

One MCP process is one daemon connection, i.e. one conversation session (spec §2) -- consecutive ask_agent calls in the same MCP session share conversation history on the daemon side.

Class DaemonStatusTool

Get the daemon's operational status: pid, uptime, scheduler, connections.

Class InvokeMethodTool

Invoke a specific allowlisted method on the daemon's agent directly.

Only registered when the daemon's exposed_methods allowlist is non-empty (spec §7 hard requirement) -- this tool is powerful and gated accordingly. Validates the method name against that same allowlist client-side too, as defense in depth (the daemon enforces it regardless).

Parameter Type Default Description
client AgentDaemonClient
exposed_methods list[str]
**kwargs Any {}

Class ListSchedulesTool

List the daemon's scheduled jobs (decorator-based and DB-backed).

Function build_proxy_tools

Build the full agentd MCP tool set for a connected client.

build_proxy_tools(client: AgentDaemonClient, exposed_methods: list[str] | None = None) -> list[AbstractTool]

Parameter Type Default Description
client AgentDaemonClient A connected AgentDaemonClient.
exposed_methods list[str] | None None The daemon's exposed_methods allowlist (from agent.info). InvokeMethodTool is included ONLY when this is non-empty (spec §7 hard requirement).

Returns: list[AbstractTool] — The tool instances to register on an MCP server.

Function run_mcp_proxy

Connect to a daemon and serve its tools over MCP stdio.

On daemon disconnect (or if it was never reachable), prints an actionable message to stderr and exits non-zero -- never to stdout, which is reserved for the MCP JSON-RPC channel.

run_mcp_proxy(name_or_socket: str) -> None

Parameter Type Default Description
name_or_socket str Service name or explicit socket path (resolved via resolve_socket()).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally