-
Notifications
You must be signed in to change notification settings - Fork 607
chore: Add MCP v1 to the docs #3503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| --- | ||
| title: Using Cursor with Unkey | ||
| description: Leverage Cursor's AI capabilities to build applications with Unkey's APIs | ||
| mode: "wide" | ||
| --- | ||
|
|
||
| # Using Cursor with Unkey | ||
|
|
||
| Cursor is an AI-powered code editor that can help you build applications faster. When combined with Unkey's APIs, you can quickly generate secure, scalable applications with API key management and rate limiting. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### 1. Set Up Your Unkey Workspace | ||
|
|
||
| First, create your Unkey workspace and get your API keys: | ||
|
|
||
| <Steps> | ||
| <Step title="Create an API" stepNumber={1}> | ||
| Navigate to the [Unkey Dashboard](https://app.unkey.com/apis) and create a new API for your project. | ||
| </Step> | ||
|
|
||
| <Step title="Get Your Root Key" stepNumber={2}> | ||
| Go to [Settings > Root Keys](https://app.unkey.com/settings/root-keys) and create a new root key with the necessary permissions. | ||
| </Step> | ||
|
|
||
| <Step title="Note Your API ID" stepNumber={3}> | ||
| Copy your API ID from the dashboard - you'll need this for generating API keys. | ||
| </Step> | ||
| </Steps> | ||
|
|
||
| ### 2. Set Up Unkey MCP Server (Optional) | ||
|
|
||
| Cursor supports the Model Context Protocol (MCP) which allows you to connect directly to Unkey's APIs. This gives Cursor access to your Unkey workspace for more intelligent suggestions. | ||
|
|
||
| #### Install Unkey MCP Server | ||
|
|
||
| 1. **Configure the MCP Server** | ||
|
|
||
| Create or update your Cursor configuration file with the Unkey MCP server: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "Unkey": { | ||
| "command": "npx", | ||
| "args": [ | ||
| "mcp-remote", | ||
| "https://mcp.unkey.com/mcp/v1", | ||
| "--header", | ||
| "MCP-UNKEY-BEARER-AUTH:${UNKEY_ROOT_KEY}" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| For rate limiting specific operations, you can also add: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "UnkeyRateLimiting": { | ||
| "command": "npx", | ||
| "args": [ | ||
| "mcp-remote", | ||
| "https://mcp.unkey.com/mcp/ratelimits/", | ||
| "--header", | ||
| "MCP-UNKEY-V2-ROOT-KEY:${UNKEY_ROOT_KEY}" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| 2. **Set Environment Variable** | ||
|
|
||
| ```bash | ||
| export UNKEY_ROOT_KEY="your_root_key_here" | ||
| ``` | ||
|
|
||
| 3. **Restart Cursor** | ||
|
|
||
| Restart Cursor to load the MCP server configuration. | ||
|
|
||
| ## Tips and Tricks for Cursor with Unkey | ||
|
|
||
| ### 1. Keep Your Requests Small | ||
|
|
||
| When working with Cursor, break down complex tasks into smaller, focused requests: | ||
|
|
||
| **Good:** | ||
| ``` | ||
| Create a function to verify an API key with Unkey that returns a boolean | ||
| ``` | ||
|
|
||
| **Better:** | ||
| ``` | ||
| Create a TypeScript function that: | ||
| - Takes an API key string as input | ||
| - Uses @unkey/api to verify the key | ||
| - Returns a boolean indicating if the key is valid | ||
| - Includes proper error handling | ||
| ``` | ||
|
|
||
| ### 2. Update and Reference Your README.md | ||
|
|
||
| Keep your project's README.md updated with Unkey-specific information. Cursor uses this context to provide better suggestions: | ||
|
|
||
| ```markdown | ||
| # My Project | ||
|
|
||
| This project uses Unkey for API authentication and rate limiting. | ||
|
|
||
| ## Environment Variables | ||
| - `UNKEY_ROOT_KEY`: Your Unkey root key | ||
| - `UNKEY_API_ID`: Your API ID from the Unkey dashboard | ||
|
|
||
| ## API Routes | ||
| - `/api/protected` - Requires valid API key | ||
| - `/api/keys` - Manage API keys (admin only) | ||
|
|
||
| ## Rate Limiting | ||
| - Free tier: 100 requests/hour | ||
| - Pro tier: 1000 requests/hour | ||
| ``` | ||
|
|
||
| ## Add Unkey Documentation Context | ||
|
|
||
| Adding Unkey docs can let you specifically refer to Unkey features when building your app. | ||
|
|
||
| From Cursor Settings > Features > Docs add new doc, use the URL "https://unkey.com/docs" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --- | ||
| title: AI Code Gen with Unkey | ||
| description: Use AI-powered code generation tools with Unkey's APIs and services | ||
| mode: "wide" | ||
| --- | ||
|
|
||
| # AI Code Gen with Unkey | ||
|
|
||
| Unkey provides powerful integrations with AI code generation tools to help you build applications faster and more efficiently. Whether you're using Cursor, GitHub Copilot, Windsurf,you can leverage AI to generate code that integrates seamlessly with Unkey's APIs. | ||
|
|
||
| ## Available AI Tools | ||
|
|
||
| <CardGroup cols={2}> | ||
| <Card | ||
| title="Cursor" | ||
| icon="text" | ||
| href="/ai-code-gen/cursor" | ||
| > | ||
| Use Cursor's AI capabilities with Unkey's API documentation and examples | ||
| </Card> | ||
| <Card | ||
| title="Windsurf" | ||
| icon="wind" | ||
| href="/ai-code-gen/windsurf" | ||
| > | ||
| Build Unkey applications with Windsurf's AI-powered development environment | ||
| </Card> | ||
| <Card | ||
| title="Unkey MCP" | ||
| icon="robot" | ||
| href="/ai-code-gen/unkey-mcp" | ||
| > | ||
| Connect your favorite AI code generation tool to Unkey's APIs using Model Context Protocol | ||
| </Card> | ||
| </CardGroup> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.