Add selfgraph install for one-command MCP setup

Aperta
#332 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, typescript

Direzione di ricerca

Start with docs/mcp.md and the existing install and error handling in both SDKs; the issue does not name implementation files or tests. Review the JSON agent configs and the proposed TOML table replacement, then agree on the three open credential, TOML, and skill-copy decisions. Done means both SDKs produce matching files, output, flags, and error codes, with tests using a temporary home directory.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: cli-mcp effort: M feature P2

Setting up the MCP server is the worst part of trying SelfGraph right now.

You read docs/mcp.md, copy a JSON block, then work out where your agent wants it. Every agent has its own idea:

  • .mcp.json vs .cursor/mcp.json vs .vscode/mcp.json
  • mcpServers vs servers
  • Codex uses TOML

Then you have to get the command right: selfgraph mcp if the binary on your PATH is the one you installed, python -m selfgraph mcp if it isn't, npx for the TS package. People get this wrong. Agents setting themselves up get it wrong too.

This should be one command.

What I want

selfgraph install                   # every agent whose config folder exists here
selfgraph install claude cursor     # only these
selfgraph --store kuzu --uri ./graph install codex --global
selfgraph install --dry-run         # show what would change, write nothing
selfgraph install --remove          # take it back out
agent project file user file (--global)
claude .mcp.json ~/.claude.json
cursor .cursor/mcp.json ~/.cursor/mcp.json
vscode .vscode/mcp.json none
gemini .gemini/settings.json ~/.gemini/settings.json
windsurf none ~/.codeium/windsurf/mcp_config.json
codex .codex/config.toml ~/.codex/config.toml

Rules:

  • Only our entry. Touch the selfgraph entry and nothing else. Other servers, other keys and comments in the TOML all stay as they are. Running it twice is a no-op.
  • Broken config. If a config file doesn't parse, leave it alone and fail before writing anything. No half-written state across files.
  • Server command. Write the command that actually starts this install. Python writes selfgraph mcp, or python -m selfgraph mcp with the current interpreter when the selfgraph on PATH belongs to a different environment. TS writes its npx line.
  • Connection flags. Flags given on the command line (--store, --uri, --namespace, --schema) go into the entry's env as SELFGRAPH_*. Variables that are only set in your shell are not copied, because that surprises people.
  • Skill. For claude, also copy the shipped SKILL.md into .claude/skills/selfgraph/.
  • Parity. Same files, same output lines, same flags and same error codes from both SDKs. Every failure gets a code and a hint, with a section in docs/errors.md, same as everything else now.

Credentials

This is the part I care about most.

.mcp.json and friends get committed. So install must never write a password, a token, or a URI with userinfo into a project file. If you pass one, it fails and tells you to use --global or to set the variable in the agent's own environment. --dry-run output and error messages never print the secret either. This follows the masking rules we just landed.

For --global I lean towards refusing as well, for consistency, but I can see the case for allowing it with a warning. See question 1 below.

Not doing

  • Installing SelfGraph itself, or starting a store.
  • Agents beyond the six above. Adding one later is a table row and a test.

Plan

I have this working in both SDKs, with tests that run against a temp home dir, so nothing touches the real one. It's around 1,500 lines, so two stacked PRs:

  1. The JSON agents (claude, cursor, vscode, gemini, windsurf) plus the skill copy.
  2. codex.

Codex is separate because it needs a TOML edit. Python 3.10 has no tomllib, and neither Python nor Node has a TOML writer in the stdlib. So the edit is a small one that replaces our table and keeps every other byte of the file. I'd rather review that on its own than bury it in PR 1.

Questions

  1. With --global, refuse credentials like we do for project files, or write them with a warning?
  2. Is a small table-replacing TOML edit OK, or do we want a dependency for it?
  3. Should the skill copy be opt-out with --no-skill, or always on for claude?
Lingua principale
TypeScript
Stelle
173
Fork
58
Merge medio
6h
PR unite (30g)
120

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hydra-db/selfgraph

Tutte le issue di hydra-db/selfgraph

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.