Fix Cursor MCP deeplinks: encode transport-only config so command is not empty.

This commit is contained in:
Dominic Gundel committed 2026-10-19 23:37:04 +02:00
1 parent 4c7e3ff720
commit 694de7d1d7
5 files changed
+68 -22

No files matched your search

+9 -2
View File
@@ -13,7 +13,14 @@ python3 -c '
import base64, json, sys, urllib.parse
name, raw = sys.argv[1], sys.argv[2]
transport = json.loads(raw)
payload = {name: transport}
b64 = base64.urlsafe_b64encode(json.dumps(payload, separators=(",", ":")).encode("utf-8")).decode("ascii").rstrip("=")
# Unwrap { name: transport } if the caller passed it that way.
if set(transport.keys()) == {name} and isinstance(transport[name], dict):
transport = transport[name]
cmd = transport.get("command") or ""
if len(cmd) >= 3 and cmd[1] == ":" and "\\" in cmd:
transport = dict(transport)
transport["command"] = cmd.replace("\\\\", "/").replace("\\", "/")
# config = transport only; name= is a separate query param.
b64 = base64.urlsafe_b64encode(json.dumps(transport, separators=(",", ":")).encode("utf-8")).decode("ascii").rstrip("=")
print(f"cursor://anysphere.cursor-deeplink/mcp/install?name={urllib.parse.quote(name)}&config={b64}")
' "$name" "$config"