Skip to content
English

MCP server

Pixling is preparing for Mac App Store release. Join the waitlist on pixling.app to hear when it launches.

Pixling exposes a loopback Streamable HTTP MCP server directly inside the app while MCP connection is turned on in Settings › Connect.

MCP endpoint
http://127.0.0.1:48271/mcp

If you are connecting an existing coding agent, start with Connect an agent. For the tool list and underlying vocabulary, see MCP tools and Operations.

There is no stdio transport and no separate helper process. Pixling never binds to 0.0.0.0, a LAN interface, or the IPv6 wildcard.

  • Fixed port (48271): If another app already holds port 48271, Pixling does not open MCP and shows a notice at the bottom of Settings › Connect (the CLI keeps working). Quit the other app, then toggle MCP connection off and on.
  • Optional bearer token: Protect MCP connection is off by default. Turning it on generates a 256-bit base64url token and requires Authorization: Bearer <TOKEN> on every request. Copy in Studio includes the header in its snippets (Set up your agent).
  • Token lifecycle: Toggling MCP connection or Protect MCP connection off deletes the stored token, and turning it back on generates a new one. Tokens never appear in URLs, MCP messages, tool results, or logs.

Pixling implements Streamable HTTP per the Streamable HTTP 2026-07-28 and Streamable HTTP 2025-11-25 specifications and the Codex MCP setup.

Minimal tool call (2026-07-28 profile)
curl -s http://127.0.0.1:48271/mcp \
-H 'Accept: application/json, text/event-stream' \
-H 'Content-Type: application/json' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-H 'Mcp-Method: tools/call' \
-H 'Mcp-Name: pixling_residents_list' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"curl","version":"1.0"},"io.modelcontextprotocol/clientCapabilities":{}},"name":"pixling_residents_list","arguments":{}}}'
Method Behavior
POST Sends one JSON-RPC message; returns one application/json object. Notifications return 202 Accepted with no body.
GET Returns 405 Method Not Allowed (Pixling does not use SSE streams).
DELETE Ends the session in MCP-Session-Id and returns 204 No Content.
Check or limit Rule
Sessions Up to 200 in memory, with no idle timeout. Creating a 201st drops the oldest-created session, even if still active.
Request size & concurrency Headers 32 KiB, body 1 MiB, 200 concurrent connections. No chunked transfer or HTTP pipelining; each connection handles one request and closes.
Caching Every response sets Cache-Control: no-store.
Host header Must be 127.0.0.1:<PORT> or localhost:<PORT> (case-insensitive). Missing or mismatched Host gets HTTP 403 before protocol parsing to block DNS rebinding.
Origin header When present, must be http://127.0.0.1[:PORT] or http://localhost[:PORT]; anything else gets HTTP 403.
Bearer token When protection is on, verified before protocol parsing.

Under RFC 9110, a Host header without a port implies port 80 and passes only if the listening port is 80.

Pixling serves two MCP protocol profiles on the same endpoint:

Profile Revisions Session model Metadata headers
Negotiated 2025-11-25, 2025-06-18 Stateful (MCP-Session-Id) MCP-Session-Id, MCP-Protocol-Version
Per-request metadata 2026-07-28 Stateless MCP-Protocol-Version, Mcp-Method, Mcp-Name

