Skip to content

Connect a Remote MCP Server to Claude Code and Cursor

Published July 20, 2026

Connect a remote MCP server to Claude Code or Cursor with the server URL and an X-API-Key header. Browser sign-in for Claude.ai, Claude Desktop, and Claude mobile is off until OAuth is enabled. Personal use is $29 a month or $228 a year.

The protocol those clients speak is the Model Context Protocol, specified at modelcontextprotocol.io. This server is one HTTPS URL, not a process your editor starts. Copy the URL from the MCP page or from the docs. It ends in /mcp once. A second /mcp is a 404 that clients describe as unreachable.

The snippets below are the configuration the server accepts. They use YOUR_KEY on purpose. Put a real key in only on your machine. The key is shown once, in the dashboard, when you create it. It is not emailed.

Claude Code

Claude Code takes the header in the add command.

claude mcp add --transport http calorie-api https://<api-origin>/mcp \
  --header "X-API-Key: YOUR_KEY"

The transport is HTTP, not stdio. The name calorie-api is the server name in the client. The key belongs to the MCP plan. A key from Free, Basic, Core, Plus, or Custom connects and then fails the first tool call with a plan error. Create the key after the trial on MCP pricing.

Do not commit the command with a real key. YOUR_KEY in a gist is safe. A key that starts with the product prefix in a gist is not.

Cursor

.cursor/mcp.json at the project root, or the user-level MCP config if you want it in every project:

{
  "mcpServers": {
    "calorie-api": {
      "url": "https://<api-origin>/mcp",
      "headers": {
        "X-API-Key": "YOUR_KEY"
      }
    }
  }
}

Restart the client after saving the file if it does not list the server. The first real call should be a search, not a portion, so the model has a food_id from the catalog. That habit is the tool-design article.

Other header clients

Any client that can set a request header on a streamable HTTP MCP server can use the same URL and X-API-Key. Clients that cannot set a header cannot connect to this server today.

Claude apps

Browser sign-in for Claude.ai, Claude Desktop, and Claude mobile is off on this server. Do not add the URL in those apps and wait for a login. The connector form there expects OAuth, and MCP_OAUTH_ENABLED is false. Use Claude Code or Cursor with the header above. When sign-in is enabled, the MCP page will say so. Until then, a guide that tells you to open a Claude app and sign in is describing a path that does not work.

After it connects

Ask for a food by name and a weight in grams. The useful trace is search_foods, then calculate_portion with the id that search returned. A model that answers with calories and never calls a tool is not using the server. The tool list is on the MCP page.

Personal use is the limit on this plan. REST search, foods, calc, and vision return 403. An app that resells the data needs a REST plan. That split is on the MCP page and in MCP vs REST.

When the connection fails

Work down the list before you change the URL.

The server URL is copied, not retyped. It ends in /mcp once.

Claude Code and Cursor never open a browser window for this server. They send X-API-Key. If you lost the key, create another one. Do not ask support to read it back. The dashboard shows the full value once.

A key from the wrong plan is accepted as a credential and then fails the tool with a plan error. Check the plan before you rotate the key.

Keep the key out of the URL. Query strings end up in logs and in browser history. The header is where the credential belongs.

Photo calls need raw base64, JPEG, PNG, or WebP, up to 2 MB, with no data: prefix. Pasting a picture into the chat does not attach the file. The argument reference is in the docs.

Paid limits after the 7-day trial are 20 calls a minute, 10,000 calls a month, 25 foods per search, and 150 photos a month. The trial is 7 days, card required, 5 calls a minute, 200 calls total, and 10 photos. Those figures are the price page, not a benchmark.

Frequently Asked Questions

How do I connect a remote MCP server to Claude Code?

Run claude mcp add with HTTP transport, the server URL that ends in /mcp once, and an X-API-Key header. The key is shown once in the dashboard. Browser sign-in for Claude apps is off until OAuth is enabled.

Do I paste an API key into Claude Desktop?

No. Claude Desktop sign-in is off on this server. Use Claude Code or Cursor with an X-API-Key header. Do not add the URL in Claude.ai, Claude Desktop, or Claude mobile and wait for a login.

What URL do I use?

The API origin plus /mcp, once. Copy it from the MCP page so you do not end up with /mcp/mcp.

Why does the first tool call fail?

The account has to be on the MCP plan. A REST key is refused. REST search, foods, calc, and vision return 403 on the MCP plan.

← Back to all articles

Start building with the Calorie API

Get a free API key and access 4M+ foods with search, barcode lookup, and full macro data.