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
In this repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bd-to-br-migrationSkill
- codex-plan-reviewSkill
- codex-reviewSkill
- debugging-kubernetes-rolloutsSkill
- debugging-nodejs-appsSkill
- de-sloppingSkill
- detect-overengineeringSkill
- evaluating-third-party-toolsSkill
- finding-latest-versionsSkill
- git-reconSkill
- humanizerSkill
- hyprland-luaSkill
- mining-claude-sessionsSkill
- minto-pyramidSkill
- nonstopSkill
- operating-frappe-on-kubernetesSkill
- presentation-blueprintSkill
- pr-fixSkill
- pr-landSkill
- prSkill
- watching-pr-bot-reviewsSkill
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
- Very specific: line 34
Read the protected resource metadata in Claude's order: the resource_metadata URL from the 401, then the path-specific document, then the …
- Distinctive: line 56
Use a text label, such as "Add to Claude" or the docs' "Connect to Claude".
- Very specific: line 58
Keep the real <a>, target="_blank" rel="noopener noreferrer", the hidden "(opens in a new tab)", the :focus-visible ring and the 44 px …
≈ “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.
Files
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 get | Run |
| The link | add-to-claude-link Example https://mcp.example.com/mcp |
| A README text link | add --format markdown |
| A README badge (shields.io) | add --format badge |
| A web page button | add --format html |
| A React component and its CSS | add --format react |
| The link for organization Owners | add --admin |
| Exit | Meaning |
| 0 | Printed. Read any warnings on stderr. |
| 3 | Usage 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
--adminlink. 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-visiblering and the 44 px height. Give an iconaria-hidden="true". - GitHub removes
<style>from READMEs, so usemarkdownorbadgethere.for-the-badgewrites capitals. A committed SVG button needsrole="img", anaria-label, a<title>and a border for GitHub's dark theme.
Verify
- 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 onlymodal,connectorNameandconnectorUrl. A+stays a+, as indecodeURIComponent. connectorUrlmust equal theresourcevalue exactly, or sign-in fails.- Open the link once, signed in. The dialog must show both values.
- Screenshot it at 1280 and 390 px wide. Press Tab to see the focus ring.
Common mistakes
| Mistake | What happens |
URLSearchParams or quote_plus builds the query | A space becomes +, and decodeURIComponent keeps the +. |
You paste the HTML href, with &, into code or config | Claude gets amp;connectorName, so the name and URL are missing. |
You join an origin that ends in / to /mcp | The link has //mcp. Strip the slash first. |
| A localhost or LAN URL | Claude connects from Anthropic's servers and cannot reach it. Use a public URL or an MCP tunnel. |
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
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.

