SQL
- typescript
0
GitHub Stars
typescript
Language
3 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"soumya7681-sql-mcp-server": {
"command": "npm",
"args": [
"run",
"start:mcp"
]
}
}
}You run a multi-database MCP server that exposes SQL database connectivity for SQLite, MySQL, PostgreSQL, and SQL Server. It lets you open and manage multiple connections, execute parameterized queries, inspect schemas, and handle errors gracefully, all through a consistent MCP interface.
How to use
You interact with this server through an MCP client to create and manage database connections, run queries, and inspect schemas. Start by connecting to a database you want to work with, using the appropriate connection type and parameters. Once a connection is established, you can execute SQL queries with optional parameters, fetch results, and handle errors with clear messages. You can also list all active connections and disconnect from any that you no longer need.
How to install
Prerequisites you need before installation are Node.js 18 or newer and a functioning package manager.
Install dependencies for the project.
Build the project.
Configuration and usage notes
This server supports multiple database types with dedicated connection parameters. Use the following configuration examples as guides for each database type.
SQLite requires a file path for the database and does not require host, port, username, or password. The database file will be created if it does not exist.
Example Connections
{
"connectionId": "my-sqlite",
"type": "sqlite",
"database": "myapp",
"filename": "./data/myapp.db"
}
SQLite
For SQLite, provide the filename of the database file. Other connection fields such as host, port, username, and password are not required.
MySQL
MySQL uses the default port 3306 and supports SSL. It relies on the mysql2 driver for Promise-based operations.
PostgreSQL
PostgreSQL uses the default port 5432 and supports SSL connections. Development can use rejectUnauthorized: false. It uses the pg driver.
SQL Server (MSSQL)
SQL Server uses the default port 1433, supports SSL encryption, and you can use trustServerCertificate: true for self-signed certificates. It uses the mssql driver.
Error handling
The server provides descriptive errors for connection failures, query errors, invalid connection IDs, unsupported database types, and schema inspection issues.
Project structure
src/
├── index.ts # Main server entry point
├── DatabaseManager.ts # Database connection and query management
├── handlers.ts # Tool call handlers
├── tools.ts # Tool definitions
└── types.ts # TypeScript type definitions
Requirements
Node.js 18+ and TypeScript 5+ are required, along with the database drivers for the chosen database types.
License and contribution
MIT licensed. Contributions are welcome.
Available tools
connect_database
Opens a new database connection using the specified parameters for a supported database type (sqlite, mysql, postgresql, mssql).
execute_query
Runs a SQL query against a connected database with optional parameters for parameterized queries.
get_table_schema
Retrieves schema information for tables, including table names and column details.
list_connections
Lists all currently active database connections.
disconnect_database
Disconnects from a specified active database connection.