Lukynnnn commited on
Commit
9e01acf
·
verified ·
1 Parent(s): 468c6be

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +76 -0
README.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - mcp
6
+ - model-context-protocol
7
+ - ai-tools
8
+ - database
9
+ - sqlite
10
+ - postgresql
11
+ - mysql
12
+ - mssql
13
+ library_name: mcp-database-universal
14
+ license: mit
15
+ ---
16
+
17
+ # MCP Database Universal
18
+
19
+ A reasoning interface for databases — not a thin execution wrapper. Designed so LLM agents understand *what* the data means, not just how to fetch it.
20
+
21
+ ## What it does
22
+
23
+ - **7 tools** designed for agent thinking: `test_connection`, `list_tables`, `inspect_table`, `query`, `natural_query`, `profile_database`, `schema_graph`
24
+ - **4 database engines**: SQLite (built-in), PostgreSQL, MySQL, MSSQL (optional extras)
25
+ - **Read-only by default** — write operations only with `DATABASE_WRITE_ENABLED=true`
26
+ - **Safety layer** — SQL injection detection, read-only classification, LIMIT enforcement, 30s timeout, 1000-row limit
27
+ - **LLM formatter** — type translation (e.g. `VARCHAR(255)` → "text, max 255 chars"), NULL → `(empty)`, truncation to 50KB
28
+ - **Schema inspector** — relationship discovery + Mermaid ER diagram generation
29
+ - **Zero-config SQLite** via `DATABASE_URL=sqlite:///path/to.db`
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pip install mcp-database-universal
35
+ pip install "mcp-database-universal[postgres]" # PostgreSQL support
36
+ pip install "mcp-database-universal[mysql]" # MySQL support
37
+ pip install "mcp-database-universal[mssql]" # MSSQL support
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### Run locally
43
+ ```bash
44
+ python -m src
45
+ ```
46
+
47
+ ### Run with Docker
48
+ ```bash
49
+ docker run -i -e DATABASE_URL=sqlite:////data/app.db \
50
+ -v ./data:/data mcp-database-universal:latest
51
+ ```
52
+
53
+ ## Configuration (env vars)
54
+
55
+ | Variable | Description | Default |
56
+ |----------|-------------|---------|
57
+ | `DATABASE_URL` | `sqlite:///path.db`, `postgresql://...`, `mysql://...`, `mssql://...` | required |
58
+ | `DATABASE_WRITE_ENABLED` | Allow write operations (INSERT/UPDATE/DELETE) | `false` |
59
+ | `DATABASE_QUERY_LIMIT` | Max rows returned per query | `1000` |
60
+ | `DATABASE_TIMEOUT` | Query timeout in seconds | `30` |
61
+
62
+ ## Tools
63
+
64
+ | Tool | Description |
65
+ |------|-------------|
66
+ | `test_connection` | Verify connection, get engine type, version, size |
67
+ | `list_tables` | Overview of tables with row counts and relationships |
68
+ | `inspect_table` | Full table structure: columns, types, keys, sample data |
69
+ | `query` | Execute parametrized, safety-checked SQL |
70
+ | `natural_query` | Ask in plain language, get SQL + results + explanation |
71
+ | `profile_database` | Value distributions, NULL rates, relationships, sizes |
72
+ | `schema_graph` | Mermaid ER diagram of relationships |
73
+
74
+ ## License
75
+
76
+ MIT