agentleFS
Smirnov-LabsSmirnov-Labs/claude-skills/skills/adding-an-add-to-claude-button/SKILL.md

adding-an-add-to-claude-button

Skill6 starsChanged 9 days agoMITView on GitHub

Use when you add an "Add to Claude" or "Connect to Claude" button or link for a remote MCP server to a README, landing page, docs page or web app, or when such a link opens an empty dialog, loses the server URL or points at //mcp.

  • Sends data out

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the protected resource metadata in Claude's order: the resource_metadata URL from the 401, then the path-specific document, then the …

    line 34
  2. Distinctive:

    Use a text label, such as "Add to Claude" or the docs' "Connect to Claude".

    line 56
  3. Very specific:

    Keep the real <a>, target="_blank" rel="noopener noreferrer", the hidden "(opens in a new tab)", the :focus-visible ring and the 44 px …

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add to Claude button

A claude.ai link opens the Add custom connector dialog with a server's name and URL filled in. add-to-claude-link prints the link, or a button that uses it, with the encoding and escaping done.

To getRun
The linkadd-to-claude-link Example https://mcp.example.com/mcp
A README text linkadd --format markdown
A README badge (shields.io)add --format badge
A web page buttonadd --format html
A React component and its CSSadd --format react
The link for organization Ownersadd --admin
ExitMeaning
0Printed. Read any warnings on stderr.
3Usage error. --help has the details.

The link

https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=NAME&connectorUrl=ENCODED_URL (docs)

  • It only fills in the dialog. Claude says the values came from an external link, and the user confirms. A signed-out user signs in first.
  • On Team and Enterprise plans, most members can't add custom connectors (docs). Tell them to ask an Owner, and give Owners the --admin link. The Free plan allows one custom connector.
  • A connector in the directory has its own link, https://claude.ai/directory/connectors/SLUG.

OAuth

Read the protected resource metadata in Claude's order: the resource_metadata URL from the 401, then the path-specific document, then the root one.

U=https://mcp.example.com/mcp W=https://mcp.example.com/.well-known/oauth-protected-resource
R=$(curl -si -X POST "$U" | grep -i '^www-authenticate' | sed -n 's/.*resource_metadata="\([^"]*\)".*/\1/p')
for m in $R "$W/mcp" "$W"; do curl -sf "$m" && break; done | jq '{resource, authorization_servers}'

Claude uses only the first authorization server. Split its issuer into an origin O and a path P, which is often empty, then read its metadata:

O=https://auth.example.com P=/tenant
for m in "$O/.well-known/oauth-authorization-server$P" "$O/.well-known/openid-configuration$P" "$O$P/.well-known/openid-configuration"
do curl -sf "$m" && break; done | jq '{registration_endpoint, client_id_metadata_document_supported, token_endpoint_auth_methods_supported}'

Claude's recommended OAuth client needs client_id_metadata_document_supported: true and "none" in the auth methods. If the server has only a registration_endpoint, add this line next to the button:

If Claude asks which OAuth client to use, choose Register automatically.

Design

  • Use a text label, such as "Add to Claude" or the docs' "Connect to Claude". Anthropic's Trademark Guidelines allow its logos only with prior approval, so the badge leaves out shields.io's logo=claude.
  • Text needs 4.5:1 contrast (WCAG AA). White on Claude orange #D97757 is 3.1:1, and on #C15F3C 4.2:1. The html button is #FAF9F5 on #1F1E1D (15.8:1) with a grey border for dark pages, and the badge is white on #B05730 (4.9:1). Your own tokens are fine if they pass.
  • Keep the real <a>, target="_blank" rel="noopener noreferrer", the hidden "(opens in a new tab)", the :focus-visible ring and the 44 px height. Give an icon aria-hidden="true".
  • GitHub removes <style> from READMEs, so use markdown or badge there. for-the-badge writes capitals. A committed SVG button needs role="img", an aria-label, a <title> and a border for GitHub's dark theme.

Verify

  1. Decode the link: python3 -c 'import sys,urllib.parse as u; print(u.parse_qs(u.urlsplit(sys.argv[1]).query.replace("+", "%2B")))' "LINK". Expect only modal, connectorName and connectorUrl. A + stays a +, as in decodeURIComponent.
  2. connectorUrl must equal the resource value exactly, or sign-in fails.
  3. Open the link once, signed in. The dialog must show both values.
  4. Screenshot it at 1280 and 390 px wide. Press Tab to see the focus ring.

Common mistakes

MistakeWhat happens
URLSearchParams or quote_plus builds the queryA space becomes +, and decodeURIComponent keeps the +.
You paste the HTML href, with &amp;, into code or configClaude gets amp;connectorName, so the name and URL are missing.
You join an origin that ends in / to /mcpThe link has //mcp. Strip the slash first.
A localhost or LAN URLClaude connects from Anthropic's servers and cannot reach it. Use a public URL or an MCP tunnel.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.