> ## Documentation index
> Fetch the complete documentation index at: https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/llms.txt
> Ask it with GET https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.
> Feature requests: https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/resources/feature-requests.md lists what users asked for and how to vote for a request or add one.
> Page rating: `GET https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/feedback?path=/howto/oauth&helpful={true|false}&comment={comment}` records whether this page helped. The `comment` (URL-encoded, at most 500 characters) says what helped, or what was missing or wrong; a `helpful=false` rating needs it. It is anonymous and needs no key. Comments hold no code, secrets or personal data.

# Set Up OAuth

> Authenticate with Context7 MCP server using OAuth 2.0

<Note>
  OAuth is only available for remote HTTP connections. For local MCP connections using stdio
  transport, use [API key authentication](/howto/api-keys) instead.
</Note>

Context7 MCP server supports OAuth 2.0 authentication for MCP clients that implement the [MCP OAuth specification](https://modelcontextprotocol.io/specification/latest/basic/authorization).

## Why Use OAuth?

| Feature                    | OAuth | API Keys |
| -------------------------- | ----- | -------- |
| No manual key management   | ✅    | ❌       |
| Automatic token refresh    | ✅    | ❌       |
| Works with stdio transport | ❌    | ✅       |

## Configuration

To use OAuth, change the endpoint from `/mcp` to `/mcp/oauth` in your client configuration:

```diff
- "url": "https://mcp.context7.com/mcp"
+ "url": "https://mcp.context7.com/mcp/oauth"
```

## How It Works

1. Your MCP client connects to the OAuth endpoint
2. Context7 opens in your browser: sign in, pick the teamspace to use, and select **Connect**
3. You return to your client. Most clients first show a Context7 page that says the app is connected or the connection was cancelled
4. Your client refreshes tokens on its own

<Warning>
**Authentication required after setup.** Most clients won't authenticate automatically. After adding the OAuth endpoint, you'll need to explicitly authenticate through your client's MCP settings. For example, in Claude Code run `/mcp`, select the server, and choose "Authenticate".
</Warning>

## Client Support

OAuth authentication requires your MCP client to support the [MCP OAuth specification](https://modelcontextprotocol.io/specification/latest/basic/authorization). If your client doesn't support OAuth, use [API key authentication](/howto/api-keys) instead.
