MCP server API key vs OAuth: which one to use
Use OAuth when a person signs in from Claude, Cursor, or another client; use an API key header for scripts, CI, and headless runs with no browser.

When a remote MCP server supports both, use OAuth in an interactive client someone sits in front of, and use an API key for scripts, CI, and headless runs where nobody can click through a sign-in page. With OAuth, a person approves access in a browser and the client keeps the token; with an API key, the client sends the same static header on every request.
Client behavior comes from the Claude Code MCP docs and Cursor's MCP docs; the example server is Sume's hosted MCP server, from MCP OAuth and API keys. All were read on 2026-09-28. If you meant "MCP or a plain API call?", see MCP vs REST API.
What changes between OAuth and an API key?
More than the header. On Sume's server the two are not interchangeable credentials, and they open different tool sets:
| Question | OAuth | API key |
|---|---|---|
| How the client connects | Discovers the server's OAuth metadata, sends you to consent on mcp.sume.com, exchanges the code with PKCE | Sends Authorization: Bearer $SUME_API_KEY or x-api-key |
| Tools the session sees | Read-only tools with mcp:read; mutating and paid tools only after Write adds mcp:write | The full hosted tool set |
| How it ends | After one hour, with no refresh token in current code; sign in again | You revoke it from the dashboard, after rotating to a replacement key |
| Sume's advice | Preferred for interactive clients like Cursor and Claude | Available for existing automation |
How do I add an MCP server with an API key header?
Pass the header when you add the server, and reference the key through a variable instead of pasting it. Where API keys go in an MCP config shows each client's variable syntax, and MCP server needs authentication in Claude Code has the claude mcp add --header command.
Know what the key unlocks before you choose it. A Sume API key belongs to one workspace, which Sume resolves from the key. An API-key session sees write and paid tools with no consent step, so what's left is the workspace wallet and per-call gates: every mutating or paid call needs an idempotency_key, dry_run=true previews the cost first, and max_spend_usd caps a call only when you pass it.
Can I use an MCP server without an API key?
Yes, if it supports OAuth. Add the server by URL with no header, then sign in: in Claude Code with /mcp or claude mcp login <name>, and in Cursor through the prompt it shows. Claude Code's docs note OAuth works with HTTP servers.
On Sume, consent shows Read locked on and a Write toggle that defaults to off. Leave Write off to browse the catalog, jobs, and assets; turn it on when the agent should generate, since paid tools return insufficient_scope without it. There is no separate paid scope.
Which should I use for CI or claude -p?
An API key: Claude Code's docs say that in non-interactive mode there is no /mcp panel, so it can't run the OAuth flow for you, and MCP server needs authentication in Claude Code covers the rest of that case.
How do I keep each credential safe?
Sume's docs set these rules for both:
- Keep API keys on trusted servers, CI secret stores, or developer machines, never in frontend JavaScript, mobile apps, or screenshots.
- Don't paste API keys into chat; prefer the OAuth connector flow in interactive clients.
- An MCP OAuth token is not a Sume API key: don't paste it into prompts or store it in CLI config, and don't mint API keys for OAuth clients as a workaround.
- Rotate a key from the dashboard if it appears in logs or chat history.
Sources
Related posts
More in Developers
- MCP server file upload: how a local file reaches a tool
A remote MCP server can't read your disk. A tool gets only the arguments your client sends, so the file must sit at a URL the tool accepts.
- MCP SSE vs Streamable HTTP: which transport to use
SSE is MCP's older, deprecated HTTP transport; Streamable HTTP replaced it with one endpoint that takes every message as a POST. Which to choose.
- MCP tool call result structure: content, structuredContent
An MCP tool call result has a content array, optional structuredContent, and isError. What goes where, how images travel, and how errors look.
- MCP tool description: what to write and how long it can be
An MCP tool description is the text a model reads to pick and call a tool. What the spec says, where Claude Code cuts it short, and what to write.
Written by Sume