@ahmedshaikh/http-client-mcp
v0.1.0
Published
Structured HTTP requests as an MCP server — auth (via env, not pasted secrets), retries, timeouts, query params, and parsed JSON responses, so agents stop doing fragile curl gymnastics.
Maintainers
Readme
http-client
Structured HTTP requests for agents — so they stop shelling out to curl and
hand-parsing output. One tool, a clean request in, a structured response out
(status, headers, parsed JSON body), with auth, retries, and timeouts built in.
http_request({ url: "https://api.example.com/users", query: { active: true }, bearer_env: "API_TOKEN" })
→ { ok: true, status: 200, body: { users: [ … ] }, duration_ms: 180, attempts: 1 }Why
curl works but is fragile from an agent: shell-escaping bodies, no structured
result, no retry, secrets pasted on the command line. This makes an HTTP call a
typed operation — and auth via bearer_env means the token comes from an
environment variable, never the call itself.
The tool
http_request — params: url, method, headers, query, json (body),
body, bearer_env / bearer_token, basic_user/basic_pass, timeout_ms,
retries. Returns { ok, status, status_text, headers, body (parsed if JSON),
body_truncated, content_type, duration_ms, attempts, error? }.
- Retries on 5xx and network errors (exponential-ish backoff).
- Timeout via
AbortController→ a structurederror, never a throw. - JSON request bodies (
json) and auto-parsed JSON responses. - Bodies capped (default 100 KB) with
body_truncatedflagged. http/httpsonly.
Setup
npm install
npm test # runs against a local mock server — no network neededclaude mcp add http-client -- node /abs/path/http-client/dist/server.js
# CLI: agent-http GET https://api.github.com/zen
# agent-http POST https://api.example.com/x --json '{"a":1}' --bearer-env API_TOKENHonest limits
- No SSRF guard — it'll request internal URLs. Fine for a local dev agent; don't expose it to untrusted callers without an allowlist.
- Response bodies are truncated past the cap (raise
max_body_kbif needed). - No streaming — returns the (capped) full body.
