aiexecode 1.0.88 → 1.0.90
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.
Potentially problematic release.
This version of aiexecode might be problematic. Click here for more details.
- package/index.js +128 -20
- package/mcp-agent-lib/.claude/settings.local.json +9 -0
- package/mcp-agent-lib/example/01-basic-usage.js +82 -0
- package/mcp-agent-lib/example/02-quick-start.js +52 -0
- package/mcp-agent-lib/example/03-http-server.js +76 -0
- package/mcp-agent-lib/example/04-multiple-servers.js +117 -0
- package/mcp-agent-lib/example/05-error-handling.js +116 -0
- package/mcp-agent-lib/example/06-resources-and-prompts.js +174 -0
- package/mcp-agent-lib/example/07-advanced-configuration.js +191 -0
- package/mcp-agent-lib/example/08-real-world-chatbot.js +331 -0
- package/mcp-agent-lib/example/README.md +346 -0
- package/mcp-agent-lib/sampleMCPHost/index.js +267 -0
- package/mcp-agent-lib/sampleMCPHost/mcp_config.json +18 -0
- package/mcp-agent-lib/src/mcp_client.js +302 -77
- package/package.json +1 -1
- package/payload_viewer/out/404/index.html +1 -1
- package/payload_viewer/out/404.html +1 -1
- package/payload_viewer/out/index.html +1 -1
- package/payload_viewer/out/index.txt +1 -1
- package/src/ai_based/orchestrator.js +4 -1
- package/src/cli/mcp_cli.js +14 -7
- package/src/cli/mcp_commands.js +31 -15
- package/src/commands/mcp.js +36 -18
- package/src/frontend/App.js +54 -4
- package/src/frontend/components/BlankLine.js +5 -3
- package/src/frontend/components/ConversationItem.js +43 -10
- package/src/system/code_executer.js +6 -0
- package/src/system/mcp_integration.js +94 -40
- package/src/tools/file_reader.js +6 -0
- package/src/tools/glob.js +3 -0
- package/src/tools/ripgrep.js +2 -0
- package/src/tools/web_downloader.js +3 -0
- package/src/util/mcp_config_manager.js +41 -20
- /package/payload_viewer/out/_next/static/{dp582oDmc4bDYYIktREJ4 → w4dMVYalgk7djrLxRxWiE}/_buildManifest.js +0 -0
- /package/payload_viewer/out/_next/static/{dp582oDmc4bDYYIktREJ4 → w4dMVYalgk7djrLxRxWiE}/_clientMiddlewareManifest.json +0 -0
- /package/payload_viewer/out/_next/static/{dp582oDmc4bDYYIktREJ4 → w4dMVYalgk7djrLxRxWiE}/_ssgManifest.js +0 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// MCP 설정 관리 유틸리티
|
|
2
|
+
// MCP 서버 설정의 저장, 로드, 수정을 담당
|
|
3
|
+
// 설정 파일 위치: ~/.aiexe/mcp_config.json
|
|
2
4
|
import { safeReadFile, safeWriteFile, safeMkdir } from './safe_fs.js';
|
|
3
5
|
import { join } from 'path';
|
|
4
6
|
import { createHash } from 'crypto';
|
|
5
7
|
import { CONFIG_DIR } from './config.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
|
-
* MCP 설정
|
|
10
|
+
* MCP 설정 파일의 절대 경로 반환
|
|
11
|
+
* 모든 MCP 서버 설정은 사용자 홈 디렉토리의 ~/.aiexe/mcp_config.json에 저장됨
|
|
9
12
|
* @returns {string} 설정 파일 경로
|
|
10
13
|
*/
|
|
11
14
|
export function getMcpConfigPath() {
|
|
@@ -14,8 +17,9 @@ export function getMcpConfigPath() {
|
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
|
-
* 설정
|
|
18
|
-
*
|
|
20
|
+
* MCP 설정 파일에서 모든 서버 설정을 로드
|
|
21
|
+
* 설정 파일이 없거나 읽기 실패 시 빈 객체 반환
|
|
22
|
+
* @returns {Promise<Object>} MCP 서버 설정 객체 (서버이름 -> 설정)
|
|
19
23
|
*/
|
|
20
24
|
export async function loadMergedMcpConfig() {
|
|
21
25
|
try {
|
|
@@ -23,25 +27,33 @@ export async function loadMergedMcpConfig() {
|
|
|
23
27
|
const data = await safeReadFile(path, 'utf8');
|
|
24
28
|
const config = JSON.parse(data);
|
|
25
29
|
|
|
26
|
-
//
|
|
30
|
+
// mcpServers 필드에 서버 설정들이 저장되어 있음
|
|
27
31
|
return config.mcpServers || {};
|
|
28
32
|
} catch (error) {
|
|
29
|
-
// 파일이 없으면 빈 객체 반환
|
|
33
|
+
// 파일이 없으면 빈 객체 반환 (첫 실행 시 정상적인 상황)
|
|
30
34
|
if (error.message && error.message.includes('Failed to read file')) {
|
|
31
35
|
return {};
|
|
32
36
|
}
|
|
33
|
-
//
|
|
37
|
+
// 파일 읽기 실패 시에도 빈 객체 반환하여 프로그램이 계속 실행되도록 함
|
|
34
38
|
return {};
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
|
-
* 환경 변수
|
|
43
|
+
* 설정 객체 내의 환경 변수 참조를 실제 값으로 확장
|
|
44
|
+
*
|
|
45
|
+
* 지원 형식:
|
|
46
|
+
* ${VAR} - 환경 변수 VAR의 값 (없으면 에러)
|
|
47
|
+
* ${VAR:-default} - 환경 변수 VAR의 값 또는 기본값
|
|
48
|
+
*
|
|
49
|
+
* 예: { "token": "${GITHUB_TOKEN}" } -> { "token": "ghp_xxxx..." }
|
|
50
|
+
*
|
|
40
51
|
* @param {any} obj - 확장할 객체/문자열/배열
|
|
41
52
|
* @returns {any} 환경 변수가 확장된 결과
|
|
42
53
|
*/
|
|
43
54
|
export function expandEnvVars(obj) {
|
|
44
55
|
if (typeof obj === 'string') {
|
|
56
|
+
// 정규식으로 ${VAR} 또는 ${VAR:-default} 패턴 찾아서 치환
|
|
45
57
|
return obj.replace(/\$\{([^}:]+)(?::-([^}]*))?\}/g, (match, varName, defaultValue) => {
|
|
46
58
|
const envValue = process.env[varName];
|
|
47
59
|
if (envValue !== undefined) return envValue;
|
|
@@ -50,10 +62,12 @@ export function expandEnvVars(obj) {
|
|
|
50
62
|
});
|
|
51
63
|
}
|
|
52
64
|
|
|
65
|
+
// 배열인 경우 각 원소에 대해 재귀적으로 확장
|
|
53
66
|
if (Array.isArray(obj)) {
|
|
54
67
|
return obj.map(expandEnvVars);
|
|
55
68
|
}
|
|
56
69
|
|
|
70
|
+
// 객체인 경우 모든 값에 대해 재귀적으로 확장
|
|
57
71
|
if (obj && typeof obj === 'object') {
|
|
58
72
|
const result = {};
|
|
59
73
|
for (const [key, value] of Object.entries(obj)) {
|
|
@@ -62,59 +76,66 @@ export function expandEnvVars(obj) {
|
|
|
62
76
|
return result;
|
|
63
77
|
}
|
|
64
78
|
|
|
79
|
+
// 기본 타입(숫자, 불린 등)은 그대로 반환
|
|
65
80
|
return obj;
|
|
66
81
|
}
|
|
67
82
|
|
|
68
83
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
84
|
+
* MCP 서버 설정을 파일에 저장
|
|
85
|
+
* 설정 디렉토리가 없으면 자동 생성
|
|
86
|
+
* @param {Object} servers - MCP 서버 설정 객체 (서버이름 -> 설정)
|
|
71
87
|
* @returns {Promise<string>} 저장된 파일 경로
|
|
72
88
|
*/
|
|
73
89
|
export async function saveMcpConfig(servers) {
|
|
74
90
|
const path = getMcpConfigPath();
|
|
75
91
|
const dir = join(path, '..');
|
|
76
92
|
|
|
93
|
+
// 설정 디렉토리가 없으면 생성 (~/.aiexe)
|
|
77
94
|
await safeMkdir(dir, { recursive: true });
|
|
78
95
|
|
|
96
|
+
// JSON 형식으로 변환 (mcpServers 필드 안에 서버 설정들 저장)
|
|
79
97
|
const config = {
|
|
80
98
|
mcpServers: servers
|
|
81
99
|
};
|
|
82
100
|
|
|
101
|
+
// 파일에 저장 (들여쓰기 2칸으로 가독성 향상)
|
|
83
102
|
await safeWriteFile(path, JSON.stringify(config, null, 2), 'utf8');
|
|
84
|
-
// Saved MCP config - silently
|
|
85
103
|
return path;
|
|
86
104
|
}
|
|
87
105
|
|
|
88
106
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* @param {
|
|
107
|
+
* 새로운 MCP 서버를 설정에 추가
|
|
108
|
+
* 기존 설정을 로드한 후 새 서버를 추가하고 저장
|
|
109
|
+
* @param {string} name - 서버 이름 (고유 식별자)
|
|
110
|
+
* @param {Object} serverConfig - 서버 설정 (type, command, url 등)
|
|
92
111
|
* @returns {Promise<string>} 저장된 파일 경로
|
|
93
112
|
*/
|
|
94
113
|
export async function addServerToScope(name, serverConfig) {
|
|
95
|
-
//
|
|
114
|
+
// 기존에 저장된 모든 서버 설정 로드
|
|
96
115
|
const existingServers = await loadMergedMcpConfig();
|
|
97
116
|
|
|
98
|
-
// 서버 추가
|
|
117
|
+
// 새 서버 추가 (같은 이름이 있으면 덮어씀)
|
|
99
118
|
existingServers[name] = serverConfig;
|
|
100
119
|
|
|
101
|
-
// 저장
|
|
120
|
+
// 변경된 설정을 파일에 저장
|
|
102
121
|
return await saveMcpConfig(existingServers);
|
|
103
122
|
}
|
|
104
123
|
|
|
105
124
|
/**
|
|
106
|
-
* 서버 제거
|
|
107
|
-
* @param {string} name - 서버 이름
|
|
108
|
-
* @returns {Promise<Object>} 결과 객체 { success, message }
|
|
125
|
+
* 설정에서 MCP 서버 제거
|
|
126
|
+
* @param {string} name - 제거할 서버 이름
|
|
127
|
+
* @returns {Promise<Object>} 결과 객체 { success: boolean, message: string }
|
|
109
128
|
*/
|
|
110
129
|
export async function removeServerFromScope(name) {
|
|
111
130
|
try {
|
|
112
131
|
const servers = await loadMergedMcpConfig();
|
|
113
132
|
|
|
133
|
+
// 서버가 존재하지 않으면 실패 반환
|
|
114
134
|
if (!servers[name]) {
|
|
115
135
|
return { success: false, message: `Server '${name}' not found` };
|
|
116
136
|
}
|
|
117
137
|
|
|
138
|
+
// 서버 설정 삭제
|
|
118
139
|
delete servers[name];
|
|
119
140
|
await saveMcpConfig(servers);
|
|
120
141
|
|
|
@@ -128,7 +149,7 @@ export async function removeServerFromScope(name) {
|
|
|
128
149
|
}
|
|
129
150
|
|
|
130
151
|
/**
|
|
131
|
-
* 서버가 존재하는지 확인
|
|
152
|
+
* 특정 이름의 MCP 서버가 설정에 존재하는지 확인
|
|
132
153
|
* @param {string} name - 서버 이름
|
|
133
154
|
* @returns {Promise<boolean>} 서버 존재 여부
|
|
134
155
|
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|