Connect to Cursor

Now that your MCP server has a tool, let's connect it to Cursor so you can use it.

What You'll Learn

  • How Cursor communicates with MCP servers
  • Cursor's MCP configuration format
  • Testing your tool in Cursor

How It Works

1┌─────────────┐    spawns     ┌─────────────┐
2│   Cursor    │ ───────────►  │ Your Server │
3│             │    stdin      │  (ts-node)  │
4│             │ ◄──────────── │             │
5│             │    stdout     │             │
6└─────────────┘               └─────────────┘
  1. Cursor spawns your server as a child process
  2. Communication happens via stdin/stdout
  3. No HTTP server or ports needed

Key Requirement: Absolute Path

Cursor needs the absolute path to your server file. Relative paths won't work.

Example:

  • Correct: /Users/alice/projects/my-mcp-server/src/index.ts
  • Wrong: ./src/index.ts or ~/projects/my-mcp-server/src/index.ts

Choose Your Track

  • Engineers: Follow ENGINEER for manual configuration
  • Non-Engineers: Follow NON-ENGINEER for a Cursor prompt that helps you configure

Configuration Preview

1{
2  "mcpServers": {
3    "my-mcp-server": {
4      "command": "npx",
5      "args": ["-y", "ts-node", "--esm", "/absolute/path/to/src/index.ts"]
6    }
7  }
8}