-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Overview
Add instructions for obtaining and configuring the optional Context7 API key for @upstash/context7-mcp. The server works without an API key, but providing one enables higher rate limits and private repository access.
Current State
- Context7 MCP server is a core toolkit server
- Works without authentication (basic functionality)
- Optional API key support via
CONTEXT7_API_KEYenvironment variable - No guidance on obtaining or configuring the API key
Requirements
Optional API Key Benefits
- Higher Rate Limits: Increased API call limits compared to free tier
- Private Repositories: Access to private repository documentation
- Enhanced Features: Additional capabilities for authenticated users
Account Registration
- Free Account: Create account at https://context7.com/dashboard
- Authentication Method: Standard account registration
[TODO: USER INPUT NEEDED - Please verify the exact registration process at context7.com/dashboard, including whether it requires email verification, OAuth options, etc.]
API Key Retrieval
- Navigate to https://context7.com/dashboard
- Locate API key management section
[TODO: USER INPUT NEEDED - Please confirm the exact steps to create/retrieve an API key from the Context7 dashboard. Where is the API key section? Is there a "Create API Key" button? Can you name keys?]
Pricing Information
- Free Tier: Available with limited rate limits
- With API Key: Enhanced rate limits (specific limits need confirmation)
- Private Repos: Requires API key
[TODO: USER INPUT NEEDED - Please confirm any pricing tiers or payment requirements for Context7 API keys]
Implementation
Documentation Updates
registry/mcp-servers/context7/claude.md:
## Context7 MCP Server Setup
### Basic Usage (No API Key)
Context7 works out of the box without an API key. The server will use public rate limits and can access public library documentation.
### Optional: Enhanced Access with API Key
For higher rate limits and private repository access, you can configure an optional API key:
#### Getting Your API Key
1. **Create a Context7 account** (if you don't have one):
- Go to https://context7.com/dashboard
- [TODO: Add registration steps]
- Free account available
2. **Create an API Key**:
- Navigate to https://context7.com/dashboard
- [TODO: Add specific steps to access API key management]
- [TODO: Add steps to create/copy API key]
- Store the key securely
3. **Configure the key**:
- The key will be stored in `.env.mcp.secrets` as `CONTEXT7_API_KEY`
- Never commit this file to version control
#### Benefits of Using an API Key
- **Higher Rate Limits**: [TODO: Specify exact limits]
- **Private Repositories**: Access documentation for private repos
- **Reliability**: Better service availability during peak usage
### Usage
Context7 provides up-to-date, version-specific documentation:
Create a Next.js middleware that checks for a valid JWT in cookies. use context7
The MCP server automatically:
1. Resolves library names to Context7-compatible IDs
2. Fetches current documentation for the library
3. Provides version-specific code examples
Interactive Configuration
Update registry/mcp-servers/context7/index.ts configure() method:
async configure(ctx: ConfigContext): Promise<ServerConfig> {
// Ask if user wants to configure optional API key
const useApiKey = await Confirm.prompt({
message: "Configure Context7 API key? (optional, enables higher rate limits)",
default: false
});
let apiKey: string | undefined;
if (useApiKey) {
apiKey = await Input.prompt({
message: "Enter your Context7 API key:",
hint: "Get one at https://context7.com/dashboard (optional)",
validate: (value) => {
if (!value || value.trim().length === 0) {
return "API key cannot be empty. Press Ctrl+C to skip.";
}
// [TODO: Confirm key format/validation if applicable]
return true;
}
});
}
const config: ServerConfig = {
command: "npx",
args: ["-y", `@upstash/context7-mcp@${this.version}`]
};
// Only add env if API key provided
if (apiKey) {
config.env = {
CONTEXT7_API_KEY: apiKey
};
}
return config;
}Help Text
Add to init command when Context7 is selected:
ℹ️ Context7 API Key (Optional)
Context7 works without an API key, but you can optionally configure one for:
- Higher rate limits
- Private repository access
To get an API key:
1. Create an account at https://context7.com/dashboard (free)
2. [TODO: Add key retrieval steps]
3. Configure during setup when prompted
You can skip this step and use Context7 without authentication.
.mcp.json Configuration
Without API Key (default):
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/[email protected]"]
}
}
}With API Key (optional):
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/[email protected]"],
"env": {
"CONTEXT7_API_KEY": "${CONTEXT7_API_KEY}"
}
}
}
}Testing
- Verify registration flow at context7.com/dashboard
- Confirm API key creation/retrieval steps
- Test Context7 without API key (baseline functionality)
- Test Context7 with API key (enhanced features)
- Document rate limit differences
- Verify private repo access with API key
Design Considerations
Optional vs Required
- Context7 API key is optional, unlike Exa which requires a key
- Default behavior should be "no API key" for simplicity
- User should be prompted but can easily skip
- Documentation should clearly state this is optional
User Experience
- Make it clear that basic functionality works without a key
- Don't block setup if user chooses not to provide a key
- Provide clear benefits of using an API key
- Allow reconfiguration later if needed
Related Issues
- Related to Exa authentication setup (feat(mcp-exa): Add Exa MCP Server Setup Instructions #7)
- Depends on version pinning (feat(init): pin MCP server versions in .mcp.json configuration #6) for
@upstash/[email protected]format - Related to
.env.mcp.secretsmanagement
References
- Context7 GitHub: https://github.com/upstash/context7
- Context7 Dashboard: https://context7.com/dashboard
- NPM Package: https://www.npmjs.com/package/@upstash/context7-mcp
- API Key Environment Variable: Source
- Context7 MCP Documentation: https://github.com/upstash/context7#requirements