feat: StackGuardian MCP + skills installer (npx add-sg-mcp) - #1
Open
arunim2405 wants to merge 11 commits into
Open
arunim2405 wants to merge 11 commits into
arunim2405 wants to merge 11 commits into
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
…k auth and skills modules
- package name, bin and config dir become add-sg-mcp; version 0.1.0
- remove registry.json, registry/, web/, scripts/, find.ts and the
find/search/list/sync commands (no tests depend on them any more)
- main() returns an InstallOutcome and honours options.local so the
StackGuardian connect flow can route to project scope without a prompt
- src/sg/{preset,credentials,auth,skills}.ts with tests; bundled skills
under skills/ (sg-create/update/upgrade-workflow)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
- default command: browser login via the dashboard's /orchestrator/cli-connect page (loopback callback), agent selection without the excluded agents, upstream install with the apikey header, skills install, next steps - headless --token/SG_API_KEY path, --project scope with .gitignore, --auth oauth preview, status/remove/logout --purge - e2e suite tests/e2e/sg-cli.test.ts; README, CHANGELOG, RELEASING, AGENTS.md and NOTICE for the fork Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
… it) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
Upstream's installer tests exercise global routing in-process and wrote an `example` server into the developer's real ~/.cursor/mcp.json and VS Code mcp.json. The runner sandboxes HOME/XDG_CONFIG_HOME/CODEX_HOME/APPDATA for every test file; the explicit file lists move from package.json into it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
- guard --dashboard-url parsing when saved credentials exist (was an uncaught TypeError) - validate --api-base in --auth oauth mode like the apikey path - write credentials.json via temp file + rename - a skills directory counts as ours only when the manifest recorded it (or it is a symlink); ownership during removal is judged against the manifest as read at the start of the call - drop the upstream remove-<query> e2e tests (command replaced in Task 7) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
arunim2405
marked this pull request as ready for review
September 8, 2026 15:27
…m tokens Inter, #1b71ec primary, 10px radius, neutral card on muted background, the SG mark inline, and a status pill — matching the dashboard instead of a generic teal card. Still self-contained, key-free, and strips the query. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
One entry per organization, named after it, so several orgs coexist without --name. A spaced form was ruled out: Claude Code rejects server names with anything but letters, digits, hyphens and underscores (they feed the mcp__<server>__<tool> ids) and Codex has the same rule; org names are slugs, so StackGuardian-<org> is always valid. status and remove recognise both name generations and any entry pointing at a StackGuardian MCP URL, and remove without --name clears every such entry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
…nect page Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
… page back The dashboard now hands the credential to the loopback with a form POST instead of a GET redirect, so the key never sits in the browser history, a Referer header or the request line; GET stays for manual use. The landing pages (success, cancelled, refused) link back to the dashboard so Cancel never strands the user on a loopback page. Bodies are capped at 64 KiB; a wrong state is refused without closing the listener. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Turns the
add-mcpfork intoadd-sg-mcp: one command that signs the user in through the StackGuardian dashboard, lets them pick an organization, receives the org API key on a loopback callback (a form POST from the dashboard, so the key never sits in a URL; GET is kept for manual use), writes theStackGuardian-<org>MCP server into every selected coding agent (20 agents: Claude Code, Codex, Cursor, VS Code, Gemini CLI, OpenCode, Copilot CLI, Windsurf, Kiro, Zed, Cline, Goose, Grok Build, Kilo, Kimi, Antigravity, Pi, Mastra, MCPorter) and installs the StackGuardian skills.Design:
docs/superpowers/specs/2026-09-08-sg-mcp-installer-design.md. Dashboard counterpart: StackGuardian/dashboard#6934 (/orchestrator/cli-connect).Key decisions
Authorization: apikey sgu_…), which the gateway authorizer accepts on/orgs/<org>/mcp/. Long-lived, so static agent configs keep working. The MCP OAuth broker (api#1739 & co.) is not deployed and only yields 60-minute tokens;--auth oauthis a preview hook for when it is.--projectopts into project files and adds them to.gitignore.agents.ts,installer.ts,formats/*etc. are byte-identical; everything StackGuardian is insrc/sg/. Registry site,find,list,syncremoved.sg-create-workflow,sg-update-workflow,sg-upgrade-workflow) are bundled, copied to~/.agents/skillsand symlinked into each agent's skills dir (copy fallback; manifest soremovenever touches foreign skills).stateand closes; a wrong state is refused without closing; bodies are capped at 64 KiB; the landing pages (connected / cancelled / refused) never contain the key and link back to the dashboard.Tests
bun run typecheck && bun run test— upstream suites (minus the removed commands) plustests/sg-{preset,credentials,auth,skills}.test.tsandtests/e2e/sg-cli.test.ts(sandboxed HOME: every agent config, credential file mode, skills links, status/remove/logout,--project, failure paths,--help,--auth oauth). The login test spins up the real loopback server.Before release
StackGuardian/add-sg-mcp+release.yml(docs/RELEASING.md).--tokenis the path.sg-clickhouse-mcpREADME atnpx add-sg-mcp.🤖 Generated with Claude Code
https://claude.ai/code/session_01NyMjkoCS1ic9P14Yo3dLLh