genesis-ai-cli 14.7.0 → 14.8.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/README.md CHANGED
@@ -43,6 +43,29 @@ genesis chat
43
43
  genesis infer mcp --cycles 10
44
44
  ```
45
45
 
46
+ ## Use as MCP Server (Claude Code / Claude Desktop)
47
+
48
+ Genesis can be installed as an MCP server, giving Claude access to:
49
+ - **genesis.chat** - Multi-model AI with auto-routing (GPT-4, Claude, Gemini, local Ollama)
50
+ - **genesis.research** - Deep research using 20+ sources (arXiv, Semantic Scholar, Brave, etc.)
51
+ - **genesis.analyze** - Code/data analysis with multi-perspective reasoning
52
+
53
+ ```bash
54
+ # Add to Claude Code
55
+ claude mcp add genesis -- npx genesis-ai-cli mcp-server
56
+
57
+ # Or manual config in Claude Desktop settings:
58
+ # Add to ~/Library/Application Support/Claude/claude_desktop_config.json
59
+ {
60
+ "mcpServers": {
61
+ "genesis": {
62
+ "command": "npx",
63
+ "args": ["genesis-ai-cli", "mcp-server"]
64
+ }
65
+ }
66
+ }
67
+ ```
68
+
46
69
  ## API Keys Setup
47
70
 
48
71
  Copy `.env.example` to `.env` and add your keys:
package/dist/src/index.js CHANGED
@@ -576,7 +576,17 @@ async function cmdMCP(subcommand, options) {
576
576
  });
577
577
  console.log(` Name: ${options.name || 'genesis'}`);
578
578
  console.log(` Transport: stdio`);
579
- console.log(` Tools: genesis.think, genesis.remember, genesis.execute, genesis.analyze, genesis.create`);
579
+ console.log(` Tools:`);
580
+ console.log(` ${c('genesis.chat', 'cyan')} - Multi-model AI chat with auto-routing`);
581
+ console.log(` ${c('genesis.research', 'cyan')} - Deep research using 20+ MCP sources`);
582
+ console.log(` ${c('genesis.analyze', 'cyan')} - Code/data analysis`);
583
+ console.log(` ${c('genesis.think', 'cyan')} - Deep reasoning with multi-mind synthesis`);
584
+ console.log(` ${c('genesis.create', 'cyan')} - Code/content generation`);
585
+ console.log(` ${c('genesis.remember', 'cyan')} - Memory operations`);
586
+ console.log(` ${c('genesis.execute', 'cyan')} - Autonomous task execution`);
587
+ console.log('');
588
+ console.log(c('To add to Claude Code:', 'dim'));
589
+ console.log(c(' claude mcp add genesis -- npx genesis-ai-cli mcp-server', 'yellow'));
580
590
  console.log('');
581
591
  console.log(c('Server starting... (Ctrl+C to stop)', 'dim'));
582
592
  await server.start();
@@ -2099,6 +2109,11 @@ async function main() {
2099
2109
  case 'mcp':
2100
2110
  await cmdMCP(positional, options);
2101
2111
  break;
2112
+ case 'mcp-server':
2113
+ // v14.7: Alias for `mcp serve` - easier for Claude Code installation
2114
+ // Usage: npx genesis-ai-cli mcp-server
2115
+ await cmdMCP('serve', options);
2116
+ break;
2102
2117
  case 'daemon':
2103
2118
  await cmdDaemon(positional, options);
2104
2119
  break;
@@ -78,6 +78,8 @@ export declare class GenesisMCPServer extends EventEmitter {
78
78
  private handleExecute;
79
79
  private handleAnalyze;
80
80
  private handleCreate;
81
+ private handleChat;
82
+ private handleResearch;
81
83
  private executeTool;
82
84
  start(): Promise<void>;
83
85
  stop(): Promise<void>;
@@ -547,6 +547,40 @@ class GenesisMCPServer extends events_1.EventEmitter {
547
547
  annotations: { readOnlyHint: true },
548
548
  handler: this.handleCreate.bind(this),
549
549
  });
550
+ // v14.7: genesis.chat - Multi-model AI chat with automatic routing
551
+ this.registerTool({
552
+ name: 'genesis.chat',
553
+ description: 'Multi-model AI chat with automatic routing. Routes to cheapest/fastest/best model based on query complexity. Supports GPT-4, Claude, Gemini, Mistral, and local Ollama.',
554
+ inputSchema: zod_1.z.object({
555
+ prompt: zod_1.z.string().describe('User message to process'),
556
+ model: zod_1.z.enum(['auto', 'fast', 'smart', 'cheap', 'local']).optional().default('auto'),
557
+ systemPrompt: zod_1.z.string().optional().describe('Optional system prompt'),
558
+ maxTokens: zod_1.z.number().optional().default(2048),
559
+ }),
560
+ requiredScopes: ['chat'],
561
+ baseCost: 0.01,
562
+ supportsStreaming: true,
563
+ maxExecutionTime: 60000,
564
+ annotations: { readOnlyHint: true },
565
+ handler: this.handleChat.bind(this),
566
+ });
567
+ // v14.7: genesis.research - Deep research using 20+ MCP sources
568
+ this.registerTool({
569
+ name: 'genesis.research',
570
+ description: 'Deep research using 20+ MCP sources including arXiv, Semantic Scholar, Brave Search, Gemini, Exa, and more. Aggregates and synthesizes results.',
571
+ inputSchema: zod_1.z.object({
572
+ topic: zod_1.z.string().describe('Research topic or question'),
573
+ depth: zod_1.z.enum(['quick', 'standard', 'deep']).optional().default('standard'),
574
+ sources: zod_1.z.array(zod_1.z.string()).optional().describe('Specific sources to use (arxiv, semantic-scholar, brave, gemini, etc)'),
575
+ maxResults: zod_1.z.number().optional().default(10),
576
+ }),
577
+ requiredScopes: ['research'],
578
+ baseCost: 0.05,
579
+ supportsStreaming: false,
580
+ maxExecutionTime: 120000,
581
+ annotations: { readOnlyHint: true, longRunningHint: true },
582
+ handler: this.handleResearch.bind(this),
583
+ });
550
584
  }
551
585
  // ============================================================================
552
586
  // v11.2: CompIntel + Revenue + Daemon Tools
@@ -1030,6 +1064,102 @@ class GenesisMCPServer extends events_1.EventEmitter {
1030
1064
  return { success: false, error: String(error) };
1031
1065
  }
1032
1066
  }
1067
+ // v14.7: Chat handler with multi-model routing
1068
+ async handleChat(rawInput, ctx) {
1069
+ const input = rawInput;
1070
+ try {
1071
+ // Dynamic import to avoid circular dependencies
1072
+ const { getLLMBridge } = await import('../llm/index.js');
1073
+ const bridge = getLLMBridge();
1074
+ const response = await bridge.chat(input.prompt, input.systemPrompt);
1075
+ ctx.meter.recordTokens(input.prompt.length / 4, (response.content?.length || 0) / 4);
1076
+ const totalTokens = (response.usage?.inputTokens || 0) + (response.usage?.outputTokens || 0);
1077
+ return {
1078
+ success: true,
1079
+ data: {
1080
+ response: response.content || '',
1081
+ model: response.model || 'unknown',
1082
+ tokens: totalTokens,
1083
+ cost: 0, // Cost calculated separately
1084
+ },
1085
+ };
1086
+ }
1087
+ catch (error) {
1088
+ return { success: false, error: String(error) };
1089
+ }
1090
+ }
1091
+ // v14.7: Research handler using MCP sources
1092
+ async handleResearch(rawInput, ctx) {
1093
+ const input = rawInput;
1094
+ try {
1095
+ const { getMCPClient } = await import('../mcp/index.js');
1096
+ const mcp = getMCPClient();
1097
+ const findings = [];
1098
+ const usedSources = [];
1099
+ const defaultSources = input.sources || ['arxiv', 'brave', 'gemini'];
1100
+ const maxResults = input.maxResults || 10;
1101
+ // Quick depth = 1 source, standard = 3, deep = 5+
1102
+ const sourceCount = input.depth === 'quick' ? 1 : input.depth === 'deep' ? 5 : 3;
1103
+ const sourcesToUse = defaultSources.slice(0, sourceCount);
1104
+ for (const source of sourcesToUse) {
1105
+ try {
1106
+ let result;
1107
+ switch (source) {
1108
+ case 'arxiv':
1109
+ result = await mcp.call('arxiv', 'search_arxiv', { query: input.topic, max_results: maxResults });
1110
+ if (result.success && result.data) {
1111
+ findings.push(...(Array.isArray(result.data) ? result.data : [result.data]));
1112
+ usedSources.push('arxiv');
1113
+ }
1114
+ break;
1115
+ case 'semantic-scholar':
1116
+ result = await mcp.call('semantic-scholar', 'search_semantic_scholar', { query: input.topic, limit: maxResults });
1117
+ if (result.success && result.data) {
1118
+ findings.push(...(Array.isArray(result.data) ? result.data : [result.data]));
1119
+ usedSources.push('semantic-scholar');
1120
+ }
1121
+ break;
1122
+ case 'brave':
1123
+ result = await mcp.call('brave-search', 'brave_web_search', { query: input.topic, count: maxResults });
1124
+ if (result.success && result.data) {
1125
+ findings.push(...(Array.isArray(result.data) ? result.data : [result.data]));
1126
+ usedSources.push('brave-search');
1127
+ }
1128
+ break;
1129
+ case 'gemini':
1130
+ result = await mcp.call('gemini', 'web_search', { query: input.topic });
1131
+ if (result.success && result.data) {
1132
+ findings.push(result.data);
1133
+ usedSources.push('gemini');
1134
+ }
1135
+ break;
1136
+ case 'exa':
1137
+ result = await mcp.call('exa', 'web_search_exa', { query: input.topic, numResults: maxResults });
1138
+ if (result.success && result.data) {
1139
+ findings.push(...(Array.isArray(result.data) ? result.data : [result.data]));
1140
+ usedSources.push('exa');
1141
+ }
1142
+ break;
1143
+ }
1144
+ }
1145
+ catch (sourceError) {
1146
+ console.warn(`[Research] Source ${source} failed:`, sourceError);
1147
+ }
1148
+ }
1149
+ ctx.meter.recordTokens(input.topic.length / 4, findings.length * 100);
1150
+ return {
1151
+ success: true,
1152
+ data: {
1153
+ findings: findings.slice(0, maxResults),
1154
+ summary: `Found ${findings.length} results from ${usedSources.length} sources for "${input.topic}"`,
1155
+ sources: usedSources,
1156
+ },
1157
+ };
1158
+ }
1159
+ catch (error) {
1160
+ return { success: false, error: String(error) };
1161
+ }
1162
+ }
1033
1163
  // ============================================================================
1034
1164
  // Tool Execution Pipeline
1035
1165
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genesis-ai-cli",
3
- "version": "14.7.0",
3
+ "version": "14.8.0",
4
4
  "description": "Fully Autonomous AI System with RSI (Recursive Self-Improvement) - Self-funding, Self-deploying, Production Memory, A2A Protocol & Governance",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",