Commit bcc756d
fix(mcp): resolve saved-but-inactive connections in bridge (#132)
* fix(mcp): resolve saved-but-inactive connections in bridge
MCP bridge resolve_connection only checked in-memory connections, so
connections saved in .store.dat but not yet activated in the UI session
failed with misleading errors. Reuse capabilities::sql::resolve_adapter,
which reads the store in-process and connects — credentials never leave
the app. McpPolicy authorization still runs upstream in invoke_with_policy.
Also make get_connection_id errors actionable: distinguish 'no connection
provided' (point to sqlkit__list_connections / Settings → MCP Bridge)
from a malformed internal config.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* chore: sync Cargo.lock sqlkit version to 0.8.4
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* fix(mcp): remove get_store_value stub capability
The handler always returned {"value": null} without reading the store —
dead code that misleads agents. MCP should not expose internal app store
data, so remove the capability and its registration.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* feat(mcp): split SQL write tools by risk level
sqlkit__execute_query was a single Elevated capability carrying all SQL —
INSERT/UPDATE/DELETE/DDL ran with no Destructive gate, and parallel_ok
blocked concurrent reads. Split by statement class so McpPolicy can gate
each risk level:
- sqlkit__execute_query: read-only (SELECT/SHOW/EXPLAIN) → Safe, parallel
- sqlkit__execute_write: INSERT/UPDATE/MERGE → Elevated
- sqlkit__execute_delete: DELETE/TRUNCATE → Destructive
- sqlkit__execute_ddl: CREATE/ALTER/DROP → Destructive
classify_sql parses with sqlparser (dialect-aware). execute_query now
rejects write/delete/ddl statements with actionable guidance pointing to
the split tools. New module sql_write.rs shares resolve_adapter and
execute_on_adapter from sql.rs.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
---------
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>1 parent f3972bf commit bcc756d
7 files changed
Lines changed: 492 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
| |||
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
172 | 184 | | |
173 | 185 | | |
174 | 186 | | |
| |||
676 | 688 | | |
677 | 689 | | |
678 | 690 | | |
679 | | - | |
| 691 | + | |
680 | 692 | | |
681 | 693 | | |
682 | 694 | | |
683 | | - | |
| 695 | + | |
684 | 696 | | |
685 | | - | |
| 697 | + | |
686 | 698 | | |
687 | 699 | | |
688 | 700 | | |
689 | | - | |
| 701 | + | |
690 | 702 | | |
691 | 703 | | |
692 | 704 | | |
| |||
777 | 789 | | |
778 | 790 | | |
779 | 791 | | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
0 commit comments