You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Enhance database schema handling and security features
- Updated TableSchema to include detailed column information, foreign keys, and primary keys.
- Introduced ColumnInfo and ForeignKey types for better schema representation.
- Added security components: QueryValidator for SQL query validation and PIIMasker for data masking.
- Implemented query modification to enforce row limits on executed queries.
- Added tools for listing tables and describing table schemas with detailed output.
- Enhanced MCPServer to manage custom tools and integrate security features.
- Created tests for query validation, PII masking, schema loading, and tool handling.
Copy file name to clipboardExpand all lines: README.md
+128-5Lines changed: 128 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,10 @@ CoreMCP by CoreBaseHQ provides a secure, extensible bridge between AI assistants
12
12
## 🚀 Features
13
13
**⚠️ Safety First: CoreMCP is designed to be Read-Only by default. We strongly recommend creating a specific database user with SELECT permissions only.**
14
14
- 🔌 **Multiple Database Support**: MSSQL, Firebird (coming soon), and extensible adapter system
15
+
- 🧠 **Automatic Schema Discovery**: CoreMCP automatically scans your database tables, columns, foreign keys, and descriptions to provide AI context
16
+
- 📝 **Column Comments Support**: Extracts and presents database column comments/descriptions to the AI for better query understanding
17
+
- 🛠️ **Dynamic Tool Generation**: Built-in tools for common operations (list tables, describe schema) plus custom tool support
18
+
- 🎯 **Custom Query Tools**: Define reusable SQL queries as MCP tools in your config file
Lists all tables in a database with summary information.
182
+
183
+
**Parameters:**
184
+
-`source_name` (required): Name of the database source
185
+
186
+
**Returns:** List of tables with column counts, primary keys, and foreign key counts.
187
+
188
+
#### `describe_table`
189
+
190
+
Shows detailed schema information for a specific table.
191
+
192
+
**Parameters:**
193
+
-`source_name` (required): Name of the database source
194
+
-`table_name` (required): Name of the table to describe
195
+
196
+
**Returns:** Complete table schema including:
197
+
- Column names and data types
198
+
- Nullable information
199
+
- Primary keys
200
+
- Foreign key relationships
201
+
- Column descriptions/comments
202
+
203
+
### Custom Tools
204
+
205
+
You can define reusable SQL queries as custom MCP tools in your `coremcp.yaml`:
206
+
207
+
```yaml
208
+
custom_tools:
209
+
- name: "get_daily_sales"
210
+
description: "Retrieves daily sales summary for a specific date"
211
+
source: "production_db"
212
+
query: "SELECT * FROM orders WHERE DATE(created_at) = '{{date}}'"
213
+
parameters:
214
+
- name: "date"
215
+
description: "Date in YYYY-MM-DD format"
216
+
required: true
217
+
218
+
- name: "get_top_customers"
219
+
description: "Lists top N customers by order count"
220
+
source: "production_db"
221
+
query: "SELECT user_id, COUNT(*) as order_count FROM orders GROUP BY user_id ORDER BY order_count DESC LIMIT {{limit}}"
222
+
parameters:
223
+
- name: "limit"
224
+
description: "Number of customers to return"
225
+
required: true
226
+
default: "10"
227
+
```
228
+
229
+
**Benefits:**
230
+
- Encapsulate complex queries
231
+
- Provide simple interfaces for common operations
232
+
- Parameters are automatically validated
233
+
- AI can discover and use these tools automatically
234
+
235
+
### `database_schema` Prompt
236
+
237
+
Automatically provides complete database schema context to the AI, including:
238
+
- Table names
239
+
- Column names with data types
240
+
- Primary keys
241
+
- Foreign key relationships
242
+
- Column descriptions/comments from the database
243
+
244
+
When CoreMCP starts, it automatically:
245
+
1. Connects to all configured databases
246
+
2. Scans the schema (tables, columns, keys, relationships)
247
+
3. Extracts column comments/descriptions (e.g., `MS_Description` in MSSQL)
248
+
4. Creates a comprehensive context prompt for the AI
249
+
250
+
This allows Claude to understand your database structure and write accurate queries without you having to explain the schema manually.
251
+
252
+
**Example:**
253
+
When you ask Claude "Show me all sales", Claude can see that you have a `TBLSATIS` table with specific columns and automatically write the correct query.
254
+
139
255
## 🛠️ Adding Custom Adapters
140
256
141
257
1. Create a new package in `pkg/adapter/yourdb/`
@@ -158,19 +274,26 @@ Apache License 2.0 - see [LICENSE](LICENSE) for details.
0 commit comments