Skip to content

Commit 992585f

Browse files
[cursor] Adding bug fixes for known Cursor issues
1 parent b7baf99 commit 992585f

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ This file provides Claude and developers with essential context, commands, and s
7171

7272
## Known Issues & Warnings
7373

74+
- **Cursor + OpenAI models compatibility issue** - ALL OpenAI models (GPT-4, GPT-3.5, o1, o1-mini) fail with `[invalid_argument]` errors in Cursor when using `create_style_tool` and `update_style_tool` (works fine in VS Code, works fine with Claude in Cursor). Root cause: Cursor can't handle tools with complex input schemas when used with OpenAI models. **Workaround:** Set `CURSOR_OPENAI_MODE=true` to auto-disable the problematic tools. You'll still have 15/17 tools working.
7475
- Large GeoJSON files may cause slow performance in preview tools
7576
- Always check token scopes if a tool fails with authentication errors
7677
- Use `VERBOSE_ERRORS=true` for detailed error output

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ https://github.com/user-attachments/assets/8b1b8ef2-9fba-4951-bc9a-beaed4f6aff6
3535
- [Creating New Tools](#creating-new-tools)
3636
- [Environment Variables](#environment-variables)
3737
- [VERBOSE_ERRORS](#verbose_errors)
38+
- [CURSOR_OPENAI_MODE](#cursor_openai_mode)
39+
- [Troubleshooting](#troubleshooting)
40+
- [Cursor + OpenAI Models Issues](#cursor--openai-models-issues)
41+
- [General Troubleshooting](#general-troubleshooting)
3842
- [Contributing](#contributing)
3943

4044
## Quick Start
@@ -558,6 +562,109 @@ Set `VERBOSE_ERRORS=true` to get detailed error messages from the MCP server. Th
558562

559563
By default, the server returns generic error messages. With verbose errors enabled, you'll receive the actual error details, which can help diagnose API connection issues, invalid parameters, or other problems.
560564

565+
#### CURSOR_OPENAI_MODE
566+
567+
Set `CURSOR_OPENAI_MODE=true` when using **any OpenAI model (GPT-4, GPT-3.5, o1, o1-mini) in Cursor**. This is a simple workaround for Cursor's bug with OpenAI models and complex tool schemas.
568+
569+
**What it does:**
570+
571+
- Automatically disables `create_style_tool` and `update_style_tool`
572+
- These tools have complex input schemas that break Cursor's OpenAI integration
573+
- You'll still have 15 out of 17 tools working (all read/query/preview operations)
574+
575+
**When to use:**
576+
577+
- ✅ Using GPT-4, GPT-3.5, o1, or o1-mini in Cursor
578+
- ❌ Not needed for Claude models in Cursor (all tools work)
579+
- ❌ Not needed in VS Code (all tools work with all models)
580+
581+
**Example:**
582+
583+
```json
584+
{
585+
"mcpServers": {
586+
"mapbox-devkit": {
587+
"env": {
588+
"MAPBOX_ACCESS_TOKEN": "your-token",
589+
"CURSOR_OPENAI_MODE": "true"
590+
}
591+
}
592+
}
593+
}
594+
```
595+
596+
## Troubleshooting
597+
598+
### Cursor + OpenAI Models Issues
599+
600+
**Problem:** When using **any OpenAI model (GPT-4, GPT-3.5, o1, o1-mini)** in Cursor, the `create_style_tool` and `update_style_tool` cause failures with `[invalid_argument]` errors.
601+
602+
**Example error:**
603+
604+
```
605+
ConnectError: [invalid_argument] Error
606+
The model returned an error. Try disabling MCP servers, or switch models.
607+
```
608+
609+
**Cause:** This is a Cursor-specific bug with o1 model MCP integration. The same server works fine with o1 in VS Code and other MCP clients.
610+
611+
**Root Cause:** Cursor's integration with OpenAI models fails when tools have complex input schemas with `.passthrough()` (like `create_style_tool` and `update_style_tool` which accept full Mapbox Style Specification objects). The error is: `[AiService] streamResponse ConnectError: [invalid_argument]`
612+
613+
**Affected:**
614+
615+
- ❌ Cursor + GPT-4 - Fails with these 2 tools
616+
- ❌ Cursor + GPT-3.5 - Fails with these 2 tools
617+
- ❌ Cursor + o1/o1-mini - Fails with these 2 tools
618+
- ✅ Cursor + Claude - Works with all tools
619+
- ✅ VS Code + any model - Works with all tools
620+
621+
**Simple Fix - Use CURSOR_OPENAI_MODE:**
622+
Add `CURSOR_OPENAI_MODE=true` to automatically disable the problematic tools:
623+
624+
```json
625+
{
626+
"mcpServers": {
627+
"mapbox-devkit": {
628+
"command": "node",
629+
"args": ["/path/to/dist/esm/index.js"],
630+
"env": {
631+
"MAPBOX_ACCESS_TOKEN": "your-token",
632+
"CURSOR_OPENAI_MODE": "true"
633+
}
634+
}
635+
}
636+
}
637+
```
638+
639+
This automatically disables `create_style_tool` and `update_style_tool` which have complex input schemas that break Cursor's OpenAI integration. You'll still have **15 out of 17 tools** working, including all read/query operations.
640+
641+
**Other Solutions:**
642+
643+
1. **Use Claude in Cursor** - All 17 tools work perfectly with Claude models in Cursor
644+
2. **Use VS Code** - All OpenAI models work with all 17 tools in VS Code (no workaround needed)
645+
3. **Manually disable tools:**
646+
```json
647+
{
648+
"args": [
649+
"/path/to/dist/esm/index.js",
650+
"--disable-tools",
651+
"create_style_tool,update_style_tool"
652+
]
653+
}
654+
```
655+
656+
**Status:** This is a Cursor bug with how it handles OpenAI models + MCP tools with complex input schemas. The same tools work fine in VS Code.
657+
658+
### General Troubleshooting
659+
660+
**Issue:** Tools fail with authentication errors
661+
662+
**Solution:** Check that your `MAPBOX_ACCESS_TOKEN` has the required scopes for the tool you're using. See the token scopes section above.
663+
664+
**Issue:** Large GeoJSON files cause slow performance
665+
666+
**Solution:** The GeoJSON preview tool may be slow with very large files. Consider simplifying geometries or using smaller datasets for preview purposes.
667+
561668
## Contributing
562669

563670
We welcome contributions to the Mapbox Development MCP Server! Please review our standards and guidelines before contributing:

src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ const config = parseToolConfigFromArgs();
1616

1717
// Get and filter tools based on configuration
1818
const allTools = getAllTools();
19+
20+
// Cursor + OpenAI models have issues with complex input schemas (create_style_tool, update_style_tool)
21+
// This provides an easy workaround
22+
const cursorOpenAiMode = process.env.CURSOR_OPENAI_MODE === 'true';
23+
if (cursorOpenAiMode && !config.disabledTools) {
24+
config.disabledTools = ['create_style_tool', 'update_style_tool'];
25+
}
26+
1927
const enabledTools = filterTools(allTools, config);
2028

2129
// Create an MCP server

0 commit comments

Comments
 (0)