Docs menu
DocsAPI reference

MCP client

Be a full MCP client on the OS substrate — Streamable HTTP and stdio transports.

Be a full MCP client on the OS substrate — the same transports the built-in Connect app uses. Capability: mcp — prompts per server host / command prefix.

Streamable HTTP server

const resp = await window.chatoss.mcp.httpRequest({
  url: 'https://mcp.example.com/mcp',
  body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'initialize', params: {...} }),
  headers: { 'Content-Type': 'application/json' },
  timeoutMs: 30000,
});
// → { status, contentType, body, sessionId } — the server host prompts per request

stdio server (a local process)

const session = await window.chatoss.mcp.stdioStart({ command: 'npx', args: ['-y', '…'], env: {} });
const line = await window.chatoss.mcp.stdioRequest(session, JSON.stringify({ jsonrpc: '2.0', id: 2, method: 'tools/list' }), '2', 30000);
await window.chatoss.mcp.stdioNotify(session, JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }));
await window.chatoss.mcp.stdioStop(session);

The stdio transport rides process.spawn under the hood — pipes without a PTY, so line-delimited JSON-RPC arrives intact.