@warmio/mcp 1.0.1 → 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 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 ALL_CLIENTS = [
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,10 +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
  ];
25
- const MCP_CONFIG = {
26
- command: 'npx',
27
- args: ['-y', '@warmio/mcp', '--server'],
28
- };
26
+ // Project-level MCP config files (checked in CWD)
27
+ const PROJECT_CONFIGS = ['.mcp.json', '.cursor/mcp.json', '.vscode/mcp.json'];
28
+ // On Windows, npx doesn't forward stdin/stdout properly for MCP's JSON-RPC protocol.
29
+ // Using cmd /c npx ... fixes the pipe forwarding.
30
+ const MCP_CONFIG = platform() === 'win32'
31
+ ? { command: 'cmd', args: ['/c', 'npx', '-y', '@warmio/mcp', '--server'] }
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
+ }
29
48
  function isDetected(client) {
30
49
  if (client.alwaysInclude)
31
50
  return true;
@@ -54,10 +73,16 @@ function configureJson(client, apiKey) {
54
73
  }
55
74
  if (!config.mcpServers)
56
75
  config.mcpServers = {};
57
- config.mcpServers.warm = {
58
- ...MCP_CONFIG,
59
- env: { WARM_API_KEY: apiKey },
60
- };
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
+ }
61
86
  mkdirSync(dirname(client.configPath), { recursive: true });
62
87
  writeFileSync(client.configPath, JSON.stringify(config, null, 2) + '\n');
63
88
  }
@@ -68,7 +93,11 @@ function configureToml(client, apiKey) {
68
93
  if (!content.endsWith('\n'))
69
94
  content += '\n';
70
95
  }
71
- content += `\n[mcp_servers.warm]\ncommand = "npx"\nargs = ["-y", "@warmio/mcp", "--server"]\n\n[mcp_servers.warm.env]\nWARM_API_KEY = "${apiKey}"\n`;
96
+ const tomlCommand = platform() === 'win32' ? 'cmd' : 'npx';
97
+ const tomlArgs = platform() === 'win32'
98
+ ? '["/c", "npx", "-y", "@warmio/mcp", "--server"]'
99
+ : '["-y", "@warmio/mcp", "--server"]';
100
+ content += `\n[mcp_servers.warm]\ncommand = "${tomlCommand}"\nargs = ${tomlArgs}\n\n[mcp_servers.warm.env]\nWARM_API_KEY = "${apiKey}"\n`;
72
101
  mkdirSync(dirname(client.configPath), { recursive: true });
73
102
  writeFileSync(client.configPath, content);
74
103
  }
@@ -79,7 +108,7 @@ function configure(client, apiKey) {
79
108
  configureToml(client, apiKey);
80
109
  }
81
110
  function shortPath(p) {
82
- return p.replace(HOME, '~');
111
+ return p.replace(HOME, '~').replace(CWD, '.');
83
112
  }
84
113
  function prompt(question) {
85
114
  return new Promise((resolve) => {
@@ -96,14 +125,17 @@ export async function install() {
96
125
  console.log(' Warm MCP Server Installer');
97
126
  console.log(' -------------------------');
98
127
  console.log('');
99
- const detected = ALL_CLIENTS.filter(isDetected);
100
- const needsSetup = detected.filter((c) => !isConfigured(c) || force);
101
- // Show detected clients and their status
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
102
134
  console.log(' MCP clients found:');
103
- detected.forEach((client) => {
135
+ allClients.forEach((client) => {
104
136
  const configured = isConfigured(client);
105
137
  const status = configured && !force ? 'configured' : 'not configured';
106
- console.log(` ${client.name.padEnd(18)} ${shortPath(client.configPath).padEnd(60)} ${status}`);
138
+ console.log(` ${client.name.padEnd(22)} ${shortPath(client.configPath).padEnd(55)} ${status}`);
107
139
  });
108
140
  console.log('');
109
141
  // Nothing to do
@@ -127,10 +159,10 @@ export async function install() {
127
159
  needsSetup.forEach((client) => {
128
160
  try {
129
161
  configure(client, apiKey);
130
- console.log(` ${client.name.padEnd(18)} done`);
162
+ console.log(` ${client.name.padEnd(22)} done`);
131
163
  }
132
164
  catch (err) {
133
- console.log(` ${client.name.padEnd(18)} failed: ${err instanceof Error ? err.message : String(err)}`);
165
+ console.log(` ${client.name.padEnd(22)} failed: ${err instanceof Error ? err.message : String(err)}`);
134
166
  }
135
167
  });
136
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.1' }, { capabilities: { tools: {} } });
52
+ const server = new Server({ name: 'warm', version: '1.0.3' }, { capabilities: { tools: {} } });
53
53
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
54
54
  tools: [
55
55
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmio/mcp",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "MCP server for Warm Financial API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",