claude-conversation-memory-mcp 1.2.0 → 1.4.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/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +125 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +81 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/tools/ToolDefinitions.d.ts +33 -0
- package/dist/tools/ToolDefinitions.d.ts.map +1 -1
- package/dist/tools/ToolDefinitions.js +36 -3
- package/dist/tools/ToolDefinitions.js.map +1 -1
- package/dist/tools/ToolHandlers.d.ts +27 -17
- package/dist/tools/ToolHandlers.d.ts.map +1 -1
- package/dist/tools/ToolHandlers.js +129 -49
- package/dist/tools/ToolHandlers.js.map +1 -1
- package/dist/types/ToolTypes.d.ts +12 -0
- package/dist/types/ToolTypes.d.ts.map +1 -1
- package/dist/utils/McpConfig.d.ts +54 -0
- package/dist/utils/McpConfig.d.ts.map +1 -0
- package/dist/utils/McpConfig.js +136 -0
- package/dist/utils/McpConfig.js.map +1 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +3 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Configuration Management Utilities
|
|
3
|
+
* Handles reading, writing, and managing MCP server configuration in ~/.claude.json
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync, writeFileSync, existsSync, copyFileSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { homedir } from 'os';
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
const CLAUDE_CONFIG_PATH = join(homedir(), '.claude.json');
|
|
10
|
+
const SERVER_NAME = 'conversation-memory';
|
|
11
|
+
/**
|
|
12
|
+
* Read Claude configuration
|
|
13
|
+
*/
|
|
14
|
+
export function readClaudeConfig() {
|
|
15
|
+
if (!existsSync(CLAUDE_CONFIG_PATH)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const content = readFileSync(CLAUDE_CONFIG_PATH, 'utf-8');
|
|
20
|
+
return JSON.parse(content);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Failed to parse ${CLAUDE_CONFIG_PATH}: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Write Claude configuration
|
|
28
|
+
*/
|
|
29
|
+
export function writeClaudeConfig(config, createBackup = true) {
|
|
30
|
+
if (createBackup && existsSync(CLAUDE_CONFIG_PATH)) {
|
|
31
|
+
const backupPath = `${CLAUDE_CONFIG_PATH}.backup.${Date.now()}`;
|
|
32
|
+
copyFileSync(CLAUDE_CONFIG_PATH, backupPath);
|
|
33
|
+
}
|
|
34
|
+
writeFileSync(CLAUDE_CONFIG_PATH, JSON.stringify(config, null, 2), 'utf-8');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the command path for the MCP server
|
|
38
|
+
* Handles both global npm install and local development
|
|
39
|
+
*/
|
|
40
|
+
export function getMcpCommand() {
|
|
41
|
+
try {
|
|
42
|
+
// Try to find global npm bin
|
|
43
|
+
const npmBin = execSync('npm bin -g', { encoding: 'utf-8' }).trim();
|
|
44
|
+
const globalPath = join(npmBin, 'claude-conversation-memory-mcp');
|
|
45
|
+
if (existsSync(globalPath)) {
|
|
46
|
+
return 'claude-conversation-memory-mcp';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (_error) {
|
|
50
|
+
// Fallback to command name
|
|
51
|
+
}
|
|
52
|
+
return 'claude-conversation-memory-mcp';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if MCP server is configured
|
|
56
|
+
*/
|
|
57
|
+
export function isMcpConfigured() {
|
|
58
|
+
const config = readClaudeConfig();
|
|
59
|
+
if (!config) {
|
|
60
|
+
return { configured: false };
|
|
61
|
+
}
|
|
62
|
+
const mcpConfig = config.mcpServers?.[SERVER_NAME];
|
|
63
|
+
if (mcpConfig) {
|
|
64
|
+
return {
|
|
65
|
+
configured: true,
|
|
66
|
+
config: mcpConfig,
|
|
67
|
+
configPath: CLAUDE_CONFIG_PATH
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return { configured: false, configPath: CLAUDE_CONFIG_PATH };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Add MCP server to configuration
|
|
74
|
+
*/
|
|
75
|
+
export function addMcpServer() {
|
|
76
|
+
const config = readClaudeConfig();
|
|
77
|
+
if (!config) {
|
|
78
|
+
throw new Error('Claude Code configuration not found. Please install Claude Code first.');
|
|
79
|
+
}
|
|
80
|
+
// Initialize mcpServers if it doesn't exist
|
|
81
|
+
if (!config.mcpServers) {
|
|
82
|
+
config.mcpServers = {};
|
|
83
|
+
}
|
|
84
|
+
// Check if already configured
|
|
85
|
+
if (config.mcpServers[SERVER_NAME]) {
|
|
86
|
+
throw new Error('MCP server is already configured');
|
|
87
|
+
}
|
|
88
|
+
// Add MCP server configuration
|
|
89
|
+
config.mcpServers[SERVER_NAME] = {
|
|
90
|
+
type: 'stdio',
|
|
91
|
+
command: getMcpCommand(),
|
|
92
|
+
args: [],
|
|
93
|
+
env: {}
|
|
94
|
+
};
|
|
95
|
+
writeClaudeConfig(config, true);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Remove MCP server from configuration
|
|
99
|
+
*/
|
|
100
|
+
export function removeMcpServer() {
|
|
101
|
+
const config = readClaudeConfig();
|
|
102
|
+
if (!config) {
|
|
103
|
+
throw new Error('Claude Code configuration not found');
|
|
104
|
+
}
|
|
105
|
+
if (!config.mcpServers || !config.mcpServers[SERVER_NAME]) {
|
|
106
|
+
throw new Error('MCP server is not configured');
|
|
107
|
+
}
|
|
108
|
+
// Remove the server
|
|
109
|
+
delete config.mcpServers[SERVER_NAME];
|
|
110
|
+
writeClaudeConfig(config, true);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get MCP server status
|
|
114
|
+
*/
|
|
115
|
+
export function getMcpStatus() {
|
|
116
|
+
const claudeConfigExists = existsSync(CLAUDE_CONFIG_PATH);
|
|
117
|
+
const { configured, config } = isMcpConfigured();
|
|
118
|
+
let commandExists = false;
|
|
119
|
+
let commandPath;
|
|
120
|
+
try {
|
|
121
|
+
const npmBin = execSync('npm bin -g', { encoding: 'utf-8' }).trim();
|
|
122
|
+
commandPath = join(npmBin, 'claude-conversation-memory-mcp');
|
|
123
|
+
commandExists = existsSync(commandPath);
|
|
124
|
+
}
|
|
125
|
+
catch (_error) {
|
|
126
|
+
// Command not found
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
claudeConfigExists,
|
|
130
|
+
mcpConfigured: configured,
|
|
131
|
+
serverConfig: config,
|
|
132
|
+
commandExists,
|
|
133
|
+
commandPath
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=McpConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpConfig.js","sourceRoot":"","sources":["../../src/utils/McpConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAC3D,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAc1C;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACpC,OAAO,IAAI,CA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,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,oBAAoB;IACpB,OAAO,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEtC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAO1B,MAAM,kBAAkB,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAC1D,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE,CAAC;IAEjD,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,WAA+B,CAAC;IAEpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACpE,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,gCAAgC,CAAC,CAAC;QAC7D,aAAa,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,oBAAoB;IACtB,CAAC;IAED,OAAO;QACL,kBAAkB;QAClB,aAAa,EAAE,UAAU;QACzB,YAAY,EAAE,MAAM;QACpB,aAAa;QACb,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-conversation-memory-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "MCP server for indexing and searching Claude Code conversation history with decision tracking, git integration, and project migration/merge",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
package/scripts/postinstall.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* in Claude Code's global configuration (~/.claude.json)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/* eslint-env node */
|
|
8
|
+
/* eslint-disable no-console */
|
|
9
|
+
|
|
7
10
|
import { readFileSync, writeFileSync, existsSync, copyFileSync } from 'fs';
|
|
8
11
|
import { join } from 'path';
|
|
9
12
|
import { homedir } from 'os';
|