@aris-mcp/server 2.0.0 → 2.1.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.
Files changed (2) hide show
  1. package/dist/index.js +171 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -95,12 +95,183 @@ var TOOL_DEFINITIONS = [
95
95
  }
96
96
  ];
97
97
 
98
+ // src/setup.ts
99
+ import { createInterface } from "readline/promises";
100
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
101
+ import { join } from "path";
102
+ import { homedir } from "os";
103
+ var BOLD = "\x1B[1m";
104
+ var DIM = "\x1B[2m";
105
+ var GREEN = "\x1B[32m";
106
+ var CYAN = "\x1B[36m";
107
+ var YELLOW = "\x1B[33m";
108
+ var RED = "\x1B[31m";
109
+ var RESET = "\x1B[0m";
110
+ var MCP_CONFIG = (apiKey) => ({
111
+ aris: {
112
+ command: "npx",
113
+ args: ["-y", "@aris-mcp/server"],
114
+ env: {
115
+ ARIS_API_KEY: apiKey
116
+ }
117
+ }
118
+ });
119
+ function getIdeTargets() {
120
+ const home = homedir();
121
+ return [
122
+ {
123
+ name: "Claude Code",
124
+ configPath: join(home, ".claude", "settings.json"),
125
+ configKey: "mcpServers"
126
+ },
127
+ {
128
+ name: "Cursor",
129
+ configPath: join(home, ".cursor", "mcp.json"),
130
+ configKey: "mcpServers"
131
+ },
132
+ {
133
+ name: "VS Code",
134
+ configPath: join(home, ".vscode", "mcp.json"),
135
+ configKey: "servers"
136
+ },
137
+ {
138
+ name: "Windsurf",
139
+ configPath: join(home, ".codeium", "windsurf", "mcp_config.json"),
140
+ configKey: "mcpServers"
141
+ }
142
+ ];
143
+ }
144
+ function detectInstalledIdes() {
145
+ const targets = getIdeTargets();
146
+ const home = homedir();
147
+ return targets.filter((ide) => {
148
+ if (existsSync(ide.configPath)) return true;
149
+ const dir = ide.configPath.substring(0, ide.configPath.lastIndexOf("/"));
150
+ if (existsSync(dir)) return true;
151
+ if (process.platform === "darwin") {
152
+ const appNames = {
153
+ "Claude Code": [],
154
+ // CLI-based, check for .claude dir
155
+ "Cursor": ["/Applications/Cursor.app"],
156
+ "VS Code": ["/Applications/Visual Studio Code.app"],
157
+ "Windsurf": ["/Applications/Windsurf.app"]
158
+ };
159
+ const paths = appNames[ide.name] ?? [];
160
+ return paths.some((p) => existsSync(p));
161
+ }
162
+ return false;
163
+ });
164
+ }
165
+ function readJsonFile(path) {
166
+ try {
167
+ const content = readFileSync(path, "utf-8");
168
+ return JSON.parse(content);
169
+ } catch {
170
+ return {};
171
+ }
172
+ }
173
+ function writeJsonFile(path, data) {
174
+ const dir = path.substring(0, path.lastIndexOf("/"));
175
+ mkdirSync(dir, { recursive: true });
176
+ writeFileSync(path, JSON.stringify(data, null, 2) + "\n", "utf-8");
177
+ }
178
+ function configureIde(ide, apiKey) {
179
+ try {
180
+ const config = readJsonFile(ide.configPath);
181
+ const servers = config[ide.configKey] ?? {};
182
+ if (servers.aris) {
183
+ const existing = servers.aris;
184
+ const env = existing.env ?? {};
185
+ env.ARIS_API_KEY = apiKey;
186
+ existing.env = env;
187
+ } else {
188
+ servers.aris = MCP_CONFIG(apiKey).aris;
189
+ }
190
+ config[ide.configKey] = servers;
191
+ writeJsonFile(ide.configPath, config);
192
+ return true;
193
+ } catch {
194
+ return false;
195
+ }
196
+ }
197
+ async function runSetup() {
198
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
199
+ console.log("");
200
+ console.log(` ${BOLD}Aris MCP Server${RESET} ${DIM}v2.0.0${RESET}`);
201
+ console.log(` ${DIM}Optimize every LLM call${RESET}`);
202
+ console.log("");
203
+ console.log(` ${CYAN}Step 1${RESET} ${DIM}/${RESET} API Key`);
204
+ console.log(` ${DIM}Get yours at https://aris.dev${RESET}`);
205
+ console.log("");
206
+ const apiKey = await rl.question(` ${BOLD}ARIS_API_KEY:${RESET} `);
207
+ if (!apiKey.trim()) {
208
+ console.log(`
209
+ ${RED}No API key provided. Exiting.${RESET}
210
+ `);
211
+ rl.close();
212
+ process.exit(1);
213
+ }
214
+ console.log("");
215
+ console.log(` ${CYAN}Step 2${RESET} ${DIM}/${RESET} Detecting IDEs...`);
216
+ console.log("");
217
+ const detected = detectInstalledIdes();
218
+ if (detected.length === 0) {
219
+ console.log(` ${YELLOW}No supported IDEs detected.${RESET}`);
220
+ console.log("");
221
+ console.log(` ${DIM}Manually add to your MCP config:${RESET}`);
222
+ console.log("");
223
+ console.log(` ${DIM}${JSON.stringify({ mcpServers: MCP_CONFIG(apiKey.trim()) }, null, 2).split("\n").join("\n ")}${RESET}`);
224
+ console.log("");
225
+ rl.close();
226
+ return;
227
+ }
228
+ for (const ide of detected) {
229
+ console.log(` ${GREEN}found${RESET} ${ide.name} ${DIM}${ide.configPath}${RESET}`);
230
+ }
231
+ console.log("");
232
+ const answer = await rl.question(` ${BOLD}Configure ${detected.length} IDE${detected.length > 1 ? "s" : ""}? [Y/n]${RESET} `);
233
+ if (answer.trim().toLowerCase() === "n") {
234
+ console.log(`
235
+ ${DIM}Skipped. Add ARIS_API_KEY to your MCP config manually.${RESET}
236
+ `);
237
+ rl.close();
238
+ return;
239
+ }
240
+ console.log("");
241
+ let configured = 0;
242
+ for (const ide of detected) {
243
+ const ok = configureIde(ide, apiKey.trim());
244
+ if (ok) {
245
+ console.log(` ${GREEN}done${RESET} ${ide.name}`);
246
+ configured++;
247
+ } else {
248
+ console.log(` ${RED}fail${RESET} ${ide.name} ${DIM}(check permissions)${RESET}`);
249
+ }
250
+ }
251
+ console.log("");
252
+ if (configured > 0) {
253
+ console.log(` ${GREEN}${BOLD}Aris configured in ${configured} IDE${configured > 1 ? "s" : ""}.${RESET}`);
254
+ console.log(` ${DIM}Restart your IDE to activate.${RESET}`);
255
+ console.log("");
256
+ console.log(` ${DIM}Tools available:${RESET}`);
257
+ console.log(` ${CYAN}aris_optimize${RESET} ${DIM}Full pipeline: redact + compress + LLM${RESET}`);
258
+ console.log(` ${CYAN}aris_compress${RESET} ${DIM}Context compression only${RESET}`);
259
+ console.log(` ${CYAN}aris_health${RESET} ${DIM}Check pipeline status${RESET}`);
260
+ }
261
+ console.log("");
262
+ rl.close();
263
+ }
264
+
98
265
  // src/index.ts
99
266
  function log(message) {
100
267
  process.stderr.write(`[aris-mcp] ${message}
101
268
  `);
102
269
  }
103
270
  async function main() {
271
+ if (!process.env.ARIS_API_KEY && process.stdin.isTTY) {
272
+ await runSetup();
273
+ return;
274
+ }
104
275
  let config;
105
276
  try {
106
277
  config = loadConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aris-mcp/server",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "aris-mcp": "dist/index.js"