Skip to content

Commit 7201837

Browse files
Merge pull request #41 from mapbox/otel_docs_fix
[otel] Update DevKit Server docs with OTEL information
2 parents 57d19d1 + e62d286 commit 7201837

File tree

12 files changed

+466
-149
lines changed

12 files changed

+466
-149
lines changed

.env.example

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
# Get your token at: https://account.mapbox.com/access-tokens
1010
MAPBOX_ACCESS_TOKEN=your-mapbox-token-here
1111

12-
# =============================================================================
13-
# Optional MCP Configuration
14-
# =============================================================================
15-
16-
# Disable console logging (recommended when using stdio transport)
17-
# Uncomment to enable:
18-
# MCP_DISABLE_LOGGING=true
19-
2012
# =============================================================================
2113
# OpenTelemetry Tracing (Optional)
2214
# =============================================================================
@@ -35,9 +27,12 @@ OTEL_SERVICE_NAME=mapbox-mcp-devkit-server
3527
# Resource attributes (customize as needed)
3628
OTEL_RESOURCE_ATTRIBUTES=service.name=mapbox-mcp-devkit-server,service.version=0.4.5
3729

38-
# Optional: Console tracing for development (SSE transport only)
39-
# ⚠️ Do NOT enable with stdio transport - it breaks JSON-RPC communication
40-
# OTEL_EXPORTER_CONSOLE_ENABLED=true
30+
# Optional: OTEL diagnostic log level (default: NONE)
31+
# This server uses stdio transport exclusively. OTEL diagnostic logs are disabled
32+
# by default to prevent corrupting JSON-RPC communication.
33+
# Set to DEBUG, INFO, WARN, or ERROR only for troubleshooting OTEL configuration issues.
34+
# Valid values: NONE (default), ERROR, WARN, INFO, DEBUG, VERBOSE
35+
# OTEL_LOG_LEVEL=ERROR
4136

4237
# Optional: OTLP authentication headers (for production backends)
4338
# OTEL_EXPORTER_OTLP_HEADERS={"Authorization": "Bearer your-token"}

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ This server includes OpenTelemetry (OTEL) instrumentation for distributed tracin
5656
### Environment Variables
5757

5858
- `OTEL_EXPORTER_OTLP_ENDPOINT` — OTLP endpoint URL (e.g., `http://localhost:4318`). If not set, tracing is disabled.
59-
- `OTEL_EXPORTER_CONSOLE_ENABLED` — Set to `true` to log traces to console (avoid with stdio transport)
6059
- `OTEL_TRACING_ENABLED` — Set to `false` to explicitly disable tracing even if endpoint is configured
6160
- `OTEL_SERVICE_NAME` — Override service name (default: `mapbox-mcp-devkit-server`)
6261
- `OTEL_EXPORTER_OTLP_HEADERS` — JSON string of additional headers for OTLP exporter
62+
- `OTEL_LOG_LEVEL` — OTEL diagnostic log level: `NONE` (default), `ERROR`, `WARN`, `INFO`, `DEBUG`, `VERBOSE`. Defaults to `NONE` to prevent diagnostic logs from corrupting stdio transport.
6363

