MCP Database Server

v1.3.1
io.github.Souhar-dya/mcp-db-server Checked 4 hours ago Published 7 months ago

MCP server for SQLite, PostgreSQL, and MySQL with natural language to SQL and direct SQL tooling.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

query_database

Execute a natural language query on the database. Args: query: Natural language description of what you want to query Returns: The query results formatted as text

ParameterTypeDescription
query *string

list_tables

List all tables in the database. Returns: A list of all available tables with their column counts

describe_table

Get the schema/structure of a specific database table. Args: table_name: Name of the table to describe Returns: The table schema with column names, types, and constraints

ParameterTypeDescription
table_name *string

execute_sql

Execute a raw SQL query on the database. Args: sql_query: The SQL query to execute Returns: The query results formatted as text

ParameterTypeDescription
sql_query *string

connect_to_database

Connect to a different database dynamically. Args: database_url: Database connection URL (e.g., sqlite+aiosqlite:///path/to/db.db, postgresql+asyncpg://user:pass@host:port/db) Returns: Connection status and available tables

ParameterTypeDescription
database_url *string

get_connection_examples

Get examples of database connection URLs for different database types. Returns: Examples of connection strings for various databases

get_current_database_info

Get information about the currently connected database. Returns: Current database connection details and statistics

execute_unsafe_sql

Execute any SQL query without safety restrictions (allows CREATE, DELETE, INSERT, DROP, etc.). WARNING: This tool can modify or delete data. Use with caution! Args: sql_query: Any SQL query including CREATE, INSERT, UPDATE, DELETE, DROP operations Returns: The query results or success message for modification operations

ParameterTypeDescription
sql_query *string

create_table

Create a new table in the database. Args: table_name: Name of the table to create columns_definition: Column definitions (e.g., "id INTEGER PRIMARY KEY, name TEXT NOT NULL, age INTEGER") Returns: Success message or error details

ParameterTypeDescription
columns_definition *string
table_name *string

insert_data

Insert data into a table. Args: table_name: Name of the table to insert into columns: Column names (e.g., "name, age, email") values: Values to insert (e.g., "'John Doe', 30, 'john@example.com'") Returns: Success message with number of rows affected

ParameterTypeDescription
columns *string
table_name *string
values *string

delete_data

Delete data from a table. WARNING: This will permanently delete data! Args: table_name: Name of the table to delete from where_condition: WHERE clause condition (e.g., "id = 1" or "age > 65"). If empty, ALL rows will be deleted! Returns: Success message with number of rows deleted

ParameterTypeDescription
table_name *string
where_conditionstring

update_data

Update data in a table. Args: table_name: Name of the table to update set_clause: SET clause (e.g., "name = 'New Name', age = 25") where_condition: WHERE clause condition (e.g., "id = 1"). If empty, ALL rows will be updated! Returns: Success message with number of rows updated

ParameterTypeDescription
set_clause *string
table_name *string
where_conditionstring