Menu

1 / 3

How to Pass an API Key to a Remote MCP Server in Cursor, Claude Code and MCP Inspector

Long article (1853 words) — no AI summary yet.
Reading 0:00
15s threshold

Community Article

Community articles are authored by SitePoint Premium contributors. Content is screened before publication, and SitePoint reserves the right to moderate or remove articles that violate our guidelines. Views expressed are those of the authors and do not necessarily reflect those of SitePoint.

The AI briefing for Developers

Stay up to date with AI tools, model releases, and developer workflows that matter.

Weekly. Free. One click to leave.

A remote MCP server that needs an API key almost always expects it in an HTTP header , usually Authorization: Bearer <key> . Every client lets you set that header, but each one uses its own config file and its own syntax for reading the key from an environment variable. Get the syntax slightly wrong and the client sends an empty or literal value, the server answers 401, and the client only tells you the connection failed.

Here is the short version:

Cursor: the config lives in ~/.cursor/mcp.json or in .cursor/mcp.json in the project.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.