6464
### What Gets Traced
6565

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,20 @@ https://github.com/user-attachments/assets/8b1b8ef2-9fba-4951-bc9a-beaed4f6aff6
2727
- [Coordinate Conversion tool](#coordinate-conversion-tool)
2828
- [Bounding Box tool](#bounding-box-tool)
2929
- [Resources](#resources)
30-
- [Observability & Tracing](#observability--tracing)
30+
- [Observability \& Tracing](#observability--tracing)
31+
- [Features](#features)
32+
- [Quick Start with Jaeger](#quick-start-with-jaeger)
33+
- [Supported Backends](#supported-backends)
34+
- [Documentation](#documentation)
35+
- [Environment Variables](#environment-variables)
3136
- [Development](#development)
3237
- [Testing](#testing)
3338
- [Tool Snapshot Tests](#tool-snapshot-tests)
3439
- [Inspecting Server](#inspecting-server)
3540
- [Using Node.js](#using-nodejs)
3641
- [Using Docker](#using-docker)
3742
- [Creating New Tools](#creating-new-tools)
38-
- [Environment Variables](#environment-variables)
43+
- [Environment Variables](#environment-variables-1)
3944
- [VERBOSE_ERRORS](#verbose_errors)
4045
- [Troubleshooting](#troubleshooting)
4146
- [Contributing](#contributing)
@@ -48,6 +53,8 @@ Get started by integrating with your preferred AI development environment:
4853

4954
- [Claude Code Integration](./docs/claude-code-integration.md) - Command-line development with Claude
5055
- [Claude Desktop Integration](./docs/claude-desktop-integration.md) - Desktop application integration
56+
- [Cursor Integration](./docs/cursor-integration.md) - Cursor IDE integration
57+
- [VS Code Integration](./docs/vscode-integration.md) - Visual Studio Code with GitHub Copilot
5158

5259
### DXT Package Distribution
5360

@@ -592,11 +599,8 @@ npm test -- --updateSnapshot
592599
#### Using Node.js
593600

594601
```sh
595-
# Build
596-
npm run build
597-
598-
# Inspect
599-
npx @modelcontextprotocol/inspector node dist/esm/index.js
602+
# Run the built image
603+
npm run inspect:build
600604
```
601605

602606
#### Using Docker

docs/claude-code-integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ If you want to use a local version (need to clone and build from this repo):
9595
{
9696
"mcpServers": {
9797
"mapbox-devkit": {
98-
"command": "/path/to/your/node",
99-
"args": ["/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
98+
"command": "node",
99+
"args": ["/absolute/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
100100
"env": {
101101
"MAPBOX_ACCESS_TOKEN": "your_token_here"
102102
}

docs/claude-desktop-integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ If you want to use a local version (need to clone and build from this repo):
106106
{
107107
"mcpServers": {
108108
"mapbox-devkit": {
109-
"command": "/path/to/your/node",
110-
"args": ["/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
109+
"command": "node",
110+
"args": ["/absolute/path/to/mapbox-mcp-devkit/dist/esm/index.js"],
111111
"env": {
112112
"MAPBOX_ACCESS_TOKEN": "your_token_here"
113113
}

docs/cursor-integration.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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.

docs/tracing-verification.md

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ npm run tracing:jaeger:stop
7373

7474
### Successful Tracing Setup
7575

76-
**Console output shows**: `OpenTelemetry tracing: enabled`
77-
78-
**Jaeger UI shows traces** for your service
76+
**Jaeger UI shows traces** for your service after tool execution
7977

8078
**Trace details include**:
8179

@@ -193,34 +191,16 @@ OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io/v1/traces
193191
OTEL_EXPORTER_OTLP_HEADERS='{"x-honeycomb-team":"YOUR_API_KEY"}'
194192
```
195193

196-
## Alternative Methods
197-
198-
### Console Tracing (Development Only)
199-
200-
**⚠️ Not recommended for stdio transport**
201-
202-
```bash
203-
# Add to .env (only works well with SSE transport)
204-
OTEL_EXPORTER_CONSOLE_ENABLED=true
205-
```
206-
207-
This prints traces to stderr. Only use this for debugging, as it can interfere with MCP's stdio communication.
208-
209-
### Verifying Different Transports
194+
## Diagnostic Logging
210195

211-
#### stdio Transport (Default) - Silent Operation
196+
By default, OpenTelemetry diagnostic logs are disabled to prevent interference with stdio transport. If you need to troubleshoot OTEL configuration issues, you can enable diagnostic logging:
212197

213198
```bash
214-
# Normal operation
215-
npm run inspect:build
199+
# Add to .env - only for debugging OTEL issues
200+
OTEL_LOG_LEVEL=ERROR
216201
```
217202

218-
#### SSE Transport - Full Logging
219-
220-
```bash
221-
# If your inspector supports SSE transport
222-
SERVER_TRANSPORT=sse npm run inspect:build
223-
```
203+
**⚠️ Warning:** Any console output (including OTEL diagnostic logs) can corrupt stdio communication. Only enable diagnostic logging when actively troubleshooting, and disable it once resolved.
224204

225205
## Production Considerations
226206

docs/tracing.md

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22

33
This MCP server includes comprehensive distributed tracing using OpenTelemetry (OTEL), providing production-ready observability for tool executions and HTTP requests.
44

5-
## ⚠️ Important MCP Transport Compatibility
5+
## ⚠️ Important: Stdio Transport Only
66

7-
**Console tracing should be avoided with stdio transport** as console output interferes with MCP's stdio JSON-RPC communication.
7+
**This server uses stdio transport exclusively.** Only OTLP exporters are supported for tracing.
88

9-
**Transport-specific recommendations:**
10-
11-
- **stdio transport (default):** Use OTLP exporters only, avoid console tracing
12-
- **SSE transport:** Console tracing is safe to use for development
13-
14-
The server automatically detects the transport type and adjusts logging behavior accordingly.
9+
Console output is incompatible with stdio and will corrupt JSON-RPC communication. All diagnostic logging is disabled by default to ensure reliable operation.
1510

1611
## Features
1712

@@ -56,14 +51,15 @@ The tracing system supports several configuration options through environment va
5651
#### Basic Configuration
5752

5853
```bash
59-
# Enable console tracing (development)
60-
OTEL_EXPORTER_CONSOLE_ENABLED=true
61-
62-
# OTLP HTTP endpoint (production)
54+
# OTLP HTTP endpoint (required to enable tracing)
6355
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
6456

6557
# Optional OTLP headers for authentication
6658
OTEL_EXPORTER_OTLP_HEADERS='{"Authorization": "Bearer your-token"}'
59+
60+
# Optional: OTEL diagnostic log level (default: NONE)
61+
# Only use for troubleshooting OTEL configuration issues
62+
OTEL_LOG_LEVEL=ERROR
6763
```
6864

6965
#### Service Configuration
@@ -82,29 +78,23 @@ OTEL_TRACES_SAMPLER=traceidratio
8278
OTEL_TRACES_SAMPLER_ARG=0.1 # Sample 10% of traces
8379
```
8480

85-
### Transport-Specific Configuration
81+
### Enabling Tracing
8682

87-
**For stdio transport (default):**
83+
Tracing is opt-in and disabled by default. To enable tracing, you must configure an OTLP endpoint:
8884

8985
```bash
90-
# ✅ RECOMMENDED: Use OTLP exporter for stdio transport
86+
# Enable tracing by setting the OTLP endpoint
9187
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
9288

93-
# ❌ AVOID: Console output interferes with stdio JSON-RPC
94-
# OTEL_EXPORTER_CONSOLE_ENABLED=true
95-
```
96-
97-
**For SSE transport:**
98-
99-
```bash
100-
# ✅ SAFE: Console tracing works with SSE transport
101-
SERVER_TRANSPORT=sse
102-
OTEL_EXPORTER_CONSOLE_ENABLED=true
89+
# Optionally customize the service name
90+
OTEL_SERVICE_NAME=mapbox-mcp-devkit-server
10391

104-
# ✅ ALSO GOOD: OTLP exporter works with any transport
105-
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
92+
# For debugging OTEL configuration issues only
93+
# OTEL_LOG_LEVEL=ERROR
10694
```
10795

96+
**Note:** Console exporters are not supported due to stdio transport limitations.
97+
10898
### Verification
10999

110100
To verify tracing is working correctly, see the [Tracing Verification Guide](./tracing-verification.md) which shows how to:

0 commit comments

Comments
 (0)