Skip to content

Commit 466bede

Browse files
committed
fix: move MCP server creation logic to mcp-server.ts to resolve circular dependency issue
1 parent 2f74d97 commit 466bede

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

src/index.ts

-22
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ import mcpServer from './mcp/mcp-server.js';
2727
* It also serves as the entry point for starting the MCP server.
2828
*/
2929

30-
// Local imports for internal use
31-
import { IDBManager } from './idb/IDBManager.js';
32-
import { NLParser } from './parser/NLParser.js';
33-
import { MCPOrchestrator } from './orchestrator/MCPOrchestrator.js';
34-
3530
// Export interfaces
3631
export { IIDBManager, SimulatorInfo, AppInfo, SessionConfig } from './idb/interfaces/IIDBManager.js';
3732
export { IParser, ParseResult, ValidationResult } from './parser/interfaces/IParser.js';
@@ -54,23 +49,6 @@ export { MCPOrchestrator } from './orchestrator/MCPOrchestrator.js';
5449
export { ParserToOrchestrator } from './adapters/ParserToOrchestrator.js';
5550
export { OrchestratorToIDB } from './adapters/OrchestratorToIDB.js';
5651

57-
/**
58-
* Create a complete MCP Server instance
59-
* @returns Object with all necessary instances
60-
*/
61-
export function createMCPServer() {
62-
// Create instances
63-
const idbManager = new IDBManager();
64-
const parser = new NLParser();
65-
const orchestrator = new MCPOrchestrator(parser, idbManager);
66-
67-
return {
68-
idbManager,
69-
parser,
70-
orchestrator
71-
};
72-
}
73-
7452
/**
7553
* Main entry point for the MCP server
7654
*

src/mcp/mcp-server.ts

+21-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import fs from 'fs';
1212
import path from 'path';
1313
import { fileURLToPath } from 'url';
1414

15-
import { createMCPServer } from '../index.js';
15+
// Export implementations
16+
import { IDBManager } from '../idb/IDBManager.js';
17+
import { NLParser } from '../parser/NLParser.js';
18+
import { MCPOrchestrator } from '../orchestrator/MCPOrchestrator.js';
1619

1720
// Log configuration
1821
// Get the directory name using ESM approach
@@ -35,6 +38,23 @@ const logToFile = (message: string, level: string = 'info') => {
3538
}
3639
};
3740

41+
/**
42+
* Create a complete MCP Server instance
43+
* @returns Object with all necessary instances
44+
*/
45+
export function createMCPServer() {
46+
// Create instances
47+
const idbManager = new IDBManager();
48+
const parser = new NLParser();
49+
const orchestrator = new MCPOrchestrator(parser, idbManager);
50+
51+
return {
52+
idbManager,
53+
parser,
54+
orchestrator
55+
};
56+
}
57+
3858
/**
3959
* MCP Server implementation for iOS simulator
4060
*/

0 commit comments

Comments
 (0)