vibesketch.agent.mcp

The MCP server: vibe-sketch as tools for an agent (roadmap WP 2.6).

vibe-sketch mcp speaks the Model Context Protocol over standard input and output (newline-delimited JSON-RPC 2.0: initialize, ping, tools/list, tools/call). Every tool is a call to the REST API, so an agent edits documents through the same revision counter as the browser: when a vibe-sketch server is already running on this machine, the agent works on the documents its user has open, and the user sees each edit within seconds. When none is running, the MCP server starts one in the background and the status tool gives its address for the user to open.

The protocol layer is a few dozen lines of the standard library; nothing here needs an MCP SDK.

Module Attributes

PROTOCOL_VERSIONS

Protocol revisions this server speaks, newest first.

Functions

handle(message, tools)

The response to one JSON-RPC message; None for a notification.

make_tools(client)

The tools, each a call to the server client points at.

serve(client[, reader, writer])

Answer MCP messages from reader (standard input) until it closes.

Classes

Tool(name, description, schema, run)

Exceptions

ToolError

A tool could not do what was asked; the message goes back to the agent.

vibesketch.agent.mcp.PROTOCOL_VERSIONS = ('2025-06-18', '2025-03-26', '2024-11-05')

Protocol revisions this server speaks, newest first.

class vibesketch.agent.mcp.Tool(name: 'str', description: 'str', schema: 'dict[str, Any]', run: 'Callable[[dict[str, Any]], Any]')

Bases: object

Parameters:
name: str
description: str
schema: dict[str, Any]
run: Callable[[dict[str, Any]], Any]
listing()
Return type:

dict[str, Any]

vibesketch.agent.mcp.handle(message, tools)

The response to one JSON-RPC message; None for a notification.

Parameters:
Return type:

dict[str, Any] | None

vibesketch.agent.mcp.make_tools(client)

The tools, each a call to the server client points at.

Parameters:

client (RestClient)

Return type:

list[Tool]

vibesketch.agent.mcp.serve(client, reader=None, writer=None)

Answer MCP messages from reader (standard input) until it closes.

Parameters:
Return type:

None