@warmio/mcp 1.0.2 → 1.0.3
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/install.js +41 -14
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
2
|
+
import { join, dirname, resolve } from 'path';
|
|
3
3
|
import { homedir, platform } from 'os';
|
|
4
4
|
import { createInterface } from 'readline';
|
|
5
5
|
const HOME = homedir();
|
|
6
|
+
const CWD = process.cwd();
|
|
6
7
|
function getClaudeDesktopPath() {
|
|
7
8
|
if (platform() === 'win32') {
|
|
8
9
|
return join(process.env.APPDATA || join(HOME, 'AppData', 'Roaming'), 'Claude', 'claude_desktop_config.json');
|
|
@@ -12,7 +13,7 @@ function getClaudeDesktopPath() {
|
|
|
12
13
|
}
|
|
13
14
|
return join(HOME, '.config', 'claude', 'claude_desktop_config.json');
|
|
14
15
|
}
|
|
15
|
-
const
|
|
16
|
+
const GLOBAL_CLIENTS = [
|
|
16
17
|
{ name: 'Claude Code', configPath: join(HOME, '.claude.json'), format: 'json', alwaysInclude: true },
|
|
17
18
|
{ name: 'Claude Desktop', configPath: getClaudeDesktopPath(), format: 'json' },
|
|
18
19
|
{ name: 'Cursor', configPath: join(HOME, '.cursor', 'mcp.json'), format: 'json' },
|
|
@@ -22,11 +23,28 @@ const ALL_CLIENTS = [
|
|
|
22
23
|
{ name: 'Antigravity', configPath: join(HOME, '.gemini', 'antigravity', 'mcp_config.json'), format: 'json' },
|
|
23
24
|
{ name: 'Gemini CLI', configPath: join(HOME, '.gemini', 'settings.json'), format: 'json' },
|
|
24
25
|
];
|
|
26
|
+
// Project-level MCP config files (checked in CWD)
|
|
27
|
+
const PROJECT_CONFIGS = ['.mcp.json', '.cursor/mcp.json', '.vscode/mcp.json'];
|
|
25
28
|
// On Windows, npx doesn't forward stdin/stdout properly for MCP's JSON-RPC protocol.
|
|
26
29
|
// Using cmd /c npx ... fixes the pipe forwarding.
|
|
27
30
|
const MCP_CONFIG = platform() === 'win32'
|
|
28
31
|
? { command: 'cmd', args: ['/c', 'npx', '-y', '@warmio/mcp', '--server'] }
|
|
29
32
|
: { command: 'npx', args: ['-y', '@warmio/mcp', '--server'] };
|
|
33
|
+
function detectProjectClients() {
|
|
34
|
+
const found = [];
|
|
35
|
+
for (const name of PROJECT_CONFIGS) {
|
|
36
|
+
const configPath = resolve(CWD, name);
|
|
37
|
+
if (existsSync(configPath)) {
|
|
38
|
+
found.push({
|
|
39
|
+
name: `Project (${name})`,
|
|
40
|
+
configPath,
|
|
41
|
+
format: 'json',
|
|
42
|
+
isProjectLevel: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return found;
|
|
47
|
+
}
|
|
30
48
|
function isDetected(client) {
|
|
31
49
|
if (client.alwaysInclude)
|
|
32
50
|
return true;
|
|
@@ -55,10 +73,16 @@ function configureJson(client, apiKey) {
|
|
|
55
73
|
}
|
|
56
74
|
if (!config.mcpServers)
|
|
57
75
|
config.mcpServers = {};
|
|
58
|
-
config.mcpServers
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
const servers = config.mcpServers;
|
|
77
|
+
const existing = servers.warm;
|
|
78
|
+
// For project-level configs, preserve existing command/args if present — only inject the key.
|
|
79
|
+
if (client.isProjectLevel && existing?.command) {
|
|
80
|
+
existing.env = { WARM_API_KEY: apiKey };
|
|
81
|
+
servers.warm = existing;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
servers.warm = { ...MCP_CONFIG, env: { WARM_API_KEY: apiKey } };
|
|
85
|
+
}
|
|
62
86
|
mkdirSync(dirname(client.configPath), { recursive: true });
|
|
63
87
|
writeFileSync(client.configPath, JSON.stringify(config, null, 2) + '\n');
|
|
64
88
|
}
|
|
@@ -84,7 +108,7 @@ function configure(client, apiKey) {
|
|
|
84
108
|
configureToml(client, apiKey);
|
|
85
109
|
}
|
|
86
110
|
function shortPath(p) {
|
|
87
|
-
return p.replace(HOME, '~');
|
|
111
|
+
return p.replace(HOME, '~').replace(CWD, '.');
|
|
88
112
|
}
|
|
89
113
|
function prompt(question) {
|
|
90
114
|
return new Promise((resolve) => {
|
|
@@ -101,14 +125,17 @@ export async function install() {
|
|
|
101
125
|
console.log(' Warm MCP Server Installer');
|
|
102
126
|
console.log(' -------------------------');
|
|
103
127
|
console.log('');
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
128
|
+
// Detect global + project-level clients
|
|
129
|
+
const globalClients = GLOBAL_CLIENTS.filter(isDetected);
|
|
130
|
+
const projectClients = detectProjectClients();
|
|
131
|
+
const allClients = [...globalClients, ...projectClients];
|
|
132
|
+
const needsSetup = allClients.filter((c) => !isConfigured(c) || force);
|
|
133
|
+
// Show all detected clients
|
|
107
134
|
console.log(' MCP clients found:');
|
|
108
|
-
|
|
135
|
+
allClients.forEach((client) => {
|
|
109
136
|
const configured = isConfigured(client);
|
|
110
137
|
const status = configured && !force ? 'configured' : 'not configured';
|
|
111
|
-
console.log(` ${client.name.padEnd(
|
|
138
|
+
console.log(` ${client.name.padEnd(22)} ${shortPath(client.configPath).padEnd(55)} ${status}`);
|
|
112
139
|
});
|
|
113
140
|
console.log('');
|
|
114
141
|
// Nothing to do
|
|
@@ -132,10 +159,10 @@ export async function install() {
|
|
|
132
159
|
needsSetup.forEach((client) => {
|
|
133
160
|
try {
|
|
134
161
|
configure(client, apiKey);
|
|
135
|
-
console.log(` ${client.name.padEnd(
|
|
162
|
+
console.log(` ${client.name.padEnd(22)} done`);
|
|
136
163
|
}
|
|
137
164
|
catch (err) {
|
|
138
|
-
console.log(` ${client.name.padEnd(
|
|
165
|
+
console.log(` ${client.name.padEnd(22)} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
139
166
|
}
|
|
140
167
|
});
|
|
141
168
|
console.log('');
|
package/dist/server.js
CHANGED
|
@@ -49,7 +49,7 @@ async function apiRequest(endpoint, params = {}) {
|
|
|
49
49
|
}
|
|
50
50
|
return response.json();
|
|
51
51
|
}
|
|
52
|
-
const server = new Server({ name: 'warm', version: '1.0.
|
|
52
|
+
const server = new Server({ name: 'warm', version: '1.0.3' }, { capabilities: { tools: {} } });
|
|
53
53
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
54
54
|
tools: [
|
|
55
55
|
{
|