
Choose OAuth vs. an environment-backed API key per client
Most MCP authentication failures happen when developers paste a static key into committed config files or leave an interactive browser sign-in half-configured inside a headless workflow runner.
IPMusk serves its hosted MCP endpoint at https://ipmusk.com/mcp over stateless Streamable HTTP and supports two authentication models: browser OAuth sign-in (with RFC 7591 Dynamic Client Registration, 1-hour access tokens, and up to 90-day refresh lifetime) and scoped API keys sent as HTTP Bearer headers.
Interactive desktop and IDE tools work well with OAuth when no CI server is involved, because you approve scopes directly in the browser and never store a raw token in a file. Unattended n8n workflows, terminal sessions launched cleanly from shell profiles, and shared repository .cursor/mcp.json files should read a key from an environment variable or credential store instead.
| Client | Primary auth option | Where credentials live |
|---|---|---|
| Cursor | Bearer header via ${env:IPMUSK_API_KEY} (or OAuth if headers omitted) | Shell environment loaded before starting Cursor; safe to commit .cursor/mcp.json |
| Claude Code / Codex CLI | Bearer header from $IPMUSK_API_KEY / bearer_token_env_var (or OAuth) | Process environment variable exported in your terminal session |
| n8n MCP Client / MCP Client Tool | Bearer Auth, Header Auth, or OAuth2 (Dynamic Client Registration) | Encrypted n8n Credentials store (never pasted raw in node parameters) |
| claude.ai / Claude Desktop / ChatGPT | Browser OAuth custom connector (leave client ID/secret empty) | Browser OAuth consent managed by Connected AI apps in IPMusk Settings |
Do not paste live IPMUSK_API_KEY values directly into prompts, chat history, or version-controlled JSON files.
Keep Cursor, Claude Code and Codex configs free of raw secrets
In Cursor, .cursor/mcp.json (project-scoped) or ~/.cursor/mcp.json (global) lets you reference an environment variable using ${env:IPMUSK_API_KEY}. Because the JSON contains only the placeholder variable reference, committing .cursor/mcp.json to a team repository never exposes an account key. As noted in IPMusk's Cursor guide, omit the headers block only if you want Cursor to prompt for browser OAuth instead.
The single most common mistake in Cursor is exporting IPMUSK_API_KEY inside an integrated terminal after Cursor already launched. Because Cursor reads process environment variables at startup, launch Cursor from a shell where IPMUSK_API_KEY is exported or place the export inside your login shell profile.
Verify that the placeholder JSON parses cleanly and check your shell environment length without printing the secret value before opening Cursor Settings -> MCP:
- Claude Code uses: claude mcp add --transport http ipmusk https://ipmusk.com/mcp --header "Authorization: Bearer $IPMUSK_API_KEY", checked afterwards with /mcp or claude mcp list.
- Codex reads bearer_token_env_var = "IPMUSK_API_KEY" inside ~/.codex/config.toml so the key stays in environment memory.
- Run echo ${#IPMUSK_API_KEY} in your launch shell to verify non-zero length without revealing characters.
{
"mcpServers": {
"ipmusk": {
"url": "https://ipmusk.com/mcp",
"headers": {
"Authorization": "Bearer ${env:IPMUSK_API_KEY}"
}
}
}
}Configure n8n MCP Client and avoid the double-Bearer 401 trap
n8n exposes remote MCP servers through two nodes documented in n8n Docs: the standalone MCP Client workflow node (configured with Server Transport set for Streamable HTTP and MCP Endpoint URL set to https://ipmusk.com/mcp) and the MCP Client Tool cluster sub-node attached to AI Agent nodes.
Both n8n MCP nodes accept four credential modes: Bearer Auth, generic Header Auth, Multiple Headers Auth, and OAuth2 (which enables Dynamic Client Registration by default to match RFC 7591 servers like IPMusk). Watch out for one formatting pitfall when setting up token authentication:
- If you choose Bearer Auth in n8n, paste only the raw token string (ipm_live_...) into the Bearer Token field because n8n adds the Bearer prefix automatically. Typing Bearer ipm_live_... produces a doubled Bearer Bearer header and triggers 401 authentication_required.
- If you choose generic Header Auth instead, set Name to Authorization and Value to Bearer ipm_live_....
- If you choose OAuth2 with Dynamic Client Registration enabled in a self-hosted n8n deployment, ensure your instance external webhook/redirect URL matches what n8n sends during registration.
Scope permissions tightly and filter tools inside agent nodes
IPMusk divides both API keys and OAuth consents into four explicit scopes: read (60 calls/min), connect (20 calls/min), support (30 calls/min), and order (10 calls/min). Tools requiring connect return active proxy passwords or generate credentials via build_proxy_url; read-only helpers check balance, usage, and catalog metadata without exposing proxy credentials.
In n8n's MCP Client Tool sub-node, combine key-level scoping with the node's Tools to Include setting. Leaving Tools to Include on All exposes every permitted tool on the key to an autonomous LLM loop, whereas switching to Selected or All Except narrows the agent strictly to tools like get_account, get_balance, or build_proxy_url.
Remember two guardrails before enabling order permissions on any client. First, IPMusk order, renewal, and top-up tools return a hosted checkout link for a human to review and pay rather than silently charging a saved card; static auto-renewal draws from pre-topped account balance only up to an explicit confirmed cap. Second, permissions on an existing API key cannot be edited after creation: if a tool returns 403 forbidden for a missing scope, mint a fresh key with the needed scopes, swap it into your environment or n8n credential, and revoke the old key in /app/settings/api-keys.
| Error observed | Root cause | Fix |
|---|---|---|
| 401 authentication_required | Missing env var at IDE launch, revoked token, or double Bearer prefix in n8n Bearer Auth | Restart IDE from exported shell, verify key status, or strip duplicate Bearer prefix |
| 403 forbidden | Key or OAuth grant lacks the tool scope, or IPMusk account email is unverified | Verify account email and issue a new key (or re-consent OAuth) with the required scope |
| 429 rate_limited | Exceeded per-minute scope cap (read 60, connect 20, support 30, order 10) | Wait for window reset and avoid polling balance inside tight loops |
Sources checked
- IPMusk MCP documentation (Streamable HTTP endpoint, OAuth lifetime, 27 tools, scopes, hosted checkout links): ipmusk.com/docs/mcp
- IPMusk Cursor integration guide (.cursor/mcp.json ${env:IPMUSK_API_KEY}, scope limits, 401/403/429 fixes): ipmusk.com/docs/agents/cursor
- n8n MCP Client, MCP Client Tool, and MCP OAuth2 credential documentation: docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcpclient.md, toolmcp.md, and credentials/mcp.md
Documentation verified November 30, 2026 against live IPMusk docs and official n8n documentation.
