Repository navigation
Conversation
…e-ai#1012) Move the Cursor/VS Code deep-link builders into lib/mcp-install-links.ts, add https install-link variants, and a 'Share this server' card with a locally rendered preview, Copy Markdown/HTML, OAuth-only gating and a localhost warning. Adds Playwright coverage and a docs paragraph. Closes HelpCode-ai#1012
helpcodeai
left a comment
There was a problem hiding this comment.
Thanks @GallaGit, this is really clean work. The lib split is nice, the in-app deep links are unchanged, and the tests cover exactly what the issue asked (decoded config, no third-party requests, legacy mode). I checked both https formats against the live endpoints: cursor.com/en/install-mcp redirects to /install-mcp and decodes a padded, URL-encoded config correctly, and vscode.dev/redirect/mcp/install redirects to vscode:mcp/install with the right config. tsc, eslint and the full Playwright suite (191) pass, also merged onto current main.
One thing to fix before merge:
- Parentheses in the slug break the Markdown snippet.
encodeURIComponentleaves(and)alone, and the backend accepts any slug string. With the slugx)(www.evil.example, GitHub ends the badge link atname=xand turnswww.evil.example…into a clickable link in the README. Could you percent-encode(and)(ideally!*'too) incursorInstallUrl/vscodeInstallUrl, and add a test with such a slug? The HTML snippet is already fine.
Smaller things, up to you:
- Could the preview badges link to the https install URLs, so the preview behaves like what gets shared? Right now a right-click copy gives a
cursor://link that GitHub drops. - While
/health/server-infois loading, or if it fails, the card shows only its title. Maybe hide the card until the auth mode is known. - The code block adds a third "Copy" button, logged as
modal-Markdown. Showing the snippet in a plain<pre>would avoid the duplicate. - The VS Code image text ("Install MCP server") and its alt text ("Add to VS Code") don't match. Also, white on
#0098FFis about 3:1, so a darker blue would pass AA.
Thanks again, almost there!
- percent-encode ( ) ! * ' in https install URLs so slugs cannot break Markdown links - preview badges link to the shared https install URLs - hide Share card until auth mode is known - plain <pre> for the snippet (no duplicate copy button) - VS Code badge reads 'Add to VS Code' on #0066CC (5.57:1)
|
Thanks for the thorough review! Pushed fixes:
tsc and eslint are clean (0 errors), and the full frontend e2e suite passes: 193 tests (191 + 2 new). |
Closes #1012
What
packages/frontend/src/lib/mcp-install-links.ts: pure builders taking{ name, url }. The existingcursor:///vscode:deep links moved here unchanged; https variants sit next to them:https://cursor.com/en/install-mcp?name=<slug>&config=<base64 {"url"}>https://vscode.dev/redirect/mcp/install?name=<slug>&config=<URL-encoded {"name","type":"http","url"}>handleCopy, soclient_config_copiedis recorded;mcpAuthModeisoauth2orboth; inlegacy/nonethe card shows a one-line explanation instead.localhostor127.0.0.1(also::1and*.localhost).docs/guides.md.Badge images: Cursor's official button (
cursor.com/deeplink/mcp-install-dark.svg) and a shields.io static badge for VS Code (no official button). Only in the copied snippet, never loaded by the page. Happy to switch Cursor to shields.io too if you prefer.Docs referenced
Tests
New tests in
mcp-server-connect-clients.spec.tscheck that:configmatches the server endpoint exactly;cursor://,vscode:,X-API-Key, token or cookie;page.on('request')sees no request to a third-party host;legacymode shows the explanation instead of the badges.Playwright: 10/10 passing. Lint and
tsc --noEmitclean.Manual verification
Pasted the generated Markdown badges (server
anythingmcp-test, URLhttps://example.com/mcp) into a secret GitHub gist README. Both badges rendered. "Add to Cursor" opened Cursor and installed the server with the correct URL; "Add to VS Code" opened VS Code and installed the server with the correct URL. Tested on Windows, 2026-10-16.@helpcodeai ready for review.