Database Connections
About
Provides a unified TypeScript-based database server for seamlessly connecting to SQLite, PostgreSQL, SQL Server, and MongoDB, enabling flexible database interactions through server-sent events and standard I/O communication modes.
Details
- Author
- cuongtl1992
- Repository
- cuongtl1992/mcp-dbs
- GitHub stars
- 17
- Downloads
- 406
- License
- MIT License
- Categories
- Database, Other, AI, Design, Developer Tools, Search, Infrastructure, API
Jump to
- Connect to and disconnect from multiple database types
- Execute SQL or MongoDB queries that return results
- Execute updates (INSERT, UPDATE, DELETE) without results
- Retrieve full database or table schema
- List all tables in a connected database
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Database ConnectionsCommand (node, npx, python, etc.)nodeArguments-
Argument 1
/path/to/your/mcp-dbs/dist/cli.js -
Argument 2
--stdio
Environment-
MCP_MONGODB_URI
mongodb://localhost:27017 -
MCP_MONGODB_DATABASE
your-database-name
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
The MCP Database Server can be used in two modes:
1. Open or create your Claude Desktop configuration file
2. Add the mcp-dbs configuration to the mcpServers section:
{
"mcpServers": {
"mcp-dbs": {
"command": "node",
"args": [
"/path/to/your/mcp-dbs/dist/cli.js",
"--stdio"
],
"env": {
"MCP_MONGODB_URI": "mongodb://localhost:27017",
"MCP_MONGODB_DATABASE": "your-database-name"
}
}
}
}
Replace the environment variables with your own database connection details.
You can configure your database connections using environment variables:
export MCP_MONGODB_URI="mongodb://localhost:27017"
export MCP_MONGODB_DATABASE="your-database-name"
export MCP_MONGODB_MAX_POOL_SIZE="10"
export MCP_MONGODB_USE_UNIFIED_TOPOLOGY="true"
```
These environment variables will take precedence over any configuration passed to the connect-database tool.
connect-database
Connect to a database. Parameters: connectionId (string), type (string: 'sqlite', 'postgres', 'mssql', or 'mongodb')
disconnect-database
Disconnect from a database. Parameters: connectionId (string)
execute-query
Execute a query that returns results. Parameters: connectionId (string), query (string), params (optional array)
execute-update
Execute a query that doesn't return results (INSERT, UPDATE, DELETE). Parameters: connectionId (string), query (string), params (optional array)
- connect-database: Connect to a database
- disconnect-database: Disconnect from a database
- execute-query: Execute a query and return results
- execute-update: Execute a query without returning results
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"database connections": {
"env": {
"MCP_MONGODB_URI": "mongodb://localhost:27017",
"MCP_MONGODB_DATABASE": "your-database-name"
},
"args": [
"/path/to/your/mcp-dbs/dist/cli.js",
"--stdio"
],
"command": "node"
}
}
}
Linux
{
"env": {
"MCP_MONGODB_URI": "mongodb://localhost:27017",
"MCP_MONGODB_DATABASE": "your-database-name"
},
"args": [
"/path/to/your/mcp-dbs/dist/cli.js",
"--stdio"
],
"command": "node"
}
Macos
{
"env": {
"MCP_MONGODB_URI": "mongodb://localhost:27017",
"MCP_MONGODB_DATABASE": "your-database-name"
},
"args": [
"/path/to/your/mcp-dbs/dist/cli.js",
"--stdio"
],
"command": "node"
}
Windows
{
"env": {
"MCP_MONGODB_URI": "mongodb://localhost:27017",
"MCP_MONGODB_DATABASE": "your-database-name"
},
"args": [
"/path/to/your/mcp-dbs/dist/cli.js",
"--stdio"
],
"command": "node"
}
A Model Context Protocol (MCP) implementation for connecting to and working with various database systems.
- SQLite
- PostgreSQL
- Microsoft SQL Server
- MongoDB
The MCP Database Server can be used in two modes:
By default, the server runs in SSE (Server-Sent Events) mode on port 3001:
This will start an HTTP server with an SSE endpoint athttp://localhost:3001/mcp.
You can specify a custom port using the--portoption:
For tools that communicate over standard input/output, you can use the--stdiooption:
You can integrate mcp-dbs with Claude Desktop by adding it to your Claude configuration file.
- Open or create your Claude Desktop configuration file
- Add the mcp-dbs configuration to themcpServerssection:
{ "mcpServers": { "mcp-dbs": { "command": "node", "args": [ "/path/to/your/mcp-dbs/dist/cli.js", "--stdio" ], "env": { "MCP_MONGODB_URI": "mongodb://localhost:27017", "MCP_MONGODB_DATABASE": "your-database-name" } } } }
Replace the environment variables with your own database connection details.
- Thecommandshould benode
- Inargs, provide the absolute path to the cli.js file in your mcp-dbs installation
- Configure the appropriate environment variables for your database type (see the environment variables section below)
- You can use environment variables for any of the supported databases (SQLite, PostgreSQL, SQL Server, or MongoDB)
Once configured, Claude will be able to access your database using the MCP tools described below. You can ask Claude to:
- Connect to your database
- Execute queries and get results
- Explore your database schema
- Work with tables and data
- connect-database: Connect to a database
- disconnect-database: Disconnect from a database
- execute-query: Execute a query and return results
- execute-update: Execute a query without returning results
- database-schema: Get the full database schema
- table-schema: Get the schema for a specific table
- tables-list: Get a list of all tables
Using environment variables for configuration
You can configure your database connections using environment variables:
# Set these environment variables before connecting export MCP_SQLITE_FILENAME="path/to/database.db" export MCP_SQLITE_CREATE_IF_NOT_EXISTS="true"
# Set these environment variables before connecting export MCP_POSTGRES_HOST="your-postgres-host" export MCP_POSTGRES_PORT="5432" export MCP_POSTGRES_DATABASE="your-database-name" export MCP_POSTGRES_USER="your-username" export MCP_POSTGRES_PASSWORD="your-password" export MCP_POSTGRES_SSL="false"
# Set these environment variables before connecting export MCP_MSSQL_SERVER="your-server-address" export MCP_MSSQL_PORT="1433" export MCP_MSSQL_DATABASE="your-database-name" export MCP_MSSQL_USER="your-username" export MCP_MSSQL_PASSWORD="your-password" export MCP_MSSQL_ENCRYPT="true" export MCP_MSSQL_TRUST_SERVER_CERTIFICATE="true"
# Set these environment variables before connecting export MCP_MONGODB_URI="mongodb://localhost:27017" export MCP_MONGODB_DATABASE="your-database-name" export MCP_MONGODB_MAX_POOL_SIZE="10" export MCP_MONGODB_USE_UNIFIED_TOPOLOGY="true"
These environment variables will take precedence over any configuration passed to the connect-database tool.
The server exposes the following MCP tools:
- connectionId: A unique identifier for the connection
- type: Database type (sqlite,postgres,mssql, ormongodb)
{ "connectionId": "my-sqlite-db", "type": "sqlite" }
{ "connectionId": "my-postgres-db", "type": "postgres" }
{ "connectionId": "my-mssql-db", "type": "mssql" }
{ "connectionId": "my-mongodb-db", "type": "mongodb" }
- connectionId: The connection ID to disconnect
- connectionId: The connection ID
- query: SQL query or MongoDB aggregation pipeline (as JSON string)
- params: (Optional) Array of parameters for the query. For MongoDB, the first parameter is the collection name.
{ "connectionId": "my-postgres-db", "query": "SELECT * FROM users WHERE age > $1", "params": [21] }
{ "connectionId": "my-mongodb-db", "query": "[{\"$match\": {\"age\": {\"$gt\": 21}}}, {\"$sort\": {\"name\": 1}}]", "params": ["users"] }
Example for MongoDB (new format with embedded collection):
{ "connectionId": "my-mongodb-db", "query": "{\"collection\": \"users\", \"pipeline\": [{\"$match\": {\"age\": {\"$gt\": 21}}}, {\"$sort\": {\"name\": 1}}]}" }
{ "connectionId": "my-mongodb-db", "query": "db.getCollection('users').find({\"age\": {\"$gt\": 21}})" }
Example for MongoDB (direct collection reference shell syntax):
{ "connectionId": "my-mongodb-db", "query": "db.users.find({\"age\": {\"$gt\": 21}})" }
{ "connectionId": "my-mongodb-db", "query": "{\"find\": \"users\", \"filter\": {\"age\": {\"$gt\": 21}}}" }
Execute a query that doesn't return results (INSERT, UPDATE, DELETE).
- connectionId: The connection ID
- query: SQL query or MongoDB command (as JSON string)
- params: (Optional) Array of parameters for the query. For MongoDB, the first parameter is the collection name.
{ "connectionId": "my-postgres-db", "query": "INSERT INTO users (name, age) VALUES ($1, $2)", "params": ["John Doe", 30] }
{ "connectionId": "my-mongodb-db", "query": "{\"insertOne\": {\"name\": \"John Doe\", \"age\": 30}}", "params": ["users"] }
Example for MongoDB (new format with embedded collection):
{ "connectionId": "my-mongodb-db", "query": "{\"collection\": \"users\", \"operation\": {\"insertOne\": {\"name\": \"John Doe\", \"age\": 30}}}" }
{ "connectionId": "my-mongodb-db", "query": "db.getCollection('users').insertOne({\"name\": \"John Doe\", \"age\": 30})" }
Example for MongoDB (direct collection reference shell syntax):
{ "connectionId": "my-mongodb-db", "query": "db.users.insertOne({\"name\": \"John Doe\", \"age\": 30})" }
{ "connectionId": "my-mongodb-db", "query": "{\"insert\": \"users\", \"documents\": [{\"name\": \"John Doe\", \"age\": 30}]}" }
The server exposes the following MCP resources:
Returns schema information about the database, including all tables and their columns.
URI:database://{connectionId}/tables/{tableName}
Returns schema information about a specific table, including its columns.
Returns a list of all tables in the database.
If you find this project helpful, consider buying me a coffee!
Scan the QR code above orclick hereto support the development of this project.
Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite
A single-binary MCP server for MySQL, MariaDB, PostgreSQL, and SQLite
A Model Context Protocol (MCP) server that provides multi-database query execution capabilities with support for SQLite, PostgreSQL, and MySQL databases. Includes a built-in Web UI for managing database connections.
Update various databases (PostgreSQL, MySQL, MongoDB, SQLite) using data from CSV and Excel files.
Enables AI assistants to interact with various databases through JDBC connections.
Production-grade Model Context Protocol (MCP) server for unified SQL database access. Connect multiple databases through a single MCP server with schema discovery, relationship mapping, caching, and safety controls.
Provides database access for SQLite, SQL Server, PostgreSQL, and MySQL.
Multi-database analysis MCP server (PostgreSQL, MySQL, SQLite). Inspects schemas, detects index problems, analyzes table bloat, and explains query plans for actionable database optimization.
A lightweight MCP server for any database with a JDBC driver. Built with Quarkus and requires Java 21+.
An MCP server that provides AI assistants with structured access to multiple databases simultaneously.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





