cURL to MCP Tool: Turn One API Request Into an AI Tool
The fastest way to build an MCP tool is to start from a cURL command. Nearly every API reference shows one, and browser developer tools can copy any request as cURL. GetMCP’s cURL to MCP tool import reads that command, works out the method, URL, headers and body, turns the variable parts into parameters, and pulls the credentials out so the AI client never sees them.
This guide is for developers, agencies and SaaS teams who want one endpoint working in Claude, ChatGPT or Cursor in minutes, and it covers the cURL to MCP tool path from paste to publish. It explains exactly what the importer maps, what it refuses to carry over, and the details that make the difference between a tool that works once and one that works every time.
What is cURL import?
cURL import is one of the ways to create a tool in GetMCP. You paste a single curl command and get a single tool: one HTTP request, with a typed parameter for each value the AI client should supply. The command is parsed in your browser as part of the Tool Editor, and nothing is saved until you choose to save the tool.
You can reach it three ways:
- On a server’s Tools tab, open Import Tools and choose From cURL.
- Click Add Tool and pick Paste cURL on the “How would you like to create your tool?” screen.
- Inside any existing tool, click Re-import from cURL under the Endpoint URL.
How cURL to MCP tool import works
- Paste the command. The Import from cURL dialog takes the whole command in the cURL Command box. Multi-line commands with backslash continuations, single or double quotes, and
$'…'strings all work. A copied shell prompt ($) orsudoin front is stripped, but the command itself must start withcurl. - Click Parse cURL. The preview shows the Method, the Auth Detected (masked), the URL, the Headers and a Parameters table with Name, Type, Source and Required. Rename a parameter, change its type, toggle Required or remove it right there.
- Read the warnings. Anything the importer could not carry over is listed in an amber box instead of being dropped silently.
- Click Import & Continue. The Tool Editor opens with the method, endpoint URL, parameters, request body template and custom headers filled in, plus any timeout, SSL or redirect options the command set.
- Name and describe the tool. Add a Tool Name and a Description; the model reads both when deciding what to call.
- Test and publish. Use Run Test in the right-hand panel, then Save Draft or Publish.

