FrançaisChoose your hat

Add a remote MCP server to Claude Code, Cursor and VS Code

The exact command or configuration to add a remote (HTTP) MCP server with OAuth to Claude Code, Cursor and VS Code, and what to check when sign-in fails.

Published 6 December 2026

Any tool that speaks the Model Context Protocol over HTTP and handles OAuth can wear a hat. Here are the three most common ones for people who build. In the examples, replace https://example.com/mcp/your-hat with the link shown on your hat's Link screen.

Claude Code

One command in your terminal:

claude mcp add --transport http hatfor https://example.com/mcp/your-hat

Then, inside Claude Code, run /mcp, pick the server and follow the sign-in. The server is added for you on this machine by default; Claude Code also supports a project scope (a .mcp.json file shared with the repository) and a user scope. See claude mcp add --help for the options of your version.

Cursor

Add the server to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

{
  "mcpServers": {
    "hatfor": { "url": "https://example.com/mcp/your-hat" }
  }
}

Cursor opens the sign-in in your browser the first time it calls the server.

VS Code

VS Code uses a different key, servers, in .vscode/mcp.json (or in your user profile, via the command MCP: Add Server):

{
  "servers": {
    "hatfor": { "type": "http", "url": "https://example.com/mcp/your-hat" }
  }
}

When sign-in fails

  • Check the address: https, no trailing space, the hat name at the end.
  • Open the sign-in email in the browser the tool opened, within 15 minutes.
  • Some clients cache a failed authorization: remove the server, then add it again.
  • The tools answer with a subscription link: the connection works, but this account has no active subscription to the hat.

Frequently asked questions

What does a client need to use Hatfor?

Support for remote MCP servers over HTTP (streamable HTTP transport) and for OAuth sign-in. The server's address must be reachable from where the client runs.

Can I test against a local server?

Claude Code, Cursor and VS Code run on your machine, so they can reach a local development server on localhost. Claude and ChatGPT on the web cannot.

Sources

  1. Claude Code documentation: connect to tools via MCP
  2. Cursor documentation: Model Context Protocol
  3. Visual Studio Code documentation: MCP servers