Repository navigation
refactor(mcp): reuse app layer and add schema discovery tools - #82
Merged
Merged
Conversation
MCP query now uses app.ResolveProfile and app.Query instead of duplicating connection and SSH setup. Export app.SSHOptionsForProfile for shared SSH option resolution (including profile skip_host_key). Add consistency unit tests. Co-authored-by: x_zhuo <zx06@users.noreply.github.com>
Expose schema_list_tables, schema_dump, and schema_describe_table MCP tools via internal/app with standard JSON envelopes. Update ai.md, cli-spec, README, skill files, and MCP e2e coverage for MySQL 8 and PostgreSQL 16. Co-authored-by: x_zhuo <zx06@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #82 +/- ##
==========================================
+ Coverage 83.25% 84.35% +1.10%
==========================================
Files 65 67 +2
Lines 6377 6367 -10
==========================================
+ Hits 5309 5371 +62
+ Misses 796 722 -74
- Partials 272 274 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Inject schemaApp hooks for unit tests covering validation, errors, filters, and JSON envelopes. Fix Sonar duplicate-string smells. E2E schema tests create and drop their own MySQL/PG tables so CI empty testdb no longer skips. Co-authored-by: x_zhuo <zx06@users.noreply.github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



摘要(中文)
本 PR 改进 xsql MCP Server 的两块能力:
internal/app:query不再在internal/mcp内重复建连/SSH,profile 的skip_host_key等与 CLI/Web 一致;保留 RFC 0014 写入双重授权、JSON 契约与 stats。schema_list_tables、schema_dump、schema_describe_table,输出与 CLI JSON 契约一致。Follow-up(同 PR 后续提交):补充 schema MCP 单元测试(injectable
schemaApphooks)、E2E 自建表 fixture、Sonar 重复字面量修复,满足 Codecov patch ≥80%。Testing
go test ./...go test -tags=integration ./tests/integration/...(MySQL 8 / PG 16)go test -tags=e2e ./tests/e2e/...golangci-lint run ./...internal/mcppackage coverage 93.6%(schema_tools.gohandlers 100%)