Skip to content

Context7 Platform -- Up-to-date docs for AI agents

docs(CTX7-1058): improve oauth docs steps (#1448)

Fahreddin Özcane3146aa3e50d
diff --git a/docs/clients/claude-code.mdx b/docs/clients/claude-code.mdx
index 0a83f0b5..e7f76412 100644
--- a/docs/clients/claude-code.mdx
+++ b/docs/clients/claude-code.mdx
@@ -11,47 +11,68 @@ Context7 integrates with Claude Code to provide current library documentation in
<Tab title="Remote Server (Recommended)" icon="cloud">
No dependencies required. Connects to Context7's hosted server.
-<CodeGroup>
-```bash With OAuth (Recommended)
-claude mcp add --transport http context7 https://mcp.context7.com/mcp/oauth
-```
+<Tabs>
+<Tab title="With API Key (Recommended)">
+Run this command in your terminal:
-```bash With API Key
+```bash
claude mcp add --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp
```
+</Tab>
+<Tab title="With OAuth">
+<Steps>
+<Step title="Add the Context7 MCP server">
+Run this command in your terminal:
-```bash Without API Key
-claude mcp add --transport http context7 https://mcp.context7.com/mcp
+```bash
+claude mcp add --transport http context7 https://mcp.context7.com/mcp/oauth
```
-</CodeGroup>
+</Step>
+<Step title="Authenticate with Context7">
+Run `/mcp` in Claude Code, select Context7, and click "Authenticate" to start the OAuth flow:
-<Tip>
-Using OAuth? You'll be redirected to sign in the first time you connect. After that, tokens refresh automatically. See [OAuth authentication](/howto/oauth) for details.
-</Tip>
+<Frame>
+ <img src="/images/clients/claude-code/mcp-unauthenticated.png" alt="Claude Code OAuth Authentication" />
+</Frame>
+
+This will open your browser for authorization. After you authorize, tokens are stored securely and refresh automatically. See [OAuth authentication](/howto/oauth) for details.
+</Step>
+</Steps>
+</Tab>
+<Tab title="Without API Key">
+Run this command in your terminal:
+
+```bash
+claude mcp add --transport http context7 https://mcp.context7.com/mcp
+```
+</Tab>
+</Tabs>
</Tab>
<Tab title="Local Server" icon="computer">
Runs on your machine. Requires Node.js 18+.
-<CodeGroup>
-```bash With API Key
-claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY
-```
+<Tabs>
+<Tab title="With API Key (Recommended)">
+Run this command in your terminal:
-```bash Without API Key
-claude mcp add context7 -- npx -y @upstash/context7-mcp
+```bash
+claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY
```
-</CodeGroup>
-**Using environment variables:**
-
-Instead of passing the API key in the command, you can set it as an environment variable:
+<Tip>
+Instead of passing the API key in the command, you can set `CONTEXT7_API_KEY` as an environment variable and omit the `--api-key` flag.
+</Tip>
+</Tab>
+<Tab title="Without API Key">
+Run this command in your terminal:
```bash
-export CONTEXT7_API_KEY=your_api_key_here
claude mcp add context7 -- npx -y @upstash/context7-mcp
```
</Tab>
</Tabs>
+</Tab>
+</Tabs>
### Verifying the Connection
diff --git a/docs/clients/opencode.mdx b/docs/clients/opencode.mdx
index c6573c23..d8280e68 100644
--- a/docs/clients/opencode.mdx
+++ b/docs/clients/opencode.mdx
@@ -30,8 +30,11 @@ vim opencode.json
<Step title="Add Context7 MCP server">
Add the Context7 MCP server to the `mcp` section:
-<CodeGroup>
-```json With API Key (Recommended)
+<Tabs>
+<Tab title="With API Key (Recommended)">
+Add this to your config file:
+
+```json
{
"mcp": {
"context7": {
@@ -46,22 +49,59 @@ Add the Context7 MCP server to the `mcp` section:
}
```
-```json Without API Key
+<Tip>
+You can use environment variable syntax for your API key: `"CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"`. This reads from your environment instead of hardcoding the key.
+</Tip>
+</Tab>
+<Tab title="With OAuth">
+Add this to your config file:
+
+```json
{
"mcp": {
"context7": {
"type": "remote",
- "url": "https://mcp.context7.com/mcp",
+ "url": "https://mcp.context7.com/mcp/oauth",
"enabled": true
}
}
}
```
-</CodeGroup>
-<Tip>
-You can use environment variable syntax for your API key: `"CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"`. This reads from your environment instead of hardcoding the key.
-</Tip>
+Then run the following command in your terminal to authenticate:
+
+```bash
+opencode mcp auth context7
+```
+
+This will open your browser for authorization. After you authorize, tokens are stored securely and refresh automatically. See [OAuth authentication](/howto/oauth) for details.
+
+**Other OAuth commands**
+
+```bash
+# List all MCP servers and their auth status
+opencode mcp auth list
+
+# Remove stored credentials
+opencode mcp logout context7
+```
+</Tab>
+<Tab title="Without API Key">
+Add this to your config file:
+
+```json
+{
+ "mcp": {
+ "context7": {
+ "type": "remote",
+ "url": "https://mcp.context7.com/mcp",
+ "enabled": true
+ }
+ }
+}
+```
+</Tab>
+</Tabs>
</Step>
</Steps>
</Tab>
@@ -83,8 +123,11 @@ vim opencode.json
<Step title="Add Context7 MCP server">
Add the Context7 MCP server to the `mcp` section:
-<CodeGroup>
-```json With API Key
+<Tabs>
+<Tab title="With API Key (Recommended)">
+Add this to your config file:
+
+```json
{
"mcp": {
"context7": {
@@ -96,7 +139,14 @@ Add the Context7 MCP server to the `mcp` section:
}
```
-```json Without API Key
+<Tip>
+Instead of passing the API key in the command, you can set `CONTEXT7_API_KEY` as an environment variable and omit the `--api-key` flag.
+</Tip>
+</Tab>
+<Tab title="Without API Key">
+Add this to your config file:
+
+```json
{
"mcp": {
"context7": {
@@ -107,11 +157,8 @@ Add the Context7 MCP server to the `mcp` section:
}
}
```
-</CodeGroup>
-
-<Tip>
-**Using environment variables:** Instead of passing the API key in the command, set `CONTEXT7_API_KEY` as an environment variable and configure OpenCode without the `--api-key` flag.
-</Tip>
+</Tab>
+</Tabs>
</Step>
</Steps>
</Tab>
diff --git a/docs/images/clients/claude-code/mcp-unauthenticated.png b/docs/images/clients/claude-code/mcp-unauthenticated.png
new file mode 100644
index 00000000..cef670ec
Binary files /dev/null and b/docs/images/clients/claude-code/mcp-unauthenticated.png differ