vibe-sketcherDocumentation

vibesketcher.agent.client

A small client for vibe-sketcher’s REST API, on the standard library alone.

The MCP server calls the same API the browser does, so an agent’s edit and a human’s go through one revision counter and show up in each other’s view.

Functions

find_server([host, ports])

The address of a vibe-sketcher server running on this machine, or None.

start_server([store, host])

Start a vibe-sketcher server in a background thread; returns its address.

Classes

RestClient(base_url, *[, timeout])

JSON calls against one vibe-sketcher server.

Exceptions

ServerError(status, detail)

The server answered with an error status; detail is its explanation.

class vibesketcher.agent.client.RestClient(base_url, *, timeout=300.0)[source]

Bases: object

JSON calls against one vibe-sketcher server.

Parameters:
raw(method, path, body=None)[source]

The response body and its content type; raises ServerError.

Parameters:
Return type:

tuple[bytes, str]

call(method, path, body=None)[source]

The decoded JSON response.

Parameters:
Return type:

Any

exception vibesketcher.agent.client.ServerError(status, detail)[source]

Bases: RuntimeError

The server answered with an error status; detail is its explanation.

Parameters:
  • status (int)

  • detail (Any)

Return type:

None

vibesketcher.agent.client.find_server(host='127.0.0.1', ports=range(8766, 8776))[source]

The address of a vibe-sketcher server running on this machine, or None.

serve takes the first free port from 8766, so the search walks the same range and recognises vibe-sketcher by its session route.

Parameters:
Return type:

str | None

vibesketcher.agent.client.start_server(store=None, host='127.0.0.1')[source]

Start a vibe-sketcher server in a background thread; returns its address.

The port is chosen by the operating system and the socket is handed to uvicorn already bound, so no other process can take it in between.

Parameters:
Return type:

str