mcp-rest-api-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-rest-api-server summarize the workspace and list open tasks for the top project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-rest-api-server
Portfolio demo, not client work. Built by Mustafa as a reference template for wrapping any REST API as a Model Context Protocol server. The Harborline API in this repo is fictional sandbox data.
A TypeScript MCP server Claude Desktop, Claude Code, and Cursor can launch. Stdio and Streamable HTTP, Zod, cursor pagination, retries, and a read-only switch. Leave API_BASE_URL unset and the CLI boots the Harborline sandbox. No external account.

60-second quickstart
git clone https://github.com/mustafaautomation/mcp-rest-api-server.git
cd mcp-rest-api-server
npm install
npm run build
node dist/cli.js --help
npm run demoPoint Claude Desktop, Claude Code, or Cursor at the built CLI. Config snippets are in docs/configs/. For a checkout that is not published to npm yet:
{
"mcpServers": {
"harborline": {
"command": "node",
"args": ["/absolute/path/to/mcp-rest-api-server/dist/cli.js"],
"env": { "MCP_READ_ONLY": "true" }
}
}
}The hosted read-only demo, once this repo is deployed at the apex domain, is https://mcp-api.quvantic.com/mcp. It serves the same sandbox. It does not accept writes.
The package is publish-ready (npx mcp-rest-api-server) and has not been published from this repo.
Related MCP server: mcp-api-bridge
Adapt to your API in 15 minutes
Set
API_BASE_URLand a read-onlyAPI_KEY. The sandbox steps aside.Replace the Zod objects in
src/api/schemas.tswith your JSON.Map each endpoint to a method on
src/api/client.ts. Tools do not callfetch.Register the tools in
src/mcp/tools.ts. Leave write tools under theconfig.readOnlycheck.npm test, then paste a config fromdocs/configs/.
Page-number APIs stay behind cursorToPage / pageToCursor in src/api/pagination.ts. The model still sends cursor and limit. The longer walkthrough is docs/ADAPT.md.
Architecture
flowchart LR
subgraph clients [MCP clients]
Desktop[Claude Desktop]
Code[Claude Code]
Cursor[Cursor]
end
subgraph process [mcp-rest-api-server]
Transport[stdio or Streamable HTTP]
Layer[Tools, resources, prompts]
Gate[Zod and read-only gate]
HTTP[REST client]
end
API[(Harborline sandbox or your API)]
Desktop --> Transport
Code --> Transport
Cursor --> Transport
Transport --> Layer --> Gate --> HTTP --> APIstdout is the protocol. Logs go to stderr. The API key is read from the environment, attached as Authorization: Bearer or x-api-key, and scrubbed from log lines and tool errors.
The server uses @modelcontextprotocol/sdk 1.32.2, the latest release of that package. It speaks MCP 2025-11-25.
Tools
Read tools are always registered.
Tool | What it does |
| Counts of projects, tasks, and contacts |
| One page of projects |
| One project by id |
| Tasks, filterable by project, status, assignee |
| One task by id |
| Contacts, with an optional search string |
| One contact by id |
Write tools are registered only when the server is started with --read-write or MCP_READ_ONLY=false.
Tool | What it does |
| Create a task on an existing project |
| Patch one or more fields |
| Create a contact. Email must be unique |
The REST client also refuses POST and PATCH while read-only is on. A new write tool cannot bypass the flag by forgetting the check.
List tools take limit (1–100, default 20) and cursor. The result includes nextCursor and hasMore. Pass nextCursor back as cursor. Omit it to start over. Cursors are opaque. Don't invent them.
Resources
URI | Body |
| Live counts, plus the server's read-only flag |
| Auth, pagination, and the endpoint list. No live API key |
| One project and its tasks |
Prompts
Prompt | Arguments | What the model receives |
|
| A brief grounded in the live project and tasks |
|
| A short email. Tone is |
Configure
Copy .env.example. Real environment variables win over the file. Shell flags win over both.
Variable | Default | Role |
| embedded sandbox | Upstream origin. Required for a real API |
|
| Required once |
|
|
|
|
| Header used for |
|
|
|
|
| Per-attempt timeout |
|
| Extra attempts after the first |
|
| Backoff base. Jitter is full |
|
| Cap, including |
|
| Token bucket refill |
|
| Burst shared by the process |
|
| HTTP bind host |
|
| HTTP bind port |
| unset | Bearer token required on |
|
|
|
--api-key exists and should be avoided. Flags are visible to other users on the machine. Put the key in the environment.
Retries: GET retries on 408, 429, 5xx, timeouts, and network errors. POST and PATCH retry on 408, 429, and connection failures that never left the machine (ECONNREFUSED, ENOTFOUND). A 500 on a write is returned once. Retry-After is honored up to API_RETRY_MAX_MS.
Errors from tools look like this:
{
"error": {
"code": "not_found",
"message": "Project prj_missing was not found.",
"status": 404,
"requestId": "req_ab12cd34",
"retryable": false
}
}Codes: unauthorized, not_found, validation, rate_limited, conflict, upstream, timeout, network, read_only.
Clients
Stdio is the path all three clients launch. The snippets in docs/configs/ use npx. Until the package is on npm, point command at Node and args at dist/cli.js.
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows. See docs/configs/claude-desktop.json.
{
"mcpServers": {
"harborline": {
"command": "npx",
"args": ["-y", "mcp-rest-api-server"],
"env": {
"API_BASE_URL": "https://api.example.com",
"API_KEY": "YOUR_API_KEY",
"MCP_READ_ONLY": "true"
}
}
}
}Local checkout, sandbox included:
{
"mcpServers": {
"harborline": {
"command": "node",
"args": ["/absolute/path/to/mcp-rest-api-server/dist/cli.js"],
"env": { "MCP_READ_ONLY": "true" }
}
}
}Claude Code
Project file .mcp.json, or user scope. See docs/configs/claude-code.mcp.json.
{
"mcpServers": {
"harborline": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-rest-api-server"],
"env": {
"API_BASE_URL": "https://api.example.com",
"API_KEY": "YOUR_API_KEY",
"MCP_READ_ONLY": "true"
}
}
}
}claude mcp add harborline \
-e API_BASE_URL=https://api.example.com \
-e API_KEY=YOUR_API_KEY \
-e MCP_READ_ONLY=true \
-- npx -y mcp-rest-api-serverCursor
~/.cursor/mcp.json or .cursor/mcp.json in the project. See docs/configs/cursor.mcp.json.
{
"mcpServers": {
"harborline": {
"command": "npx",
"args": ["-y", "mcp-rest-api-server"],
"env": {
"API_BASE_URL": "https://api.example.com",
"API_KEY": "YOUR_API_KEY",
"MCP_READ_ONLY": "true"
}
}
}
}Streamable HTTP
node dist/cli.js http --port 8787The process listens on 127.0.0.1 and checks the Host header. Bind 0.0.0.0 only when you set MCP_HTTP_TOKEN. The MCP endpoint is POST /mcp and answers JSON. GET /health is unauthenticated so a probe can use it.
MCP_HTTP_TOKEN=choose-a-long-token node dist/cli.js http --host 0.0.0.0 --port 8787docs/configs/streamable-http.json shows the client side. Inspector:
npx @modelcontextprotocol/inspector --cli node dist/cli.js --method tools/list
npx @modelcontextprotocol/inspector --cli node dist/cli.js \
--method tools/call --tool-name list_projects --tool-arg limit=2npm run demo drives the same server with the official SDK client and prints a page of projects, a resource, and a prompt. A recording of that session is in docs/demo.gif. Regenerate it with vhs docs/demo.tape after npm run build.
Harborline sandbox
Fictional studio ops: six projects, sixteen tasks, eight contacts. The public demo key is sandbox-demo-key. It is not a credential for anything else.
node dist/cli.js mock --port 8788
curl -s localhost:8788/v1/projects?limit=2 -H "Authorization: Bearer sandbox-demo-key"GET /health does not require a key. Everything under /v1 does, via bearer or x-api-key.
Docker
docker build -t mcp-rest-api-server .
docker run --rm -p 8787:8787 mcp-rest-api-serverThe image serves Streamable HTTP on 0.0.0.0:8787 and boots the sandbox inside the container. Pass API_BASE_URL and API_KEY to use a real API, and MCP_HTTP_TOKEN before the port is reachable beyond your machine.
docker run --rm -p 8787:8787 \
-e API_BASE_URL=https://api.example.com \
-e API_KEY=YOUR_API_KEY \
-e MCP_READ_ONLY=true \
-e MCP_HTTP_TOKEN=choose-a-long-token \
mcp-rest-api-serverScripts
Script | What it does |
| Run the CLI from TypeScript |
| Vitest. Unit tests plus integration against the sandbox |
| ESLint |
|
|
| Emit |
| Client session recorded in |
|
|
CI (.github/workflows/ci.yml) runs lint, typecheck, test, and build on Node 22, then builds the Docker image and curls /health.
Publish
The bin entry is mcp-rest-api-server. npm pack runs the build. This checkout has not been published. When you publish from a machine that has npm credentials:
npm whoami
npm publish --access publicConfirm the name mcp-rest-api-server is still free first. No token is stored in this repo.
Landing page and hosted demo
Deploy the repository root on Vercel (Hobby is enough). The build copies site/ to public/ and publishes two functions:
Path | What it is |
| Landing page |
| Read-only Streamable HTTP demo. JSON responses, sandbox data, no API key to configure |
| Liveness JSON |
Import the repository in Vercel, or upload a prebuilt folder. Root Directory is the project root. Framework preset: Other.
From git, the build command in
vercel.jsonisnpm run vercel-build. A direct upload can skip that compile: shipapi/,public/,dist/, and apackage.jsonwhose only dependencies are the public packages@modelcontextprotocol/sdk,hono, andzod, and set the build command to empty. Vercel still runsnpm install.Add the domain
mcp-api.quvantic.com.Connect a client to
https://mcp-api.quvantic.com/mcp.
The function is stateless and answers in one POST, with maxDuration of 10 seconds, which fits the Hobby plan. Do not point the hosted demo at a real API key. Writes stay off. A separate site/ root directory serves the page only and does not include /mcp.
FAQ
Is this a client project? No. Portfolio demo. Harborline is fictional.
Does the model see my API key? No. The key is an environment variable. Tool errors and logs scrub it.
Can it create records?
Only when you start it with --read-write or MCP_READ_ONLY=false. The hosted demo does not.
What if my API uses page numbers?
Keep the tool arguments as cursor and limit. Translate inside the REST client. See docs/ADAPT.md.
Which clients?
Claude Desktop, Claude Code, and Cursor over stdio. Anything that speaks Streamable HTTP can use /mcp.
Where do I hire this? docs/OFFER.md. Three fixed-price packages.
Layout
src/cli.ts stdio, http, and mock commands
src/server.ts MCP server factory
src/api/client.ts auth, pagination, rate limit, retries
src/mcp/ tools, resources, prompts
src/mock/ Harborline sandbox
docs/ADAPT.md replace Harborline with your API
docs/OFFER.md Fiverr gig and Upwork opening
docs/configs/ copy-paste client config
site/ landing pageLicense
MIT. Copyright Mustafa.
Available Tools
7 toolsget_contactGet contactBRead-onlyIdempotent
Fetch one contact by id.
Inputs: contactId (required). Returns: contact
get_projectGet projectBRead-onlyIdempotent
Fetch one Harborline project by id, for example prj_northline.
Inputs: projectId (required). Returns: project
get_taskGet taskARead-onlyIdempotent
Fetch one task by id.
Inputs: taskId (required). Returns: task
get_workspace_summaryWorkspace summaryARead-onlyIdempotent
Counts of Harborline projects, tasks, and contacts, including tasks by status. Read-only.
Inputs: no named parameters. Returns: summary, readOnly
list_contactsList contactsARead-onlyIdempotent
List contacts. Optional q matches name, email, company, or role. Pages use cursor and limit.
Inputs: q, limit, cursor. Returns: limit, hasMore, contacts, nextCursor
list_projectsList projectsARead-onlyIdempotent
List Harborline projects one page at a time. Pass nextCursor back as cursor for the next page.
Inputs: limit, cursor. Returns: limit, hasMore, projects, nextCursor
list_tasksList tasksARead-onlyIdempotent
List tasks. Filter by projectId, status, or assigneeId. Pages use cursor and limit.
Inputs: limit, cursor, status, projectId, +1 more. Returns: limit, tasks, hasMore, nextCursor
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool maps to a distinct resource+action pair: three list_* tools for paging collections, three get_* tools for single-record fetches, and one summary/aggregate tool. The list/get split is explicit and reinforced by descriptions mentioning paging cursors versus id lookups. No two tools could plausibly be confused.
Uniform snake_case verb_noun pattern throughout (get_*, list_*), with resources named consistently as projects, tasks, and contacts. The one aggregate tool, get_workspace_summary, still fits the get_* convention.
Seven tools is well within the ideal range and every tool earns its place: one list and one get per each of the three entities, plus a summary. Nothing is redundant or padded.
Read coverage is complete and symmetric across all three resources (list + get for projects, tasks, contacts, plus an aggregate summary). The surface is read-only, and list_projects lacks the query/filter capability that list_tasks and list_contacts have, which is a minor asymmetry rather than a blocking gap.
Maintenance
Related MCP Connectors
AI-callable tools for API mocking, testing, monitoring, security, and automation.
Connect ChatGPT or Claude to your CRM, store or shipping API. Keys stay out of the chat.
Build, debug and break hosted mock APIs from Claude: endpoints, stateful CRUD data, OpenAPI import, response variants and fault injection.
Verified, pay-per-use API tools for AI agents through one authenticated connection.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceConverts any REST API endpoints into MCP tools, enabling AI clients like Cursor and Claude Desktop to call internal services directly.-
- AlicenseBqualityCmaintenanceEnables AI assistants like Claude to interact with any REST API through typed, validated MCP tools. Provides a pattern to wrap REST APIs as MCP servers.4MIT
- AlicenseNot gradedqualityCmaintenanceBridges any OpenAPI 3.x REST API to Claude Code by automatically generating one tool per endpoint from your spec, with full argument validation and auth support.5 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to discover and call any REST API from an OpenAPI/Swagger spec or Postman collection at runtime, with authentication, workflows, and prebuilt registry support.MIT