@cano721/mysql-mcp-server 0.9.0 → 0.9.2
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 +5 -1
- package/build/index.js +9 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -400,6 +400,9 @@ MySQL 서버에서 접근 가능한 모든 데이터베이스를 나열합니다
|
|
|
400
400
|
}
|
|
401
401
|
```
|
|
402
402
|
|
|
403
|
+
> **참고**: 응답은 JSON 배열 형태로 제공됩니다. 테이블이나 CSV 형식이 필요한 경우 LLM에게 변환을 요청하세요.
|
|
404
|
+
```
|
|
405
|
+
|
|
403
406
|
**SHOW 명령어 예제**:
|
|
404
407
|
```json
|
|
405
408
|
{
|
|
@@ -792,7 +795,8 @@ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | npx @cano721/mysql-mcp-s
|
|
|
792
795
|
|
|
793
796
|
| 버전 | 날짜 | 주요 변경 사항 |
|
|
794
797
|
|------|------|---------------|
|
|
795
|
-
| 0.9.
|
|
798
|
+
| 0.9.1 | 2025-01-09 | `get_related_tables` 응답 크기 최적화 (포맷 변환은 LLM이 수행) |
|
|
799
|
+
| 0.9.0 | 2025-01-09 | `get_related_tables` 응답 구조 개선 및 최적화 |
|
|
796
800
|
| 0.8.0 | 2025-01-09 | `get_related_tables`에 패턴 매칭 옵션 추가, depth 제한 제거 |
|
|
797
801
|
| 0.7.0 | 2025-01-09 | `get_related_tables` 도구 추가 (FK 기반 연관 테이블 depth별 조회) |
|
|
798
802
|
| 0.6.0 | 2025-01-09 | `analyze_table` → `analyze_query`로 변경, `@latest` 태그 문서 추가 |
|
package/build/index.js
CHANGED
|
@@ -331,8 +331,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
331
331
|
SELECT
|
|
332
332
|
TABLE_NAME as child_table,
|
|
333
333
|
COLUMN_NAME as fk_column,
|
|
334
|
-
REFERENCED_TABLE_NAME as parent_table
|
|
335
|
-
CONSTRAINT_NAME as constraint_name
|
|
334
|
+
REFERENCED_TABLE_NAME as parent_table
|
|
336
335
|
FROM information_schema.KEY_COLUMN_USAGE
|
|
337
336
|
WHERE REFERENCED_TABLE_SCHEMA = ?
|
|
338
337
|
AND REFERENCED_TABLE_NAME = ?
|
|
@@ -345,7 +344,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
345
344
|
child_table: row.child_table,
|
|
346
345
|
fk_column: row.fk_column,
|
|
347
346
|
parent_table: row.parent_table,
|
|
348
|
-
constraint_name: row.constraint_name,
|
|
349
347
|
match_type: 'fk_constraint'
|
|
350
348
|
});
|
|
351
349
|
if (!visited.has(row.child_table)) {
|
|
@@ -358,8 +356,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
358
356
|
SELECT
|
|
359
357
|
TABLE_NAME as child_table,
|
|
360
358
|
COLUMN_NAME as fk_column,
|
|
361
|
-
REFERENCED_TABLE_NAME as parent_table
|
|
362
|
-
CONSTRAINT_NAME as constraint_name
|
|
359
|
+
REFERENCED_TABLE_NAME as parent_table
|
|
363
360
|
FROM information_schema.KEY_COLUMN_USAGE
|
|
364
361
|
WHERE TABLE_SCHEMA = ?
|
|
365
362
|
AND TABLE_NAME = ?
|
|
@@ -377,7 +374,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
377
374
|
child_table: row.child_table,
|
|
378
375
|
fk_column: row.fk_column,
|
|
379
376
|
parent_table: row.parent_table,
|
|
380
|
-
constraint_name: row.constraint_name,
|
|
381
377
|
match_type: 'fk_constraint'
|
|
382
378
|
});
|
|
383
379
|
}
|
|
@@ -423,36 +419,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
423
419
|
child_table: row.related_table,
|
|
424
420
|
fk_column: row.matching_column,
|
|
425
421
|
parent_table: table,
|
|
426
|
-
constraint_name: '(pattern match)',
|
|
427
422
|
match_type: 'pattern_match'
|
|
428
423
|
});
|
|
429
424
|
}
|
|
430
425
|
}
|
|
431
426
|
}
|
|
432
|
-
// Generate table format (Markdown)
|
|
433
|
-
const allRelations = [...results, ...patternMatchResults];
|
|
434
|
-
let tableFormat = '| depth | child_table | fk_column | parent_table | constraint_name | match_type |\n';
|
|
435
|
-
tableFormat += '|-------|-------------|-----------|--------------|-----------------|------------|\n';
|
|
436
|
-
for (const rel of allRelations) {
|
|
437
|
-
tableFormat += `| ${rel.depth} | ${rel.child_table} | ${rel.fk_column} | ${rel.parent_table} | ${rel.constraint_name} | ${rel.match_type} |\n`;
|
|
438
|
-
}
|
|
439
|
-
// Generate CSV format
|
|
440
|
-
let csvFormat = 'depth,child_table,fk_column,parent_table,constraint_name,match_type\n';
|
|
441
|
-
for (const rel of allRelations) {
|
|
442
|
-
csvFormat += `${rel.depth},"${rel.child_table}","${rel.fk_column}","${rel.parent_table}","${rel.constraint_name}",${rel.match_type}\n`;
|
|
443
|
-
}
|
|
444
427
|
const response = {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
total_relations: allRelations.length
|
|
453
|
-
},
|
|
454
|
-
table_format: tableFormat,
|
|
455
|
-
csv_format: csvFormat,
|
|
428
|
+
root_table: table,
|
|
429
|
+
database: dbName,
|
|
430
|
+
requested_depth: requestedDepth,
|
|
431
|
+
search_method: includePatternMatch ? 'fk_constraint + pattern_match' : 'fk_constraint',
|
|
432
|
+
fk_relations_count: results.length,
|
|
433
|
+
pattern_match_count: patternMatchResults.length,
|
|
434
|
+
total_relations: results.length + patternMatchResults.length,
|
|
456
435
|
fk_relations: results,
|
|
457
436
|
pattern_match_relations: includePatternMatch ? patternMatchResults : undefined,
|
|
458
437
|
note: includePatternMatch
|