Here is a typical command from an API reference, with Acme as the example service:
curl -X POST 'https://api.acme.example/v1/projects/{project_id}/tasks' \
-H 'Authorization: Bearer sk_live_…' \
-H 'Content-Type: application/json' \
-d '{"title": "Design review", "due_date": "2026-11-02", "assignee": {"email": "[email protected]"}}'
GetMCP turns it into a POST tool with a required project_id path parameter, optional title, due_date and assignee_email body parameters, and a Content-Type header. The bearer token is detected and kept out of the tool entirely. The nested assignee.email field becomes a parameter named assignee_email, and GetMCP rebuilds the nested JSON when the tool runs.
What the importer reads from your command
| In the command | In the MCP tool |
|---|---|
-X, --request | The HTTP method. Sending data without -X makes it a POST, as cURL does. |
{id}, :id or {{id}} in the path | A required path parameter. The URL is stored with {{id}}. |
| Query string keys | Query parameters with a detected type, removed from the stored URL. |
-d, --data, --data-raw, --data-binary, --data-ascii | Body parameters from a JSON or form body. Nested objects are flattened up to four levels. |
--data-urlencode | A query parameter. |
-H, --header | Custom headers sent with every call. Content-Type is kept. |
Authorization: Bearer, --oauth2-bearer | Detected as a bearer token and kept out of the tool. |
-u, --user, Authorization: Basic | Detected as basic auth and kept out of the tool. |
x-api-key, apikey, api-key and similar headers; api_key=, access_token=, key= and similar query keys | Detected as an API key and removed from the headers or URL. |
-G, --get | Forces GET and moves the data to the query string. |
-k, --insecure | Turns SSL Verification off. |
-L, --location | Turns Follow Redirects on. |
--max-time, -m, --connect-timeout | Sets Timeout (seconds). |
Bundled switches such as -sSL | Understood, so a command copied from docs pastes cleanly. |
Types are detected from the sample values: whole numbers become integer, decimals number, true and false become boolean, lists become array with a description of their items, and everything else is a string.
What it will not carry over
Multipart forms (-F), file uploads (-T), bodies read from @file, cookies (-b), proxies, client certificates, Unix sockets, byte ranges and AWS SigV4 signing each produce a warning that says what was skipped and what to do instead. If an API’s docs escaped the query string as &, GetMCP decodes it and tells you, so parameters do not arrive named amp;page.
Where the credential goes
A pasted command usually carries a real token, so GetMCP treats it as a secret. The token is shown masked in the preview for reference, never becomes a tool parameter and is not written into the tool’s headers. You enter the credential once on the server’s Authentication tab, under Server-stored API credential, where it is stored encrypted and used by every tool on that server. Only one credential is taken per command; if the command carries a second one, a warning tells you it was not imported and where to configure it.
Use cases
Ship a “create task” tool from your own API docs
A SaaS team copies the create-task example from its API reference. Two minutes later its customers can add tasks by asking Claude, with the project ID as a required argument.
Flow: API docs example → Import from cURL → create_task → Acme API
Quote shipping rates while answering customers
An online store pastes its carrier’s rate-quote cURL. Destination postcode and parcel weight become parameters, and support staff ask the assistant for a quote during a chat with a customer.
Flow: “What does 2 kg to Leeds cost?” → get_rates → carrier API → price list
Search a helpdesk from the AI client
A support lead imports the helpdesk’s search endpoint. The query string keys (status, requester, page) become optional query parameters the model fills as needed.
Flow: “Open tickets from Yuki Tanaka” → search_tickets → helpdesk API
Add contacts to a marketing list
A marketer pastes the email platform’s “add contact” example. The list ID moves into the body template, and the model only supplies the email address and name.
Flow: Event sign-up conversation → add_contact → email platform API
Expose one internal admin endpoint
An operations team copies a request from the browser’s network tab with “Copy as cURL”. GetMCP flags the session cookie, so the team swaps it for a proper API token on the Authentication tab before anyone relies on the tool.
Flow: DevTools request → Import from cURL → cookie warning → API token on the server
Give an AI agent live weather data
A developer pastes a forecast request with latitude and longitude in the query string. Both become number parameters, and an agent in Cursor can fetch the forecast for any location.
Flow: Agent step → get_forecast → weather API → JSON trimmed by a selector
Prototype a client’s API for an agency pitch
An agency pastes three cURL examples from Northwind’s docs into three tools on a demo server, then shows the client their own API answering inside Claude.
Flow: Three cURL commands → three tools → one server URL → Claude demo
Tips and gotchas
- Sample values are examples, not defaults. The values in your command are stored as examples, which prefill the test panel but are never substituted on real calls. Set a Default Value yourself where one makes sense.
- Check the body template. The whole sample body is kept in Request Body Template, and the AI’s values are written on top. Fields the model does not fill are sent exactly as in your sample, so blank any value that should not be resent, such as a test email address.
- Mark what the API requires. A single command shows what one caller sent, not what the API demands, so body and query parameters import as optional. Path parameters are always required.
- Watch number-like strings. A value such as
02134is detected as an integer. Switch it tostringwhen leading zeros matter. - Re-import keeps your work. Re-import from cURL merges the new command into the tool and keeps the name, description, tags, response mapping, and each parameter’s description and default.
- Debug the other way round. After a test, Copy as cURL on the Outbound Request gives you the exact request GetMCP sent, with the Authorization header redacted.
One command makes one tool. When you have a whole API description, an OpenAPI, Swagger or Postman import creates a tool per operation in one pass.
Related features
- The Tool Editor: refine parameters, add a response selector and test every imported tool.
- OpenAPI import: bring in every operation from a spec instead of one command at a time.
- API authentication: where the server-stored credential lives and how test credentials differ.
- GetMCP overview: how a whole REST API becomes an MCP server.
FAQ
Does GetMCP save the token from my cURL command?
Not as part of the tool. The Tool Editor shows the detected token masked so you know what was found, and you enter it on the server’s Authentication tab, where it is stored encrypted. The AI client never receives it.
Can one cURL to MCP tool import create more than one tool?
No. One command becomes one tool, which keeps each tool easy to read and test. Paste another command for the next endpoint, or import a specification to create many at once.
How are nested JSON bodies handled?
Nested objects are flattened into parameters joined with underscores, such as assignee_email, up to four levels deep. Each keeps a mapping to its dotted path, so GetMCP rebuilds the original nested structure when it calls your API.
What if my command uses -F or @file?
Multipart uploads and bodies read from a file cannot be reproduced, so GetMCP shows a warning and imports the rest of the command. Send the fields as a JSON body instead, or add them as body parameters in the editor.
See every mapping on the cURL to MCP server page, then paste your first command and test it before you publish.
Ship an MCP server for your product this week.
Install GetMCP on any PHP host, import your API and share one URL. Your users can call your tools from Claude tonight.