@ebowwa/claude-code-config-mcp 1.0.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/.claude/CLAUDE.md +3 -0
- package/README.md +237 -0
- package/bun.lock +206 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1744 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +197 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +51 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/errors.d.ts +63 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +156 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/file.d.ts +32 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +146 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/path.d.ts +59 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +146 -0
- package/dist/utils/path.js.map +1 -0
- package/lmdb.db +0 -0
- package/lmdb.db-lock +0 -0
- package/package.json +43 -0
- package/src/index.js +2171 -0
- package/src/index.ts +1981 -0
- package/src/types.js +53 -0
- package/src/types.ts +237 -0
- package/src/utils/errors.js +231 -0
- package/src/utils/errors.ts +210 -0
- package/src/utils/file.js +251 -0
- package/src/utils/file.ts +174 -0
- package/src/utils/path.js +169 -0
- package/src/utils/path.ts +173 -0
- package/test/test.js +136 -0
- package/test/test.ts +79 -0
- package/test/write-test.js +153 -0
- package/test/write-test.ts +102 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
"use strict";
|
|
3
|
+
// Test write operations for Claude Code Config MCP Server
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
15
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
+
function step(op) {
|
|
18
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
+
switch (op[0]) {
|
|
23
|
+
case 0: case 1: t = op; break;
|
|
24
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
+
default:
|
|
28
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
+
if (t[2]) _.ops.pop();
|
|
33
|
+
_.trys.pop(); continue;
|
|
34
|
+
}
|
|
35
|
+
op = body.call(thisArg, _);
|
|
36
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
var index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
42
|
+
var stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
43
|
+
function main() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
+
var transport, client, writeResult, readResult, content, addKeyResult, readKeybindings, keybindings, removeKeyResult, backupResult, error_1;
|
|
46
|
+
var _a, _b, _c, _d, _e, _f;
|
|
47
|
+
return __generator(this, function (_g) {
|
|
48
|
+
switch (_g.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
console.log('Starting Write Operations Test...\n');
|
|
51
|
+
transport = new stdio_js_1.StdioClientTransport({
|
|
52
|
+
command: 'bun',
|
|
53
|
+
args: ['run', 'src/index.ts'],
|
|
54
|
+
cwd: '/Users/ebowwa/Desktop/codespaces/MCP/packages/claude-code-config',
|
|
55
|
+
});
|
|
56
|
+
client = new index_js_1.Client({ name: 'test-client', version: '1.0.0' }, { capabilities: {} });
|
|
57
|
+
_g.label = 1;
|
|
58
|
+
case 1:
|
|
59
|
+
_g.trys.push([1, 9, 10, 12]);
|
|
60
|
+
return [4 /*yield*/, client.connect(transport)];
|
|
61
|
+
case 2:
|
|
62
|
+
_g.sent();
|
|
63
|
+
console.log('✅ Connected to server\n');
|
|
64
|
+
// Test 1: Write project CLAUDE.md
|
|
65
|
+
console.log('📝 Test 1: Write project CLAUDE.md');
|
|
66
|
+
return [4 /*yield*/, client.callTool({
|
|
67
|
+
name: 'write_project_claude_md',
|
|
68
|
+
arguments: {
|
|
69
|
+
content: '# Test Project Instructions\n\nThis is a test CLAUDE.md file created by the MCP server.',
|
|
70
|
+
createBackup: true,
|
|
71
|
+
},
|
|
72
|
+
})];
|
|
73
|
+
case 3:
|
|
74
|
+
writeResult = _g.sent();
|
|
75
|
+
console.log(' Result:', (_a = writeResult.content[0]) === null || _a === void 0 ? void 0 : _a.text);
|
|
76
|
+
console.log('');
|
|
77
|
+
// Test 2: Read back the written file
|
|
78
|
+
console.log('📖 Test 2: Read back project CLAUDE.md');
|
|
79
|
+
return [4 /*yield*/, client.callTool({
|
|
80
|
+
name: 'read_project_claude_md',
|
|
81
|
+
arguments: {},
|
|
82
|
+
})];
|
|
83
|
+
case 4:
|
|
84
|
+
readResult = _g.sent();
|
|
85
|
+
content = (_b = readResult.content[0]) === null || _b === void 0 ? void 0 : _b.text;
|
|
86
|
+
console.log(' Content:', content);
|
|
87
|
+
console.log('');
|
|
88
|
+
// Test 3: Add a keybinding
|
|
89
|
+
console.log('⌨️ Test 3: Add keybinding (test_ctrl_k -> test_command)');
|
|
90
|
+
return [4 /*yield*/, client.callTool({
|
|
91
|
+
name: 'add_keybinding',
|
|
92
|
+
arguments: {
|
|
93
|
+
key: 'test_ctrl_k',
|
|
94
|
+
command: 'test_command',
|
|
95
|
+
when: 'editorFocus',
|
|
96
|
+
},
|
|
97
|
+
})];
|
|
98
|
+
case 5:
|
|
99
|
+
addKeyResult = _g.sent();
|
|
100
|
+
console.log(' Result:', (_c = addKeyResult.content[0]) === null || _c === void 0 ? void 0 : _c.text);
|
|
101
|
+
console.log('');
|
|
102
|
+
// Test 4: Read keybindings to verify
|
|
103
|
+
console.log('📋 Test 4: Read keybindings to verify');
|
|
104
|
+
return [4 /*yield*/, client.callTool({
|
|
105
|
+
name: 'read_keybindings',
|
|
106
|
+
arguments: {},
|
|
107
|
+
})];
|
|
108
|
+
case 6:
|
|
109
|
+
readKeybindings = _g.sent();
|
|
110
|
+
keybindings = JSON.parse((_d = readKeybindings.content[0]) === null || _d === void 0 ? void 0 : _d.text);
|
|
111
|
+
console.log(' Keybindings:', JSON.stringify(keybindings, null, 2));
|
|
112
|
+
console.log('');
|
|
113
|
+
// Test 5: Remove the keybinding
|
|
114
|
+
console.log('🗑️ Test 5: Remove keybinding');
|
|
115
|
+
return [4 /*yield*/, client.callTool({
|
|
116
|
+
name: 'remove_keybinding',
|
|
117
|
+
arguments: {
|
|
118
|
+
key: 'test_ctrl_k',
|
|
119
|
+
},
|
|
120
|
+
})];
|
|
121
|
+
case 7:
|
|
122
|
+
removeKeyResult = _g.sent();
|
|
123
|
+
console.log(' Result:', (_e = removeKeyResult.content[0]) === null || _e === void 0 ? void 0 : _e.text);
|
|
124
|
+
console.log('');
|
|
125
|
+
// Test 6: Create a backup
|
|
126
|
+
console.log('💾 Test 6: Backup global CLAUDE.md');
|
|
127
|
+
return [4 /*yield*/, client.callTool({
|
|
128
|
+
name: 'backup_config',
|
|
129
|
+
arguments: {
|
|
130
|
+
fileType: 'CLAUDE_MD',
|
|
131
|
+
},
|
|
132
|
+
})];
|
|
133
|
+
case 8:
|
|
134
|
+
backupResult = _g.sent();
|
|
135
|
+
console.log(' Result:', (_f = backupResult.content[0]) === null || _f === void 0 ? void 0 : _f.text);
|
|
136
|
+
console.log('');
|
|
137
|
+
console.log('✅ All write operation tests passed!');
|
|
138
|
+
return [3 /*break*/, 12];
|
|
139
|
+
case 9:
|
|
140
|
+
error_1 = _g.sent();
|
|
141
|
+
console.error('❌ Test failed:', error_1);
|
|
142
|
+
process.exit(1);
|
|
143
|
+
return [3 /*break*/, 12];
|
|
144
|
+
case 10: return [4 /*yield*/, client.close()];
|
|
145
|
+
case 11:
|
|
146
|
+
_g.sent();
|
|
147
|
+
return [7 /*endfinally*/];
|
|
148
|
+
case 12: return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
main();
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// Test write operations for Claude Code Config MCP Server
|
|
3
|
+
|
|
4
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
console.log('Starting Write Operations Test...\n');
|
|
9
|
+
|
|
10
|
+
const transport = new StdioClientTransport({
|
|
11
|
+
command: 'bun',
|
|
12
|
+
args: ['run', 'src/index.ts'],
|
|
13
|
+
cwd: '/Users/ebowwa/Desktop/codespaces/MCP/packages/claude-code-config',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const client = new Client(
|
|
17
|
+
{ name: 'test-client', version: '1.0.0' },
|
|
18
|
+
{ capabilities: {} }
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
await client.connect(transport);
|
|
23
|
+
console.log('✅ Connected to server\n');
|
|
24
|
+
|
|
25
|
+
// Test 1: Write project CLAUDE.md
|
|
26
|
+
console.log('📝 Test 1: Write project CLAUDE.md');
|
|
27
|
+
const writeResult = await client.callTool({
|
|
28
|
+
name: 'write_project_claude_md',
|
|
29
|
+
arguments: {
|
|
30
|
+
content: '# Test Project Instructions\n\nThis is a test CLAUDE.md file created by the MCP server.',
|
|
31
|
+
createBackup: true,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
console.log(' Result:', writeResult.content[0]?.text);
|
|
35
|
+
console.log('');
|
|
36
|
+
|
|
37
|
+
// Test 2: Read back the written file
|
|
38
|
+
console.log('📖 Test 2: Read back project CLAUDE.md');
|
|
39
|
+
const readResult = await client.callTool({
|
|
40
|
+
name: 'read_project_claude_md',
|
|
41
|
+
arguments: {},
|
|
42
|
+
});
|
|
43
|
+
const content = readResult.content[0]?.text as string;
|
|
44
|
+
console.log(' Content:', content);
|
|
45
|
+
console.log('');
|
|
46
|
+
|
|
47
|
+
// Test 3: Add a keybinding
|
|
48
|
+
console.log('⌨️ Test 3: Add keybinding (test_ctrl_k -> test_command)');
|
|
49
|
+
const addKeyResult = await client.callTool({
|
|
50
|
+
name: 'add_keybinding',
|
|
51
|
+
arguments: {
|
|
52
|
+
key: 'test_ctrl_k',
|
|
53
|
+
command: 'test_command',
|
|
54
|
+
when: 'editorFocus',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
console.log(' Result:', addKeyResult.content[0]?.text);
|
|
58
|
+
console.log('');
|
|
59
|
+
|
|
60
|
+
// Test 4: Read keybindings to verify
|
|
61
|
+
console.log('📋 Test 4: Read keybindings to verify');
|
|
62
|
+
const readKeybindings = await client.callTool({
|
|
63
|
+
name: 'read_keybindings',
|
|
64
|
+
arguments: {},
|
|
65
|
+
});
|
|
66
|
+
const keybindings = JSON.parse(readKeybindings.content[0]?.text as string);
|
|
67
|
+
console.log(' Keybindings:', JSON.stringify(keybindings, null, 2));
|
|
68
|
+
console.log('');
|
|
69
|
+
|
|
70
|
+
// Test 5: Remove the keybinding
|
|
71
|
+
console.log('🗑️ Test 5: Remove keybinding');
|
|
72
|
+
const removeKeyResult = await client.callTool({
|
|
73
|
+
name: 'remove_keybinding',
|
|
74
|
+
arguments: {
|
|
75
|
+
key: 'test_ctrl_k',
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
console.log(' Result:', removeKeyResult.content[0]?.text);
|
|
79
|
+
console.log('');
|
|
80
|
+
|
|
81
|
+
// Test 6: Create a backup
|
|
82
|
+
console.log('💾 Test 6: Backup global CLAUDE.md');
|
|
83
|
+
const backupResult = await client.callTool({
|
|
84
|
+
name: 'backup_config',
|
|
85
|
+
arguments: {
|
|
86
|
+
fileType: 'CLAUDE_MD',
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
console.log(' Result:', backupResult.content[0]?.text);
|
|
90
|
+
console.log('');
|
|
91
|
+
|
|
92
|
+
console.log('✅ All write operation tests passed!');
|
|
93
|
+
|
|
94
|
+
} catch (error) {
|
|
95
|
+
console.error('❌ Test failed:', error);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
} finally {
|
|
98
|
+
await client.close();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
main();
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"types": ["node"]
|
|
18
|
+
},
|
|
19
|
+
"include": ["src/**/*"],
|
|
20
|
+
"exclude": ["node_modules", "dist"]
|
|
21
|
+
}
|