“Unauthorized. Please check your API key.” regardless of API key validity
Summary
Repeated resolve-library-id calls to the Context7 MCP server return “Unauthorized. Please check your API key.” even after multiple fresh integrations (Cursor one-click, Claude Code remote, Claude Code local) and regenerating API keys each time.
Steps to Reproduce
- Install the Context7 MCP server via any supported method (Cursor one-click, Claude Code remote server, or Claude Code local server).
- Configure a newly generated Context7 API key for the code block.
- Connect the MCP client (Cursor/Claude Code) to the Context7 server.
- Invoke the
resolve-library-idtool with any library name, e.g.{"libraryName": "expo 54"}.
Expected Behavior
The call should return a valid library ID (or a not-found response) when a correct API key is provided.
Actual Behavior
Every call fails with Unauthorized. Please check your API key. despite the API key being freshly generated, live, and recognized by the install steps.
Error Log Excerpt (from mcp.log)
[Context7] Message from server: {"result":{"protocolVersion":"2025-06-18","capabilities":{"tools":{"listChanged":true}},"serverInfo":{"name":"Context7","version":"1.0.13"},"instructions":"Use this server to retrieve up-to-date documentation and code examples for any library."},"jsonrpc":"2.0","id":0}
2025-09-25T02:50:30.285Z [info] [Context7] Message from client: {"method":"notifications/initialized","jsonrpc":"2.0"}
2025-09-25T02:50:30.285Z [info] [Context7] Message from client: {"method":"tools/list","params":{},"jsonrpc":"2.0","id":1}
2025-09-25T02:50:30.285Z [info] [Context7] Message from client: {"method":"prompts/list","params":{},"jsonrpc":"2.0","id":2}
2025-09-25T02:50:30.285Z [info] [Context7] Message from client: {"method":"resources/list","params":{},"jsonrpc":"2.0","id":3}
2025-09-25T02:50:30.287Z [info] [Context7] Message from server: {"result":{"tools":[{"name":"resolve-library-id", ... }]}}
2025-09-25T02:50:30.287Z [info] [Context7] Message from server: {"jsonrpc":"2.0","id":2,"error":{"code":-32601,"message":"Method not found"}}
2025-09-25T02:50:30.287Z [info] [Context7] Message from server: {"jsonrpc":"2.0","id":3,"error":{"code":-32601,"message":"Method not found"}}
Environment
- Context7 MCP server
v1.0.13 - MCP clients tried: Cursor one-click install, Claude Code remote server, Claude Code local server
- OS: Linux (Docker Desktop environment), but same issue occurs locally (macOS Tahoe 26.0).
- API key: newly generated for each attempt (confirmed saved in client config)
Workarounds Attempted
- Deleted old keys and generated new ones before each install.
- Reinstalled the MCP server via each method listed above.
- Restarted clients and reloaded configurations.
- Verified the API key was being read by each client.
None of these resolved the authorization failure.
Additional Notes
This issue blocks access to get-library-docs because resolve-library-id must succeed first. Any guidance or a fix would be greatly appreciated!
Thanks for reporting, we are investigating the issue
what is the point of api keys? traffic for your website?
To provide higher rate limits, and configure the mcp responses if you want to limit your search to certain organizations or repos
Btw they are completely optional @coolcardproject
Any update @evanjcosgrove what is the log you see now? Still can't authorize?
???
Hey guys, if you could please fix this issue by managing the pull request, seriously, it's too... It's a shame that we have this type of issue on ClaudeCode which is the best, which is very, very used by developers. @enesgules
Hey @guillaumebadin what are the logs you are seeing? Can you use the api key in the dashboard?
Do you have any logs that you can share with us?
@enesgules For what it's worth, I'm seeing this in Claude Code as well.
Let's pull up the documentation for Claude Code using the context7 mcp
⏺ I'll use the Context7 MCP to pull up the Claude Code documentation.
⏺ context7 - resolve-library-id (MCP)(libraryName: "claude code") ⎿ Unauthorized. Please check your API key. The API key you provided (possibly incorrect) is: ctx7sk-########-####-####-####-################. API keys should start with 'ctx7sk'
Using # to redact the key, but I am using a valid API key as far as I can tell.
I fixed this by regenerating my Context 7 API key, editing /Users/jesse/.claude.json, replacing the context7 API key, saving, and restarting Claude. My old key must have been invalidated or something, which is strange because it wasn't old.
The same problem occurred in VS Code.
{
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"CONTEXT7_API_KEY": "ctx7sk-..."
}
}
}
}
Unauthorized. Please check your API key. The API key you provided (possibly incorrect) is: ctx7sk-... API keys should start with 'ctx7sk'
API Key is correct(starting with 'ctx7sk') but error have occurred.
Hey @bldev2473 does it match with the api key that is displayed in your user dashboard?
@enesgules I entered the dashboard key correctly. The problem is that after closing VS Code and restarting it later (exact timing unclear), this error appears when using the MCP server. Regenerating the API key and re-entering it in the MCP configuration works fine. The issue is that I have to regenerate it every time :(
I store the API key locally for use, and it shouldn't change, but I should check it out.
This is super weird let me try to reproduce thanks
I had a very similar issue just now in Warp: the key was rejected as unauthorized. I had to delete the MCP from the Warp config, add it again and now the requests work just fine (with the same key).
I've just realised that the API key saved in my local settings file has been automatically changed back to the old one. That's why I was experiencing authentication issues. Why on earth was the local settings file modified? It's really strange. I'm using VSCode, but seeing that others have reported similar problems makes me wonder if it's an IDE issue. Could it be related to the Context7 MCP server?
I ran into this issue as well. My guess is that I was updating only a project-level API key but the MCP was pulling from a more global user setting. What worked:
claude mcp remove context7 in terminal
Then
claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key MY_NEW_CONTEXT7_KEY
same problem now
Same problem
Hey @bayraak Could you please chare your config and client and any error logs you see and confirm its the same api key you see in the dashboard and could you try creating a new api key too
I've been having the same issue in Claude Desktop. Claude Code has no issue, and I imported the mcp servers from desktop.
Claude says:
Claude Desktop is using Node.js v16.20.2, but the @upstash/context7-mcp package requires Node 18+.
The error ReferenceError: ReadableStream is not defined occurs because:
- ReadableStream became a global in Node 18
- The undici library (used for HTTP fetch) expects it to exist
- Node 16 doesn't have ReadableStream as a global
It suggested adding this to claude_desktop_config.json which fixed the issue:
"env": {
"PATH": "/Users/channing/.nvm/versions/node/v20.19.6/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/"
}
Here is the log which shows two different errors. context7.log
I think this issue is unrelated to the unauthorized api key issue @channingwalton and maybe specific to your local setup where claude desktop uses an older version of node. Let me close this issue since it's been stale for a while and lets see if other users experience anything similar in the future.
I think this issue is unrelated to the unauthorized api key issue
You're quite right, apologies.