Provides a structured HTTP client tool that supports GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS requests with configurable headers, timeouts, redirect handling, and session persistence. Returns structured responses including status codes, headers, body content, timing metrics, and error handling.
curl-mcp
curl-mcp is an open-source HTTP/cURL tool for the Model Context Protocol (MCP).
It provides a single tool:
curl_request
This server is intended for use with any MCP-compatible client, such as:
ChatGPT Desktop
Roo Code
Cursor
Cline
Continue.dev
Custom MCP agents
No client-specific configuration examples are included here β each MCP client provides its own method for adding local MCP servers.
You simply run
β¨ Features
π MCP transports
Stdio for local dev and an Express-based HTTP server for hosted clients.π§° Full HTTP support
SupportsGET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS.π§± Structured responses
Status, headers, content-type, timing, size, body (text/pretty JSON/base64), advice.πͺ Session & redirect control
In-memory cookie jar per host (persist_session),follow_redirectstoggle,clear_sessionhelper.π Timeout & network handling
Abort controller with error typing: timeout, DNS, connect, SSL, generic network.π§ͺ Integration-test friendly
Self-describing JSON scenarios indocs/integration-tests.json.
π Quick Start
From source (local clone):
npm install npm run dev:stdio # stdio transport npm run dev:http # HTTP transport (default: http://localhost:3000/mcp)From CLI (installed):
brew install calibress/mcp/curl-mcp # or: npm install -g @calibress/curl-mcp curl-mcp # stdio curl-mcp --http # HTTP (set PORT or MCP_PORT to change 3000)
Then point your MCP client at the command you use (see configs below).
π¦ Installation (from source)
βΆοΈ Running the MCP server
You can run curl-mcp either directly from this source repo, or via an installed CLI on your PATH.
From source (local clone)
From the root of your local curl-mcp clone:
This launches the curl-mcp MCP server on stdio.
Configure your MCP client to run that same command in the repo directory.
Some clients let you set the working directory explicitly; others work better if you pass a --prefix pointing at your clone.
For example, an mcpServers JSON block might look like:
Make sure the working directory for the command is the root of your local curl-mcp clone.
From CLI (
If curl-mcp is on your PATH (for example via Homebrew or npm), point your MCP client at it directly without using npm run:
Important:
MCP clients each have their own method of adding a local MCP server and choosing the working directory.
Use the examples above as a guide, but refer to your clientβs documentation for the exact configuration format.
HTTP transport (Express)
Start the HTTP server:
Port and hardening (optional):
Port: defaults to 3000; override with
PORTorMCP_PORT(e.g.,PORT=3400 npm run dev:http).MCP client config should match the server port, e.g.
"url": "http://localhost:3400/mcp".If the port is in use, pick another free port and reflect it in the URL (some clients let you set host/port separately; otherwise include the port in the URL).
Auth/allowlist (default: off). Opt in via env vars:
MCP_REQUIRE_KEY=trueandMCP_API_KEYS=key1,key2(checksAuthorization: Bearer <key>orX-API-Key)MCP_ALLOWED_HOSTS=host:port,otherhost:port(Host header check)MCP_ALLOWED_ORIGINS=https://yourapp.com(Origin check + CORS allowlist) If unset, the server stays open for local/dev use.
Point your MCP client at the HTTP endpoint (default http://localhost:3000/mcp):
π Smoke test (HTTP)
Start the HTTP server:
npm run dev:http(orcurl-mcp --http).Run the smoke script:
npm run smoke:http(setMCP_URLto override the endpoint).You should see a one-line summary with the returned status/timing.
π Tool: curl_request
Input (schema overview)
Output (schema overview)
Notes:
Default
User-Agentis injected if none is provided (curl-mcp/<version>); override via headers if needed.response_typedefaults to text. Usejsonto parse/pretty-print JSON,binaryfor base64 + content-type/size metadata (exposed viaresponse.content_type).persist_sessionkeeps cookies in-memory per host for chained calls;follow_redirects=falselets you capture the redirect + Set-Cookie;clear_sessionwipes cookies for the host before issuing the request.Bodies are allowed on any verb (useful for APIs that accept GET with bodies).
Common headers example:
π§ͺ Integration Tests
The file:
contains human- and AI-readable integration scenarios such as:
simple GET
POST echo
header round-trip
timeout and error handling
redirects on/off
cookies + session reuse + clearing
binary base64 + content-type
JSON parse fallback
joke/cat/dog APIs
NASA APOD
Weather data for London
These can be executed manually or by an MCP client/agent using curl_request.
π Public Project Structure
π₯ Requirements
Node.js 20 or later (native
fetchsupport)
π§ Roadmap
HTTP auth options (API key/bearer) for hosted deployments
Lightweight metrics/logging switch
More ready-made smoke/health checks
Packaging and publishing updates
π License
MIT