Don't Forget: Remote MCP Servers Are Just Curl Calls (www.joshbeckman.org)

🤖 AI Summary
This post demonstrates that remote MCP (Model-Connected-Protocol) servers are just ordinary HTTP endpoints you can call with curl (or any HTTP client). The author provides a reusable cURL/JSON-RPC template: POST to the server URL with Content-Type: application/json and Accept: text/event-stream, application/json, and a body like {"jsonrpc":"2.0","id":"<SESSION_ID>","method":"tools/call","params":{"name":"<TOOL>","arguments":{...}}}. Responses come back as Server-Sent Events (SSE) whose data: lines contain JSON results (e.g., result.content = [{"type":"text","text":"..."}]). Example snippets show how to parse SSE with grep/sed/jq, how to stream/parse in JavaScript, and sample Ruby/GraphQL representations of the MCP content schema. Why it matters: MCP tool invocations are a simple, standardized HTTP pattern that avoids proprietary SDK lock‑in and can be implemented in any language or pipeline. Important technical points: include authorization headers if required, any unique string can serve as the session id, handle SSE by filtering "data: " lines and ignoring "[DONE]", and extract JSON.result.content items. That makes it trivial to call a growing ecosystem of MCP tools from shells, servers, or client apps while preserving structured outputs (text, image, resource) for integration into ML workflows and orchestration layers.
Loading comments...
loading comments...