Skip to content

The agent that turns websites into APIs!

fix(cursor): pass MCP servers on Agent.resume; honor cursor model CLI overrides

Cursor Agent8101388b91c2
diff --git a/src/reverse_api/cli.py b/src/reverse_api/cli.py
index a5086fc..2d23a6e 100644
--- a/src/reverse_api/cli.py
+++ b/src/reverse_api/cli.py
@@ -1816,7 +1816,7 @@ def run_auto_capture(
output_language=output_language,
interactive=interactive,
headless=headless,
- cursor_model=config_manager.get("cursor_model", "composer-2"),
+ cursor_model=model or config_manager.get("cursor_model", "composer-2"),
cursor_web_search=bool(config_manager.get("cursor_web_search", True)),
cursor_setting_sources=_cursor_src,
)
@@ -2084,14 +2084,15 @@ def run_engineer(
elif sdk == "cursor":
_cs = config_manager.get("cursor_setting_sources")
_cursor_src = _cs if isinstance(_cs, list) and all(isinstance(x, str) for x in _cs) else None
+ _cm = model or config_manager.get("cursor_model", "composer-2")
result = run_reverse_engineering(
run_id=run_id,
har_path=har_path,
prompt=prompt,
- model=None,
+ model=_cm,
output_dir=output_dir,
sdk=sdk,
- cursor_model=config_manager.get("cursor_model", "composer-2"),
+ cursor_model=_cm,
cursor_web_search=bool(config_manager.get("cursor_web_search", True)),
cursor_setting_sources=_cursor_src,
enable_sync=enable_sync,
diff --git a/src/reverse_api/cursor_bridge/run.mjs b/src/reverse_api/cursor_bridge/run.mjs
index cd1a8da..74865db 100644
--- a/src/reverse_api/cursor_bridge/run.mjs
+++ b/src/reverse_api/cursor_bridge/run.mjs
@@ -90,19 +90,17 @@ const usageAgg = {
/** @type {import("@cursor/sdk").SDKAgent | null} */
let agent = null;
try {
+ const agentOpts = {
+ apiKey,
+ model: { id: modelId },
+ local: { cwd, settingSources },
+ ...(mcpServers ? { mcpServers } : {}),
+ };
+
if (resumeAgentId) {
- agent = await Agent.resume(resumeAgentId, {
- apiKey,
- model: { id: modelId },
- local: { cwd, settingSources },
- });
+ agent = await Agent.resume(resumeAgentId, agentOpts);
} else {
- agent = await Agent.create({
- apiKey,
- model: { id: modelId },
- local: { cwd, settingSources },
- mcpServers,
- });
+ agent = await Agent.create(agentOpts);
}
emit({ type: "agent", agentId: agent.agentId });
diff --git a/src/reverse_api/opencode_ui.py b/src/reverse_api/opencode_ui.py
index 59744c2..2fcac5a 100644
--- a/src/reverse_api/opencode_ui.py
+++ b/src/reverse_api/opencode_ui.py
@@ -354,7 +354,7 @@ class OpenCodeUI:
if isinstance(mn, str) and mn:
return f"[dim]{mn[:70]}{'…' if len(mn) > 70 else ''}[/dim]"
return ""
- if tool_lower.startswith("mcp_") or tool_lower.startswith("mcp"):
+ if tool_lower.startswith("mcp"):
keys = ("url", "path", "file_path", "command", "query", "pattern", "browserTab", "tabId", "text")
for k in keys:
v = tool_input.get(k)
diff --git a/src/reverse_api/tui.py b/src/reverse_api/tui.py
index d8f3509..db5d562 100644
--- a/src/reverse_api/tui.py
+++ b/src/reverse_api/tui.py
@@ -271,7 +271,7 @@ class ClaudeUI:
if isinstance(mn, str) and mn:
return f"[dim]{mn[:70]}{'…' if len(mn) > 70 else ''}[/dim]"
return ""
- if tl.startswith("mcp_") or tl.startswith("mcp"):
+ if tl.startswith("mcp"):
keys = ("url", "path", "file_path", "command", "query", "pattern", "browserTab", "tabId", "text")
for k in keys:
v = tool_input.get(k)
diff --git a/src/reverse_api/utils.py b/src/reverse_api/utils.py
index d920ffb..6663b7e 100644
--- a/src/reverse_api/utils.py
+++ b/src/reverse_api/utils.py
@@ -67,12 +67,13 @@ def generate_folder_name(prompt: str, sdk: str = None, session_id: str = None) -
# Already in async context, use fallback to avoid nested asyncio.run
return _slugify(prompt)
+ if sdk == "cursor":
+ return _slugify(prompt)
+
console = Console()
with Status(" [dim]generating folder name...[/dim]", console=console, spinner="dots", spinner_style="dim"):
if sdk == "opencode":
return asyncio.run(_generate_folder_name_opencode_async(prompt, session_id))
- if sdk == "cursor":
- return _slugify(prompt)
return asyncio.run(_generate_folder_name_async(prompt))
except Exception:
pass
diff --git a/tests/test_tui.py b/tests/test_tui.py
index f115b82..2216f60 100644
--- a/tests/test_tui.py
+++ b/tests/test_tui.py
@@ -261,9 +261,9 @@ class TestSummarizeInput:
def test_mcp_tool_url(self):
ui = self._make_ui()
- r = ui._summarize_input("mcp_playwright_navigate", {"url": "https://x.com/y"})
+ r = ui._summarize_input("mcp_playwright_navigate", {"url": "https://example.com/y"})
assert "url" in r
- assert "x.com" in r
+ assert "example.com" in r
def test_todo_write_summary(self):
ui = self._make_ui()