An MCP server for SQL database connectivity
Project description
SQL Connector MCP
An MCP (Model Context Protocol) server that provides SQL database connectivity for AI assistants like Claude.
Features
- Database Exploration: List all table names or filter tables by substring
- Schema Inspection: Get detailed schema definitions including columns, types, primary keys, and foreign key relationships
- Query Execution: Execute SQL queries with parameterized inputs and formatted results
- Form Fetching: Retrieve form schemas from database based on trigger keywords
Installation
pip install sql-connector-mcp
Configuration
Set the following environment variables:
# Required: Database connection URL
DB_URL=mysql://user:password@host:port/database
# Optional: Maximum characters for query results (default: 4000)
EXECUTE_QUERY_MAX_CHARS=4000
# Optional: Path for saving full result sets
CLAUDE_LOCAL_FILES_PATH=/path/to/files
Usage
Run the MCP server:
python -m sql_connector_mcp.server
Opens the caldue code or cursor or any ai ide and add this json "my_database": { "command": "python", "args": ["-m", "sql_connector_mcp.server"], "env": { "DB_URL": "your dbatabase url" }
Available Tools
| Tool | Description |
|---|---|
all_table_names() |
Returns all table names in the database |
filter_table_names(q) |
Returns table names containing the substring q |
schema_definitions(table_names) |
Returns schema and relationship info for specified tables |
execute_query(query, params) |
Executes a SQL query and returns formatted results |
fetch_form(query_text, db_name) |
Fetches form schema based on trigger keywords |
Requirements
- Python >= 3.7
- SQLAlchemy
- PyMySQL
- FastMCP
License
MIT License
Author
Battula Anil Kumar (anilkumarbaatula@gmail.com)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sql_connector_mcp-0.1.1.tar.gz.
File metadata
- Download URL: sql_connector_mcp-0.1.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4c945d9af534f54c80b846cba25137786272073f39aab079b1e6e05185be773
|
|
| MD5 |
6a2e447910a7baed14ab29d37cf82625
|
|
| BLAKE2b-256 |
63a6df8c11516142580840b77e7a261334d9f9e094464a95fd018caf570a3ce8
|
File details
Details for the file sql_connector_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sql_connector_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36a1bbadc34691634b8761dedb66fbf6755cebff541c865ff5354b7ad5f1d6e5
|
|
| MD5 |
118b97550ac302fe3e1fe303f0e6bbd5
|
|
| BLAKE2b-256 |
40f59f2559a8eb28fdc761cec48858625ef5197dc3169ed272c12a68d71a4a05
|