Skip to content

API Reference parrot.mcp.local_server

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

parrot.mcp.local_server

View source

Core local MCP transports — stdio JSON-RPC server.

LocalMCPServerBase is the extension point for any local (in-process) MCP transport; StdioMCPServer is the concrete stdin/stdout JSON-RPC implementation. Neither depends on aiohttp, auth, or resources — those remain server-only concerns handled by RemoteMCPServerBase in ai-parrot-server (FEAT-403).

Concurrency model

tools/call requests run as independent asyncio tasks, so a slow tool (a merge, a 300 s coder_wait) never delays a read-only call queued behind it. Responses are written whenever their task finishes — JSON-RPC matches them by id, so ordering is free. The lifecycle methods (initialize, tools/list, ping) stay inline: they are cheap and the host serialises them anyway. A notifications/cancelled from the host cancels the matching in-flight task, which is what frees a handler the host has given up on (the MCP host aborts a stdio call after its idle timeout, 30 minutes by default) instead of leaving it pinned forever.

Class LocalMCPServerBase

Extension point for local (in-process) MCP transports.

Local transports (e.g. stdio) may reserve stdout as the JSON-RPC channel, so all logging must go to stderr instead of a default handler that could write to stdout.

Parameter Type Default Description
config LocalServerConfig

Class StdioMCPServer

MCP server using stdio transport (core, local-only).

Parameter Type Default Description
config LocalServerConfig

Attributes:

Attribute Type Description
drain_timeout_s float | None

Method StdioMCPServer.start

Start the stdio MCP server.

Reads one JSON-RPC message per line from stdin and routes it through :meth:_admit; tools/call handlers run as their own tasks and may be answered out of order (JSON-RPC matches responses by id). The loop ends on stdin EOF or :meth:stop; handlers still in flight are then drained by :meth:_drain.

start()

Method StdioMCPServer.stop

Stop the stdio server, cancelling any in-flight tool calls.

stop()

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