> ## Documentation Index
> Fetch the complete documentation index at: https://portkey-docs-feat-rerank-documentation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Cursor

> Connect your MCP servers to Cursor IDE through Portkey's secure MCP gateway

## Overview

Cursor is an AI-powered IDE that supports MCP (Model Context Protocol) for enhanced code intelligence and tool integration. Through Portkey's MCP Gateway, you can seamlessly connect any MCP server to Cursor without managing infrastructure or authentication.

### Key Benefits

* **Secure Authentication**: Portkey handles OAuth flows and token management
* **Unified Authentication**: Single OAuth token to manage all your MCP servers
* **Team Collaboration**: Share MCP server configurations, manage access permissions, and ensure everyone on your team has the tools they need—configured correctly, every time
* **Complete Observability**: See every request, track latency, monitor errors, and understand usage patterns

***

## Prerequisites

Before you begin, ensure you have:

1. **Cursor IDE** installed (latest version recommended)
2. **Portkey account** with workspace access
3. **MCP server** registered in Portkey's MCP Hub

***

## Quick Setup

### Step 1: Get Your MCP Server URL

1. Log in to [Portkey Dashboard](https://app.portkey.ai)
2. Navigate to **MCP Hub** → **Your Servers**
3. Copy your server URL:
   ```
   https://mcp.portkey.ai/:workspace-id/:server-id/mcp
   ```

### Step 2: Configure MCP for Your Project (Recommended)

We recommend configuring MCP servers at the **project level** for better organization and team collaboration.

1. Navigate to your project root directory
2. Create the configuration directory and file:
   ```bash theme={"system"}
   mkdir -p .cursor
   cd .cursor
   ```
3. Create `mcp.json` in the `.cursor` directory

### Step 3: Add Your Server Configuration

Add this configuration to `.cursor/mcp.json`:

```json theme={"system"}
{
  "mcpServers": {
    "your-server-name": {
      "url": "https://mcp.portkey.ai/:workspace-id/:server-id/mcp"
    }
  }
}
```

This project-level configuration ensures:

* Team members automatically get the correct MCP setup when cloning the repository
* Project-specific tools are only available where needed
* Configuration travels with your codebase

***

## Configuration Examples

### Project-Level Configuration (Recommended)

**Location**: `.cursor/mcp.json` in your project root

```json theme={"system"}
{
  "mcpServers": {
    "linear": {
      "url": "https://mcp.portkey.ai/ws-abc123/linear-def456/mcp"
    },
    "github": {
      "url": "https://mcp.portkey.ai/ws-abc123/github-ghi789/mcp"
    }
  }
}
```

### Global Configuration (Alternative)

For tools you want available across all projects, you can use global configuration:

**Location**: `~/.cursor/mcp.json` in your home directory

```json theme={"system"}
{
  "mcpServers": {
    "general-tools": {
      "url": "https://mcp.portkey.ai/ws-abc123/tools-xyz789/mcp"
    }
  }
}
```

### Using Both Configurations

Cursor loads both global and project configurations. Project settings take precedence when there are conflicts.

```bash theme={"system"}
# Project structure
your-project/
├── .cursor/
│   └── mcp.json       # Project-specific MCP servers
├── src/
└── README.md

# Home directory
~/
└── .cursor/
    └── mcp.json       # Global MCP servers
```

***

## Authentication

Portkey handles all authentication flows automatically:

1. **First Connection**: When Cursor first connects to an authenticated MCP server, Portkey will:
   * Open your browser for OAuth authorization (if required)
   * Store credentials securely
   * Maintain session state

2. **Subsequent Connections**: Authentication tokens are refreshed automatically

3. **Team Access**: Workspace members share the same authentication scope based on your Portkey settings

***

## Troubleshooting

### MCP Servers Not Loading

1. Verify `.cursor/mcp.json` exists in your project root
2. Check JSON syntax is valid
3. Restart Cursor after configuration changes

### View MCP Settings

* **Quick Access**: `Cmd/Ctrl + Shift + P` → `View: Open MCP settings`
* This shows all loaded MCP configurations from both project and global sources

***

## Support

Need help? We're here for you:

* 📧 Email: [support@portkey.ai](mailto:support@portkey.ai)
* 💬 Discord: [Join our community](https://discord.gg/portkey)
* 📚 Documentation: [docs.portkey.ai](https://docs.portkey.ai)