Used by Codex and clients targeting the 2025 specifications.

  • Follows initialize → notifications/initialized and returns a cryptographically random MCP-Session-Id. Subsequent requests must send both MCP-Session-Id and MCP-Protocol-Version.
  • Holds up to 200 sessions in memory and clears them when MCP stops.
  • Automatic rebinding: If an unknown MCP-Session-Id arrives with a negotiated MCP-Protocol-Version (for example after an app restart), Pixling rebinds that ID as ready so the client continues without re-initializing.
  • Handshake edge cases: An initialize on an unknown ID or a rebound session redoes the handshake under that ID. A second initialize on an already-initialized session fails with -32600.
  • Unknown session or version: An unknown session without a version header returns HTTP 404 and JSON-RPC -32001 (Session not found). An unrecognized MCP-Protocol-Version returns HTTP 400.
  • Tool results keep the standard shape of that protocol generation and omit ttlMs and cacheScope.
  • Stateless transport: no session is created, and each POST validates _meta.io.modelcontextprotocol/* (protocolVersion, clientInfo, and clientCapabilities).
  • MCP-Protocol-Version, Mcp-Method, and (for tools/call) Mcp-Name headers must match the request body; mismatches return HTTP 400 with JSON-RPC -32020.
  • Notifications (POST with no id) return HTTP 202 with no body. Their headers and _meta are not checked because the revision defines none for notifications.
  • Unimplemented methods return HTTP 404 with JSON-RPC -32601 (the negotiated profile uses the standard JSON-RPC response shape).
  • server/discover and tools/list return Caching (SEP-2549) metadata:
    • ttlMs: 0, because tools/list is filtered per request by live capabilities and user-toggled groups (Core and groups), and listChanged is never sent.
    • cacheScope: "private", because this is a personal loopback server.
  • Every tool’s input schema is a closed root object (additionalProperties: false). Per-tool contracts live in Messages and questions, Residents, Resident settings, and the other reference pages.
  • Only the tools capability is advertised. Resources, prompts, Tasks, subscriptions, and server-initiated requests are not offered.
  • Every call runs as the fixed identity mcp:local-mcp. Requester identity is never read from the HTTP payload or clientInfo (clientInfo is only used to validate the protocol peer).

Every tool result places the same control document as CLI --json in structuredContent and mirrors that JSON as text content for compatibility. Tools declare no output schema. The 2026-07-28 profile also adds resultType: "complete" and _meta.

Successful tools/call response (2026-07-28 profile)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"resultType": "complete",
"content": [
{
"type": "text",
"text": "{\"invocationID\":\"mcp-01234567-89ab-cdef-0123-456789abcdef\",\"ok\":true,\"operation\":\"residents.list\",\"protocolVersion\":1,\"result\":{\"displays\":[...],\"residents\":[...]}}"
}
],
"structuredContent": {
"ok": true,
"operation": "residents.list",
"invocationID": "mcp-01234567-89ab-cdef-0123-456789abcdef",
"protocolVersion": 1,
"result": {
"displays": [
{
"id": "display-1",
"name": "Built-in Retina Display",
"isMain": true,
"backingScaleFactor": 2,
"frame": { "x": 0, "y": 0, "width": 1512, "height": 982 },
"visibleFrame": { "x": 0, "y": 0, "width": 1512, "height": 945 },
"displayUUID": null,
"safeAreaTop": 37,
"auxiliaryTopLeftArea": null,
"auxiliaryTopRightArea": null
}
],
"residents": [
{
"entityID": "11111111-2222-3333-4444-555555555555",
"selector": "No.7#1",
"name": "Moku",
"number": 7,
"layer": "floating",
"visibility": "visible",
"presence": "everywhere",
"displayID": "display-1",
"footprint": { "x": 1180, "y": 48, "width": 160, "height": 160 },
"size": 160
}
]
}
},
"isError": false,
"_meta": {
"io.modelcontextprotocol/serverInfo": {
"name": "Pixling",
"version": "1.0.0"
}
}
}
}

Results evolve additively: ignore unknown fields and enum values. Calls using a deprecated form include deprecations beside result (see CLI: Compatibility). tools/list does not mark deprecated tools.

Case Returned as
Unknown tool or malformed JSON-RPC / params / metadata JSON-RPC protocol error (-32602 and others)
Refused tool argument Tool result (isError: true) with error.code: "invalidArguments"
App unavailable, target not found, or domain rejection Typed tool result (isError: true)
Rate limit (1000 req/s per ingress) Tool result (isError: true) with error.code: "rateLimited"
Internal server failure (such as encoding) JSON-RPC -32603

An unreadable value, unknown key, or missing required key never reaches the app. Pixling returns it as a tool result (isError: true) rather than a JSON-RPC error because many hosts hide JSON-RPC errors from the model:

invalidArguments tool result
{
"ok": false,
"operation": "sequence.start",
"invocationID": "...",
"protocolVersion": 1,
"error": {
"code": "invalidArguments",
"field": "steps[2].to",
"problem": "...",
"hint": "..."
}
}
  • Unknown tool: Tells the client to refresh tools/list or reconnect when the cached tool list disagrees with the running app build.
  • Runaway fence (rateLimited): Caps each ingress at 1000 requests/second to stop infinite loops, not as a quota. It is distinct from domain rejected so hosts can back off and retry.
  • Build identification: capabilities.get returns each operation’s {id, access} (with deprecated when scheduled for removal) and app {version, build, commit, protocolVersion} (commit is unknown when unavailable). Compare this against the caller’s build (CLI: pixling --version) after an unknown tool or unknownOperation.
  • Per-resident message receipts: message.send succeeds per resident, so the call stays ok; unshown entries carry rejection, heldBecause, and hint inside their receipt (Messages and questions).
  • Unbound or stowed clients: inbox.watch on an unbound namespace/key returns rejected / notBound immediately without waiting (Inbox). Targeting an unbound or stowed client:<namespace>/<key> returns targetNotFound with a hint to check resident.ensure for onDesk vs. stowed (Resident binding).
  • Opaque promptID: Pass promptID only from question.ask to question.result or question.cancel (Messages and questions).

See Read refusals for recovery patterns.

Defense-in-depth layers
1. Explicit opt-in in Settings (nothing listens when CLI & MCP are off)
2. Loopback-only binding (127.0.0.1:48271)
3. Origin validation + Host validation (anti-DNS-rebinding)
4. Optional 256-bit bearer token
5. Fixed client identity (mcp:local-mcp)
6. Closed allowlist of operations + user-toggleable tool groups
7. Limits: 200 concurrent connections, 1000 req/s runaway fence per ingress