graphmycode-mcp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # graphmycode-mcp
2
2
 
3
- MCP server for codebase structure analysis. Provides dependency graphs, community detection, hotspot identification, and agent context generation directly inside Claude Code.
3
+ [![npm version](https://img.shields.io/npm/v/graphmycode-mcp)](https://www.npmjs.com/package/graphmycode-mcp)
4
+
5
+ MCP server for codebase structure analysis. Provides dependency graphs, community detection, hotspot identification, and agent context generation.
6
+
7
+ Works with **Claude Code, Cursor, Windsurf, Cline, Continue, Zed, and Google Antigravity**.
4
8
 
5
9
  ## Install
6
10
 
@@ -8,32 +12,38 @@ MCP server for codebase structure analysis. Provides dependency graphs, communit
8
12
  npm install -g graphmycode-mcp
9
13
  ```
10
14
 
11
- The postinstall script automatically:
12
- 1. Registers the MCP server in Claude Code (`~/.claude/claude.json`)
13
- 2. Installs 8 slash commands in `~/.claude/commands/`
15
+ The postinstall script automatically registers the MCP server in **Claude Code** and installs 9 slash commands.
16
+
17
+ To register in other editors, run:
14
18
 
15
- Restart Claude Code after installing to activate.
19
+ ```bash
20
+ graphmycode-mcp setup --all # all supported editors
21
+ graphmycode-mcp setup cursor # Cursor only
22
+ graphmycode-mcp setup windsurf # Windsurf only
23
+ graphmycode-mcp setup cline # Cline (VSCode) only
24
+ graphmycode-mcp setup continue # Continue only
25
+ graphmycode-mcp setup zed # Zed only
26
+ graphmycode-mcp setup antigravity # Google Antigravity only
27
+ ```
28
+
29
+ Restart your editor(s) after setup.
16
30
 
17
31
  ---
18
32
 
19
- ### If the postinstall was skipped
33
+ ## Manual configuration per editor
34
+
35
+ If you prefer to configure manually, add the following snippet to each editor's config file.
20
36
 
21
- This happens when installing with `--ignore-scripts` or in CI environments. Run setup manually:
37
+ ### Claude Code
22
38
 
23
39
  ```bash
24
- graphmycode-mcp setup
40
+ claude mcp add -s user graphmycode -- node $(npm root -g)/graphmycode-mcp/dist/index.js
25
41
  ```
26
42
 
27
- ---
28
-
29
- ### Manual registration (clone/dev install)
30
-
31
- If you cloned the repo instead of installing from npm:
43
+ Or if you cloned the repo:
32
44
 
33
45
  ```bash
34
- npm install
35
- npm run build
36
- node_path=$(which node) # get absolute path — e.g. /opt/homebrew/bin/node
46
+ node_path=$(which node)
37
47
  dist_path=$(pwd)/dist/index.js
38
48
  claude mcp add -s user graphmycode -- "$node_path" "$dist_path"
39
49
  ```
@@ -44,6 +54,102 @@ Then copy the slash commands:
44
54
  cp commands/*.md ~/.claude/commands/
45
55
  ```
46
56
 
57
+ ### Cursor
58
+
59
+ File: `~/.cursor/mcp.json`
60
+
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "graphmycode": {
65
+ "command": "npx",
66
+ "args": ["-y", "graphmycode-mcp"]
67
+ }
68
+ }
69
+ }
70
+ ```
71
+
72
+ ### Windsurf
73
+
74
+ File: `~/.codeium/windsurf/mcp_config.json`
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "graphmycode": {
80
+ "command": "npx",
81
+ "args": ["-y", "graphmycode-mcp"]
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ ### Cline (VSCode extension)
88
+
89
+ Open **Cline → MCP Servers → Configure MCP Servers** and add:
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "graphmycode": {
95
+ "command": "npx",
96
+ "args": ["-y", "graphmycode-mcp"],
97
+ "disabled": false,
98
+ "autoApprove": []
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ ### Continue
105
+
106
+ Create the file `~/.continue/mcpServers/graphmycode.json`:
107
+
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "graphmycode": {
112
+ "command": "npx",
113
+ "args": ["-y", "graphmycode-mcp"]
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ Continue automatically picks up JSON files from `~/.continue/mcpServers/`.
120
+
121
+ ### Google Antigravity
122
+
123
+ File: `~/.gemini/config/mcp_config.json` (macOS/Linux)
124
+ File: `C:\Users\<USER>\.gemini\antigravity\mcp_config.json` (Windows)
125
+
126
+ ```json
127
+ {
128
+ "mcpServers": {
129
+ "graphmycode": {
130
+ "command": "npx",
131
+ "args": ["-y", "graphmycode-mcp"]
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ ### Zed
138
+
139
+ File: `~/.config/zed/settings.json`
140
+
141
+ ```json
142
+ {
143
+ "context_servers": {
144
+ "graphmycode-mcp": {
145
+ "source": "custom",
146
+ "command": "npx",
147
+ "args": ["-y", "graphmycode-mcp"]
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
47
153
  ---
48
154
 
49
155
  ## Tools
@@ -58,9 +164,7 @@ cp commands/*.md ~/.claude/commands/
58
164
  | `query_graph` | Natural language queries over the graph |
59
165
  | `export_agent_context` | Generate `CLAUDE.md` / `AGENTS.md` for the codebase |
60
166
 
61
- ## Slash Commands
62
-
63
- Once installed, these commands are available in Claude Code:
167
+ ## Slash Commands (Claude Code only)
64
168
 
65
169
  | Command | Description |
66
170
  |---------|-------------|
@@ -74,10 +178,14 @@ Once installed, these commands are available in Claude Code:
74
178
  | `/graphmycode-semantic` | Module communities and logical duplication |
75
179
  | `/graphmycode-structural` | Structural dependency deep-dive |
76
180
 
181
+ ## Visual interface
182
+
183
+ For an interactive visual graph of your codebase, visit **[graphmycode.com](https://graphmycode.com)**.
184
+
77
185
  ## Requirements
78
186
 
79
187
  - Node.js 18+
80
- - [Claude Code](https://claude.ai/code) CLI installed and configured
188
+ - At least one of: Claude Code, Cursor, Windsurf, Cline, Continue, Zed, or Google Antigravity
81
189
 
82
190
  ## License
83
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphmycode-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server for codebase structure analysis — dependency graphs, communities, hotspots, and agent context generation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,6 +23,13 @@
23
23
  "keywords": [
24
24
  "mcp",
25
25
  "claude",
26
+ "cursor",
27
+ "windsurf",
28
+ "cline",
29
+ "continue",
30
+ "zed",
31
+ "antigravity",
32
+ "google-antigravity",
26
33
  "codebase",
27
34
  "dependency-graph",
28
35
  "code-analysis",
package/scripts/cli.mjs CHANGED
@@ -1,8 +1,15 @@
1
1
  #!/usr/bin/env node
2
- // Punto de entrada CLI: "graphmycode-mcp setup" o el servidor MCP
3
- if (process.argv[2] === 'setup') {
4
- const { setup } = await import('./setup.mjs');
5
- setup();
2
+ const [, , arg, subarg] = process.argv;
3
+
4
+ if (arg === 'setup') {
5
+ const { setup, setupTool, setupAll } = await import('./setup.mjs');
6
+ if (!subarg) {
7
+ setup();
8
+ } else if (subarg === '--all') {
9
+ setupAll();
10
+ } else {
11
+ setupTool(subarg);
12
+ }
6
13
  } else {
7
14
  await import('../dist/index.js');
8
15
  }
package/scripts/setup.mjs CHANGED
@@ -11,6 +11,8 @@ const nodePath = process.execPath;
11
11
  const commandsSource = path.join(packageRoot, 'commands');
12
12
  const commandsDest = path.join(os.homedir(), '.claude', 'commands');
13
13
 
14
+ // ─── Claude Code ────────────────────────────────────────────────────────────
15
+
14
16
  function registerMcp() {
15
17
  try {
16
18
  execSync(`claude mcp add -s user graphmycode -- "${nodePath}" "${distPath}"`, {
@@ -20,16 +22,15 @@ function registerMcp() {
20
22
  } catch (e) {
21
23
  const output = (e.stderr?.toString() ?? '') + (e.stdout?.toString() ?? '');
22
24
  if (output.includes('already') || output.includes('exists')) {
23
- // Idempotente: ya estaba registrado, actualizar con remove+add
24
25
  try {
25
26
  execSync('claude mcp remove graphmycode -s user', { stdio: 'pipe' });
26
27
  execSync(`claude mcp add -s user graphmycode -- "${nodePath}" "${distPath}"`, { stdio: 'pipe' });
27
28
  console.log('✓ MCP graphmycode actualizado en Claude Code');
28
29
  } catch {
29
- console.log('✓ MCP graphmycode ya estaba registrado');
30
+ console.log('✓ MCP graphmycode ya estaba registrado en Claude Code');
30
31
  }
31
32
  } else {
32
- console.warn('⚠ No se pudo registrar el MCP automáticamente.');
33
+ console.warn('⚠ No se pudo registrar el MCP en Claude Code automáticamente.');
33
34
  console.warn(' Ejecuta manualmente:');
34
35
  console.warn(` claude mcp add -s user graphmycode -- "${nodePath}" "${distPath}"`);
35
36
  }
@@ -49,6 +50,130 @@ function copyCommands() {
49
50
  console.log(' ' + files.map((f) => `/${f.replace('.md', '')}`).join(', '));
50
51
  }
51
52
 
53
+ // ─── Helpers ────────────────────────────────────────────────────────────────
54
+
55
+ function mergeJsonConfig(filePath, mcpKey, serverConfig) {
56
+ let config = {};
57
+ if (fs.existsSync(filePath)) {
58
+ try {
59
+ config = JSON.parse(fs.readFileSync(filePath, 'utf8'));
60
+ } catch {
61
+ config = {};
62
+ }
63
+ }
64
+ config.mcpServers = config.mcpServers ?? {};
65
+ config.mcpServers[mcpKey] = serverConfig;
66
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
67
+ fs.writeFileSync(filePath, JSON.stringify(config, null, 2) + '\n');
68
+ }
69
+
70
+ const npxEntry = { command: 'npx', args: ['-y', 'graphmycode-mcp'] };
71
+
72
+ // ─── Cursor ─────────────────────────────────────────────────────────────────
73
+
74
+ function registerCursor() {
75
+ const configPath = path.join(os.homedir(), '.cursor', 'mcp.json');
76
+ mergeJsonConfig(configPath, 'graphmycode', npxEntry);
77
+ console.log('✓ MCP graphmycode registrado en Cursor (~/.cursor/mcp.json)');
78
+ }
79
+
80
+ // ─── Windsurf ────────────────────────────────────────────────────────────────
81
+
82
+ function registerWindsurf() {
83
+ const configPath = path.join(os.homedir(), '.codeium', 'windsurf', 'mcp_config.json');
84
+ mergeJsonConfig(configPath, 'graphmycode', npxEntry);
85
+ console.log('✓ MCP graphmycode registrado en Windsurf (~/.codeium/windsurf/mcp_config.json)');
86
+ }
87
+
88
+ // ─── Cline ───────────────────────────────────────────────────────────────────
89
+
90
+ function getClinePath() {
91
+ const ext = path.join('globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json');
92
+ if (process.platform === 'darwin') {
93
+ return path.join(os.homedir(), 'Library', 'Application Support', 'Code', 'User', ext);
94
+ }
95
+ if (process.platform === 'win32') {
96
+ return path.join(process.env.APPDATA || '', 'Code', 'User', ext);
97
+ }
98
+ return path.join(os.homedir(), '.config', 'Code', 'User', ext);
99
+ }
100
+
101
+ function registerCline() {
102
+ const configPath = getClinePath();
103
+ const settingsDir = path.dirname(configPath);
104
+
105
+ if (!fs.existsSync(settingsDir)) {
106
+ console.warn('⚠ Cline: directorio de VSCode no encontrado.');
107
+ console.warn(` Ruta esperada: ${configPath}`);
108
+ console.warn(' Configura manualmente en Cline > MCP Servers > Configure MCP Servers.');
109
+ return false;
110
+ }
111
+
112
+ mergeJsonConfig(configPath, 'graphmycode', {
113
+ ...npxEntry,
114
+ disabled: false,
115
+ autoApprove: [],
116
+ });
117
+ console.log('✓ MCP graphmycode registrado en Cline (VSCode)');
118
+ return true;
119
+ }
120
+
121
+ // ─── Continue ────────────────────────────────────────────────────────────────
122
+
123
+ function registerContinue() {
124
+ // Continue picks up JSON files from ~/.continue/mcpServers/ automatically
125
+ const dir = path.join(os.homedir(), '.continue', 'mcpServers');
126
+ fs.mkdirSync(dir, { recursive: true });
127
+ const configPath = path.join(dir, 'graphmycode.json');
128
+ fs.writeFileSync(
129
+ configPath,
130
+ JSON.stringify({ mcpServers: { graphmycode: npxEntry } }, null, 2) + '\n',
131
+ );
132
+ console.log('✓ MCP graphmycode registrado en Continue (~/.continue/mcpServers/graphmycode.json)');
133
+ }
134
+
135
+ // ─── Antigravity (Google) ────────────────────────────────────────────────────
136
+
137
+ function registerAntigravity() {
138
+ const configPath = process.platform === 'win32'
139
+ ? path.join(os.homedir(), '.gemini', 'antigravity', 'mcp_config.json')
140
+ : path.join(os.homedir(), '.gemini', 'config', 'mcp_config.json');
141
+ mergeJsonConfig(configPath, 'graphmycode', npxEntry);
142
+ console.log(`✓ MCP graphmycode registrado en Antigravity (${configPath.replace(os.homedir(), '~')})`);
143
+ }
144
+
145
+ // ─── Zed ─────────────────────────────────────────────────────────────────────
146
+
147
+ function getZedSettingsPath() {
148
+ if (process.platform === 'win32') {
149
+ return path.join(process.env.APPDATA || '', 'Zed', 'settings.json');
150
+ }
151
+ return path.join(os.homedir(), '.config', 'zed', 'settings.json');
152
+ }
153
+
154
+ function registerZed() {
155
+ const configPath = getZedSettingsPath();
156
+ let config = {};
157
+ if (fs.existsSync(configPath)) {
158
+ try {
159
+ config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
160
+ } catch {
161
+ config = {};
162
+ }
163
+ }
164
+ config.context_servers = config.context_servers ?? {};
165
+ config.context_servers['graphmycode-mcp'] = {
166
+ source: 'custom',
167
+ command: 'npx',
168
+ args: ['-y', 'graphmycode-mcp'],
169
+ };
170
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
171
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
172
+ console.log('✓ MCP graphmycode registrado en Zed (~/.config/zed/settings.json)');
173
+ }
174
+
175
+ // ─── Exports públicos ────────────────────────────────────────────────────────
176
+
52
177
  export function setup() {
53
178
  if (!fs.existsSync(distPath)) {
54
179
  console.error('Error: dist/index.js no encontrado. El paquete puede estar corrupto.');
@@ -60,3 +185,33 @@ export function setup() {
60
185
  copyCommands();
61
186
  console.log('\n¡Listo! Reinicia Claude Code para activar los cambios.\n');
62
187
  }
188
+
189
+ export function setupTool(tool) {
190
+ console.log(`\nConfigurando GraphMyCode MCP para ${tool}...\n`);
191
+ switch (tool) {
192
+ case 'cursor': registerCursor(); break;
193
+ case 'windsurf': registerWindsurf(); break;
194
+ case 'cline': registerCline(); break;
195
+ case 'continue': registerContinue(); break;
196
+ case 'zed': registerZed(); break;
197
+ case 'antigravity': registerAntigravity(); break;
198
+ default:
199
+ console.error(`Herramienta desconocida: "${tool}"`);
200
+ console.error('Disponibles: cursor, windsurf, cline, continue, zed, antigravity');
201
+ process.exit(1);
202
+ }
203
+ console.log('\nReinicia el editor para activar los cambios.\n');
204
+ }
205
+
206
+ export function setupAll() {
207
+ console.log('\nConfigurando GraphMyCode MCP para todos los editores...\n');
208
+ registerMcp();
209
+ copyCommands();
210
+ registerCursor();
211
+ registerWindsurf();
212
+ registerCline();
213
+ registerContinue();
214
+ registerZed();
215
+ registerAntigravity();
216
+ console.log('\n¡Listo! Reinicia tus editores para activar los cambios.\n');
217
+ }