@vdpeijl/kb-mcp 0.2.0 → 0.2.2
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 +55 -71
- package/dist/src/commands/setup.d.ts.map +1 -1
- package/dist/src/commands/setup.js +64 -113
- package/dist/src/commands/setup.js.map +1 -1
- package/dist/src/commands/uninstall.d.ts.map +1 -1
- package/dist/src/commands/uninstall.js +60 -65
- package/dist/src/commands/uninstall.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,8 +7,9 @@ MCP (Model Context Protocol) server that indexes multiple Zendesk Help Center kn
|
|
|
7
7
|
- 🔍 **Vector Search**: Semantic search using Ollama embeddings (nomic-embed-text)
|
|
8
8
|
- 📚 **Multiple Sources**: Index and search across multiple Zendesk knowledge bases
|
|
9
9
|
- 🔄 **Incremental Sync**: Efficient updates - only process changed articles
|
|
10
|
-
- 🚀 **Easy Setup**: Interactive CLI wizard
|
|
10
|
+
- 🚀 **Easy Setup**: Interactive CLI wizard + automated Claude Code configuration
|
|
11
11
|
- 🎯 **MCP Compatible**: Works with Claude Code, Cursor, Windsurf, Continue.dev, and Zed
|
|
12
|
+
- 🛠️ **Version Manager Support**: Compatible with fnm, nvm, volta, asdf via shell wrapper
|
|
12
13
|
|
|
13
14
|
## Prerequisites
|
|
14
15
|
|
|
@@ -48,16 +49,16 @@ ollama pull nomic-embed-text
|
|
|
48
49
|
|
|
49
50
|
## Installation
|
|
50
51
|
|
|
51
|
-
### From npm
|
|
52
|
+
### From npm
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
55
|
npm install -g @vdpeijl/kb-mcp
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
### From source
|
|
58
|
+
### From source
|
|
58
59
|
|
|
59
60
|
```bash
|
|
60
|
-
git clone https://github.com/
|
|
61
|
+
git clone https://github.com/vdpeijl/kb-mcp.git
|
|
61
62
|
cd kb-mcp
|
|
62
63
|
npm install
|
|
63
64
|
npm run build
|
|
@@ -93,11 +94,13 @@ This will:
|
|
|
93
94
|
|
|
94
95
|
### 3. Configure your MCP client
|
|
95
96
|
|
|
97
|
+
**For Claude Code (automated):**
|
|
96
98
|
```bash
|
|
97
|
-
kb-mcp setup
|
|
99
|
+
kb-mcp setup claude-code
|
|
98
100
|
```
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
**For other MCP clients:**
|
|
103
|
+
See the [MCP Client Configuration](#mcp-client-configuration) section below for manual setup instructions.
|
|
101
104
|
|
|
102
105
|
### 4. Restart your MCP client
|
|
103
106
|
|
|
@@ -151,14 +154,16 @@ Start the MCP server (stdio). This is normally called by your MCP client, not ma
|
|
|
151
154
|
|
|
152
155
|
### `kb-mcp setup [client]`
|
|
153
156
|
|
|
154
|
-
|
|
157
|
+
Automatically configure MCP clients. Currently supports: claude-code.
|
|
155
158
|
|
|
156
159
|
**Examples:**
|
|
157
160
|
```bash
|
|
158
|
-
kb-mcp setup # List
|
|
159
|
-
kb-mcp setup
|
|
161
|
+
kb-mcp setup # List available clients
|
|
162
|
+
kb-mcp setup claude-code # Automatically configure Claude Code
|
|
160
163
|
```
|
|
161
164
|
|
|
165
|
+
**Note:** For other MCP clients (Cursor, Windsurf, Continue.dev, Zed), see the manual configuration instructions below.
|
|
166
|
+
|
|
162
167
|
### `kb-mcp doctor`
|
|
163
168
|
|
|
164
169
|
Run diagnostics to check:
|
|
@@ -176,89 +181,68 @@ Show database statistics:
|
|
|
176
181
|
- Database file size
|
|
177
182
|
- Per-source breakdown
|
|
178
183
|
|
|
179
|
-
|
|
184
|
+
### `kb-mcp uninstall`
|
|
180
185
|
|
|
181
|
-
|
|
186
|
+
Remove kb-mcp data and MCP server configurations.
|
|
182
187
|
|
|
183
|
-
|
|
188
|
+
**Options:**
|
|
189
|
+
- `--keep-data` - Keep database and config files, only remove from MCP clients
|
|
184
190
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
"command": "kb-mcp",
|
|
190
|
-
"args": ["serve"]
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
191
|
+
**Examples:**
|
|
192
|
+
```bash
|
|
193
|
+
kb-mcp uninstall # Full uninstall (removes data + MCP configs)
|
|
194
|
+
kb-mcp uninstall --keep-data # Only remove MCP config, keep data
|
|
194
195
|
```
|
|
195
196
|
|
|
196
|
-
|
|
197
|
+
This command will:
|
|
198
|
+
- Remove the MCP server entry from Claude Code (via `claude mcp remove`)
|
|
199
|
+
- Remove the data directory (`~/.local/share/kb-mcp/`)
|
|
200
|
+
- Remove the config directory (`~/.config/kb-mcp/`)
|
|
197
201
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
{
|
|
202
|
-
"mcpServers": {
|
|
203
|
-
"knowledge-base": {
|
|
204
|
-
"command": "kb-mcp",
|
|
205
|
-
"args": ["serve"]
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
202
|
+
After running, you can completely remove the package with:
|
|
203
|
+
```bash
|
|
204
|
+
npm uninstall -g @vdpeijl/kb-mcp
|
|
209
205
|
```
|
|
210
206
|
|
|
211
|
-
|
|
207
|
+
## MCP Client Configuration
|
|
212
208
|
|
|
213
|
-
|
|
209
|
+
### Claude Code
|
|
214
210
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
"knowledge-base": {
|
|
219
|
-
"command": "kb-mcp",
|
|
220
|
-
"args": ["serve"]
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
211
|
+
**Automated setup (recommended):**
|
|
212
|
+
```bash
|
|
213
|
+
kb-mcp setup claude-code
|
|
224
214
|
```
|
|
225
215
|
|
|
226
|
-
|
|
216
|
+
**Manual setup:**
|
|
217
|
+
The setup command runs: `claude mcp add --transport stdio knowledge-base -- bash -l -c "kb-mcp serve"`
|
|
218
|
+
|
|
219
|
+
This uses a shell wrapper (`bash -l -c`) for compatibility with node version managers (fnm, nvm, volta, asdf).
|
|
227
220
|
|
|
228
|
-
|
|
221
|
+
### Other MCP Clients
|
|
229
222
|
|
|
223
|
+
While kb-mcp is compatible with all MCP clients (Cursor, Windsurf, Continue.dev, Zed, etc.), automated setup is currently only available for Claude Code.
|
|
224
|
+
|
|
225
|
+
**Manual configuration:**
|
|
226
|
+
Add kb-mcp to your MCP client's configuration file using:
|
|
230
227
|
```json
|
|
231
228
|
{
|
|
232
|
-
"
|
|
233
|
-
|
|
234
|
-
{
|
|
235
|
-
"transport": {
|
|
236
|
-
"type": "stdio",
|
|
237
|
-
"command": "kb-mcp",
|
|
238
|
-
"args": ["serve"]
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
]
|
|
242
|
-
}
|
|
229
|
+
"command": "bash",
|
|
230
|
+
"args": ["-l", "-c", "kb-mcp serve"]
|
|
243
231
|
}
|
|
244
232
|
```
|
|
245
233
|
|
|
246
|
-
|
|
234
|
+
> **Note:** The shell wrapper (`bash -l -c`) ensures compatibility with node version managers like fnm, nvm, volta, and asdf.
|
|
247
235
|
|
|
248
|
-
|
|
236
|
+
**Want to add automated setup for your favorite MCP client?**
|
|
249
237
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
```
|
|
238
|
+
We welcome contributions! The codebase has an extensible architecture that makes it easy to add support for new clients:
|
|
239
|
+
|
|
240
|
+
1. See the commented examples in [`src/commands/setup.ts`](src/commands/setup.ts) and [`src/commands/uninstall.ts`](src/commands/uninstall.ts)
|
|
241
|
+
2. Add your client configuration to the `CLIENT_CONFIGS` array
|
|
242
|
+
3. Implement the setup/remove functions
|
|
243
|
+
4. Submit a pull request!
|
|
244
|
+
|
|
245
|
+
For CLI-based clients (like Claude Code), use `execSync()`. For file-based clients, use the `setupJsonClient()` helper. Check the code for detailed examples.
|
|
262
246
|
|
|
263
247
|
## MCP Tools
|
|
264
248
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":";;;;;;;AAoGA,wBAmDG"}
|
|
@@ -1,130 +1,81 @@
|
|
|
1
1
|
import { defineCommand } from 'citty';
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
3
|
-
import { homedir } from 'os';
|
|
4
|
-
import { join, dirname } from 'path';
|
|
5
2
|
import { execSync } from 'child_process';
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
4
|
+
import { dirname } from 'path';
|
|
6
5
|
import { exitWithError } from '../utils/errors.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
console.log('✅ Successfully configured Claude Code');
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
if (error.message?.includes('command not found')) {
|
|
15
|
-
throw new Error('Claude Code CLI not found. Please install it first:\n npm install -g @anthropic/claude-code');
|
|
16
|
-
}
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to setup JSON-based MCP clients
|
|
8
|
+
* Reads existing config, merges the kb-mcp server entry, and writes back
|
|
9
|
+
*/
|
|
20
10
|
async function setupJsonClient(configPath, clientName, merger) {
|
|
21
|
-
const fullPath = configPath.startsWith('~')
|
|
22
|
-
? join(homedir(), configPath.slice(2))
|
|
23
|
-
: configPath;
|
|
24
11
|
// Ensure directory exists
|
|
25
|
-
mkdirSync(dirname(
|
|
12
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
26
13
|
// Read existing config or create new
|
|
27
14
|
let config = {};
|
|
28
|
-
if (existsSync(
|
|
15
|
+
if (existsSync(configPath)) {
|
|
29
16
|
try {
|
|
30
|
-
const content = readFileSync(
|
|
17
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
31
18
|
config = JSON.parse(content);
|
|
32
19
|
}
|
|
33
20
|
catch (error) {
|
|
34
|
-
console.warn(`⚠️ Failed to parse ${
|
|
21
|
+
console.warn(`⚠️ Failed to parse ${configPath}, creating new config`);
|
|
35
22
|
}
|
|
36
23
|
}
|
|
37
24
|
// Merge configuration
|
|
38
25
|
config = merger(config);
|
|
39
26
|
// Write back
|
|
40
|
-
writeFileSync(
|
|
41
|
-
console.log(`✅ Successfully configured ${clientName} at ${
|
|
27
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
28
|
+
console.log(`✅ Successfully configured ${clientName} at ${configPath}`);
|
|
42
29
|
}
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
/**
|
|
31
|
+
* MCP Client configurations
|
|
32
|
+
*
|
|
33
|
+
* To add support for a new client:
|
|
34
|
+
* 1. Add a new entry to this array
|
|
35
|
+
* 2. Implement the setup() function
|
|
36
|
+
* 3. For CLI-based clients, use execSync()
|
|
37
|
+
* 4. For file-based clients, use setupJsonClient() helper
|
|
38
|
+
*/
|
|
39
|
+
const CLIENT_CONFIGS = [
|
|
40
|
+
{
|
|
41
|
+
key: 'claude-code',
|
|
45
42
|
name: 'Claude Code',
|
|
46
|
-
path: '~/.claude/claude_desktop_config.json',
|
|
47
|
-
cliCommand: 'claude mcp add --transport stdio knowledge-base -- bash -l -c "kb-mcp serve"',
|
|
48
|
-
setup: setupClaudeCode,
|
|
49
|
-
},
|
|
50
|
-
cursor: {
|
|
51
|
-
name: 'Cursor',
|
|
52
|
-
path: join(homedir(), '.cursor', 'mcp.json'),
|
|
53
|
-
setup: async () => {
|
|
54
|
-
await setupJsonClient(join(homedir(), '.cursor', 'mcp.json'), 'Cursor', (existing) => {
|
|
55
|
-
if (!existing.mcpServers) {
|
|
56
|
-
existing.mcpServers = {};
|
|
57
|
-
}
|
|
58
|
-
existing.mcpServers['knowledge-base'] = {
|
|
59
|
-
command: 'bash',
|
|
60
|
-
args: ['-l', '-c', 'kb-mcp serve'],
|
|
61
|
-
};
|
|
62
|
-
return existing;
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
windsurf: {
|
|
67
|
-
name: 'Windsurf',
|
|
68
|
-
path: '~/.codeium/windsurf/mcp_config.json',
|
|
69
43
|
setup: async () => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return existing;
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
continue: {
|
|
83
|
-
name: 'Continue.dev',
|
|
84
|
-
path: '~/.continue/config.json',
|
|
85
|
-
setup: async () => {
|
|
86
|
-
await setupJsonClient(join(homedir(), '.continue', 'config.json'), 'Continue.dev', (existing) => {
|
|
87
|
-
if (!existing.experimental) {
|
|
88
|
-
existing.experimental = {};
|
|
89
|
-
}
|
|
90
|
-
if (!existing.experimental.modelContextProtocolServers) {
|
|
91
|
-
existing.experimental.modelContextProtocolServers = [];
|
|
92
|
-
}
|
|
93
|
-
// Check if kb-mcp already exists
|
|
94
|
-
const servers = existing.experimental.modelContextProtocolServers;
|
|
95
|
-
const hasKbMcp = servers.some((s) => s.transport?.command?.includes('kb-mcp'));
|
|
96
|
-
if (!hasKbMcp) {
|
|
97
|
-
servers.push({
|
|
98
|
-
transport: {
|
|
99
|
-
type: 'stdio',
|
|
100
|
-
command: 'bash',
|
|
101
|
-
args: ['-l', '-c', 'kb-mcp serve'],
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return existing;
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
zed: {
|
|
110
|
-
name: 'Zed',
|
|
111
|
-
path: '~/.config/zed/settings.json',
|
|
112
|
-
setup: async () => {
|
|
113
|
-
await setupJsonClient(join(homedir(), '.config', 'zed', 'settings.json'), 'Zed', (existing) => {
|
|
114
|
-
if (!existing.context_servers) {
|
|
115
|
-
existing.context_servers = {};
|
|
44
|
+
const cmd = 'claude mcp add --transport stdio knowledge-base -- bash -l -c "kb-mcp serve"';
|
|
45
|
+
try {
|
|
46
|
+
execSync(cmd, { stdio: 'inherit' });
|
|
47
|
+
console.log('✅ Successfully configured Claude Code');
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error.message?.includes('command not found')) {
|
|
51
|
+
throw new Error('Claude Code CLI not found. Please install it first:\n npm install -g @anthropic/claude-code');
|
|
116
52
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
path: 'bash',
|
|
120
|
-
args: ['-l', '-c', 'kb-mcp serve'],
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
return existing;
|
|
124
|
-
});
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
125
55
|
},
|
|
126
56
|
},
|
|
127
|
-
|
|
57
|
+
// Example: How to add a file-based client (commented out)
|
|
58
|
+
// {
|
|
59
|
+
// key: 'cursor',
|
|
60
|
+
// name: 'Cursor',
|
|
61
|
+
// setup: async () => {
|
|
62
|
+
// await setupJsonClient(
|
|
63
|
+
// join(homedir(), '.cursor', 'mcp.json'),
|
|
64
|
+
// 'Cursor',
|
|
65
|
+
// (existing) => {
|
|
66
|
+
// if (!existing.mcpServers) {
|
|
67
|
+
// existing.mcpServers = {};
|
|
68
|
+
// }
|
|
69
|
+
// existing.mcpServers['knowledge-base'] = {
|
|
70
|
+
// command: 'bash',
|
|
71
|
+
// args: ['-l', '-c', 'kb-mcp serve'],
|
|
72
|
+
// };
|
|
73
|
+
// return existing;
|
|
74
|
+
// }
|
|
75
|
+
// );
|
|
76
|
+
// },
|
|
77
|
+
// },
|
|
78
|
+
];
|
|
128
79
|
export default defineCommand({
|
|
129
80
|
meta: {
|
|
130
81
|
name: 'setup',
|
|
@@ -133,27 +84,27 @@ export default defineCommand({
|
|
|
133
84
|
args: {
|
|
134
85
|
client: {
|
|
135
86
|
type: 'positional',
|
|
136
|
-
description:
|
|
87
|
+
description: `MCP client (${CLIENT_CONFIGS.map(c => c.key).join(', ')})`,
|
|
137
88
|
required: false,
|
|
138
89
|
},
|
|
139
90
|
},
|
|
140
91
|
async run({ args }) {
|
|
141
92
|
try {
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
93
|
+
const clientKey = args.client;
|
|
94
|
+
if (!clientKey) {
|
|
144
95
|
// Show all options
|
|
145
96
|
console.log('\n🔧 MCP Client Setup\n');
|
|
146
97
|
console.log('Run with a client name to automatically configure:\n');
|
|
147
|
-
for (const
|
|
148
|
-
console.log(` kb-mcp setup ${key.padEnd(15)} # ${
|
|
98
|
+
for (const client of CLIENT_CONFIGS) {
|
|
99
|
+
console.log(` kb-mcp setup ${client.key.padEnd(15)} # ${client.name}`);
|
|
149
100
|
}
|
|
150
101
|
console.log();
|
|
151
102
|
return;
|
|
152
103
|
}
|
|
153
|
-
const config =
|
|
104
|
+
const config = CLIENT_CONFIGS.find(c => c.key === clientKey);
|
|
154
105
|
if (!config) {
|
|
155
|
-
console.error(`\n✗ Unknown client: ${
|
|
156
|
-
console.error('Available clients:',
|
|
106
|
+
console.error(`\n✗ Unknown client: ${clientKey}\n`);
|
|
107
|
+
console.error('Available clients:', CLIENT_CONFIGS.map(c => c.key).join(', '));
|
|
157
108
|
console.error();
|
|
158
109
|
process.exit(1);
|
|
159
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE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AC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":";;;;;;;AAsGA,wBAgEG"}
|
|
@@ -1,84 +1,79 @@
|
|
|
1
1
|
import { defineCommand } from 'citty';
|
|
2
2
|
import { existsSync, rmSync, readFileSync, writeFileSync } from 'fs';
|
|
3
|
-
import {
|
|
4
|
-
import { join } from 'path';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
5
4
|
import { exitWithError } from '../utils/errors.js';
|
|
6
5
|
import { getXDGPaths } from '../config/paths.js';
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to remove kb-mcp from JSON-based MCP clients
|
|
8
|
+
* Reads config, removes the entry, and writes back
|
|
9
|
+
*/
|
|
10
|
+
function removeFromJsonClient(configPath, clientName, remover) {
|
|
11
|
+
if (!existsSync(configPath)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
16
|
+
const config = JSON.parse(content);
|
|
17
|
+
if (remover(config)) {
|
|
18
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.warn(`⚠ Failed to update ${clientName} config: ${error}`);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* MCP Client configurations
|
|
30
|
+
*
|
|
31
|
+
* To add support for a new client:
|
|
32
|
+
* 1. Add a new entry to this array
|
|
33
|
+
* 2. Implement the remove() function that returns true if kb-mcp was removed
|
|
34
|
+
* 3. For CLI-based clients, use execSync()
|
|
35
|
+
* 4. For file-based clients, use removeFromJsonClient() helper
|
|
36
|
+
*/
|
|
7
37
|
const CLIENT_CONFIGS = [
|
|
8
38
|
{
|
|
9
39
|
name: 'Claude Code',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
delete config.mcpServers['knowledge-base'];
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'Cursor',
|
|
21
|
-
path: join(homedir(), '.cursor', 'mcp.json'),
|
|
22
|
-
removeEntry: (config) => {
|
|
23
|
-
if (config.mcpServers?.['knowledge-base']) {
|
|
24
|
-
delete config.mcpServers['knowledge-base'];
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: 'Windsurf',
|
|
32
|
-
path: join(homedir(), '.codeium', 'windsurf', 'mcp_config.json'),
|
|
33
|
-
removeEntry: (config) => {
|
|
34
|
-
if (config.mcpServers?.['knowledge-base']) {
|
|
35
|
-
delete config.mcpServers['knowledge-base'];
|
|
40
|
+
remove: () => {
|
|
41
|
+
try {
|
|
42
|
+
execSync('claude mcp remove knowledge-base', { stdio: 'pipe' });
|
|
36
43
|
return true;
|
|
37
44
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
removeEntry: (config) => {
|
|
45
|
-
if (config.context_servers?.['knowledge-base']) {
|
|
46
|
-
delete config.context_servers['knowledge-base'];
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'Continue.dev',
|
|
54
|
-
path: join(homedir(), '.continue', 'config.json'),
|
|
55
|
-
removeEntry: (config) => {
|
|
56
|
-
if (config.experimental?.modelContextProtocolServers) {
|
|
57
|
-
const servers = config.experimental.modelContextProtocolServers;
|
|
58
|
-
const initialLength = servers.length;
|
|
59
|
-
config.experimental.modelContextProtocolServers = servers.filter(server => !server.transport.command.includes('kb-mcp'));
|
|
60
|
-
return servers.length !== initialLength;
|
|
45
|
+
catch (error) {
|
|
46
|
+
// Silently skip if CLI not found or server not installed
|
|
47
|
+
if (!error.message?.includes('command not found') && !error.message?.includes('not found')) {
|
|
48
|
+
console.warn(`⚠ Failed to remove from Claude Code via CLI: ${error.message}`);
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
61
51
|
}
|
|
62
|
-
return false;
|
|
63
52
|
},
|
|
64
53
|
},
|
|
54
|
+
// Example: How to add a file-based client (commented out)
|
|
55
|
+
// {
|
|
56
|
+
// name: 'Cursor',
|
|
57
|
+
// remove: () => {
|
|
58
|
+
// return removeFromJsonClient(
|
|
59
|
+
// join(homedir(), '.cursor', 'mcp.json'),
|
|
60
|
+
// 'Cursor',
|
|
61
|
+
// (config) => {
|
|
62
|
+
// if (config.mcpServers?.['knowledge-base']) {
|
|
63
|
+
// delete config.mcpServers['knowledge-base'];
|
|
64
|
+
// return true;
|
|
65
|
+
// }
|
|
66
|
+
// return false;
|
|
67
|
+
// }
|
|
68
|
+
// );
|
|
69
|
+
// },
|
|
70
|
+
// },
|
|
65
71
|
];
|
|
66
72
|
function removeFromMcpConfigs() {
|
|
67
73
|
const removed = [];
|
|
68
74
|
for (const client of CLIENT_CONFIGS) {
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
const content = readFileSync(client.path, 'utf-8');
|
|
74
|
-
const config = JSON.parse(content);
|
|
75
|
-
if (client.removeEntry(config)) {
|
|
76
|
-
writeFileSync(client.path, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
77
|
-
removed.push(client.name);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
console.warn(`⚠ Failed to update ${client.name} config: ${error}`);
|
|
75
|
+
if (client.remove()) {
|
|
76
|
+
removed.push(client.name);
|
|
82
77
|
}
|
|
83
78
|
}
|
|
84
79
|
return removed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAcjD;;;GAGG;AACH,SAAS,oBAAoB,CAC3B,UAAkB,EAClB,UAAkB,EAClB,OAAiC;IAEjC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEnC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACpB,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;Y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