Get the FREE Ultimate OpenClaw Setup Guide →

cursor

Cursor MCP Server implementation

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ericzakariasson-cursor-mcp-server node run /path/to/cursor-mcp-server/index.js \
  --env CURSOR_API_KEY="your-api-key-here"

How to use

This MCP server connects Cursor's Background Agents API to your MCP setup. It acts as a bridge that allows Cursor to invoke background tasks and manage agents through the MCP protocol. With the provided configuration, the server runs a Node-based MCP service that loads your Cursor integration and uses the Cursor API key to authenticate requests. You can deploy this alongside other MCP servers and configure Cursor to communicate with it via the mcpServers.Cursor entry.

To use its capabilities, place your Cursor API key in the environment (or provide it via the referenced .env file), then start the MCP server according to your deployment method. The server exposes the Cursor integration as a node-based entry point (index.js) which handles agent lifecycle, task scheduling, and data passthrough between Cursor and your MCP ecosystem. When Cursor triggers a background agent, the MCP server processes the request and returns results through the standard MCP channels.

How to install

Prerequisites:

  • Node.js installed on the host (or environment where MCP servers run)
  • Optional: Bun installed if you prefer bun install as shown in the repository
  • Access to Cursor API key for authentication
  1. Clone or download the MCP server repository for Cursor:
  1. Install dependencies using Bun (as per setup instructions) or npm/yarn:
  • bun install

or if you prefer npm:

npm install

  1. Create and configure environment variables:
  • Create a .env file in the project root (or provide CURSOR_API_KEY via your hosting environment):
  • echo "CURSOR_API_KEY=your-api-key-here" > .env
  1. Configure the MCP entry in Cursor (example from the README):
  • In Cursor settings, add the following mcpServers entry:

    { "mcpServers": { "cursor": { "command": "node", "args": ["run", "/path/to/cursor-mcp-server/index.js"], "envFile": ".env" } } }

  1. Run the server as part of your MCP deployment according to your environment. If running directly, start the node process that launches the MCP server (adjust path to index.js as needed).

Tip: Ensure the CURSOR_API_KEY is kept secure and not exposed in logs. Verify that the server has network access to Cursor and any other required services.

Additional notes

Tips and common issues:

  • Ensure the CURSOR_API_KEY is valid and has the necessary permissions for background agent operations.
  • If using an envFile, confirm your deployment supports loading environment variables from .env (or use the environment configuration of your hosting platform).
  • Double-check the path in the arguments to index.js to ensure the MCP server starts with the correct entry point.
  • When upgrading dependencies, re-run bun install (or npm install) to refresh node_modules.
  • If Cursor cannot reach the MCP server, verify firewall rules and network routing between Cursor, the MCP host, and any required Cursor endpoints.
  • Log levels and outputs can help debug; ensure logs are captured by your hosting environment for troubleshooting.

Related MCP Servers

Sponsor this space

Reach thousands of developers