|
| 1 | +# Cursor Integration |
| 2 | + |
| 3 | +This guide explains how to configure Cursor IDE for use with the Mapbox MCP DevKit Server. |
| 4 | + |
| 5 | +## Requirements |
| 6 | + |
| 7 | +- [Cursor](https://www.cursor.com/) installed |
| 8 | +- Mapbox MCP DevKit Server [built locally](../README.md#development-setup) |
| 9 | + |
| 10 | +```sh |
| 11 | +# from repository root: |
| 12 | +# using node |
| 13 | +npm run build |
| 14 | + |
| 15 | +# or alternatively, using docker |
| 16 | +docker build -t mapbox-mcp-devkit . |
| 17 | +``` |
| 18 | + |
| 19 | +## Setup Instructions |
| 20 | + |
| 21 | +### Configure Cursor to use Mapbox MCP DevKit Server |
| 22 | + |
| 23 | +1. Go to Cursor Settings/ MCP Tools and click on "Add Custom MCP". |
| 24 | +2. Add either of the following MCP config: |
| 25 | + - **NPM version** (recommended for simplicity) |
| 26 | + |
| 27 | + ```json |
| 28 | + { |
| 29 | + "mcpServers": { |
| 30 | + "MapboxDevKit": { |
| 31 | + "type": "stdio", |
| 32 | + "command": "npx", |
| 33 | + "args": ["-y", "@mapbox/mcp-devkit-server"], |
| 34 | + "env": { |
| 35 | + "MAPBOX_ACCESS_TOKEN": "<YOUR_TOKEN>" |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + } |
| 40 | + ``` |
| 41 | + |
| 42 | + - **Docker version** (recommended for isolation) |
| 43 | + |
| 44 | + ```json |
| 45 | + { |
| 46 | + "mcpServers": { |
| 47 | + "MapboxDevKit": { |
| 48 | + "type": "stdio", |
| 49 | + "command": "docker", |
| 50 | + "args": [ |
| 51 | + "run", |
| 52 | + "-i", |
| 53 | + "--rm", |
| 54 | + "--env", |
| 55 | + "MAPBOX_ACCESS_TOKEN=<YOUR_TOKEN>", |
| 56 | + "mapbox-mcp-devkit" |
| 57 | + ] |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | + ``` |
| 62 | + |
| 63 | + - **Node version** (for local development) |
| 64 | + ```json |
| 65 | + { |
| 66 | + "mcpServers": { |
| 67 | + "MapboxDevKit": { |
| 68 | + "type": "stdio", |
| 69 | + "command": "node", |
| 70 | + "args": ["/absolute/path/to/repo/dist/esm/index.js"], |
| 71 | + "env": { |
| 72 | + "MAPBOX_ACCESS_TOKEN": "<YOUR_TOKEN>" |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | + ``` |
| 78 | + |
| 79 | +3. Click "Save" to apply the configuration. |
| 80 | + |
| 81 | +## Important Notes |
| 82 | + |
| 83 | +### Token Scopes |
| 84 | + |
| 85 | +Your Mapbox access token must have the appropriate scopes for the tools you want to use. See the [main README](../README.md#tools) for required token scopes per tool. |
| 86 | + |
| 87 | +### Configuration Options |
| 88 | + |
| 89 | +Additional environment variables you can set: |
| 90 | + |
| 91 | +- `OTEL_EXPORTER_OTLP_ENDPOINT` - Enable OpenTelemetry tracing (see [tracing docs](./tracing.md)) |
| 92 | +- `OTEL_SERVICE_NAME` - Override service name for tracing |
| 93 | +- `MAPBOX_API_ENDPOINT` - Override Mapbox API endpoint (advanced) |
| 94 | + |
| 95 | +## Troubleshooting |
| 96 | + |
| 97 | +### Server Not Appearing |
| 98 | + |
| 99 | +If the Mapbox DevKit Server doesn't appear in Cursor's MCP tools: |
| 100 | + |
| 101 | +1. Check that your `MAPBOX_ACCESS_TOKEN` is valid |
| 102 | +2. For Docker: ensure the image is built with `docker images | grep mapbox-mcp-devkit` |
| 103 | +3. Check Cursor's logs for any error messages |
| 104 | + |
| 105 | +### Connection Errors |
| 106 | + |
| 107 | +If you see JSON-RPC or parsing errors: |
| 108 | + |
| 109 | +1. If using Node version, verify the path to `dist/esm/index.js` is correct |
| 110 | +2. Run `npm run build` to ensure the latest build is available |
| 111 | + |
| 112 | +### Tool Execution Failures |
| 113 | + |
| 114 | +If tools fail to execute: |
| 115 | + |
| 116 | +1. Verify your Mapbox token has the required scopes (see [README](../README.md)) |
| 117 | +2. Check if you're hitting rate limits (429 errors) |
| 118 | +3. Enable verbose errors by adding `"VERBOSE_ERRORS": "true"` to the env config |
| 119 | + |
| 120 | +## Example Usage |
| 121 | + |
| 122 | +Once configured, you can use natural language to interact with Mapbox tools: |
| 123 | + |
| 124 | +- "List all my Mapbox styles" |
| 125 | +- "Show me the bounding box for San Francisco" |
| 126 | +- "Convert these coordinates to lat/lng: -122.4194, 37.7749" |
| 127 | +- "Create a new Mapbox style called 'my-custom-map'" |
| 128 | + |
| 129 | +See the [README](../README.md#example-prompts) for more example prompts. |
0 commit comments