Database Server

by ahmetbarut

Not rated
GitHub

About

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.

Details

Author
ahmetbarut
Categories
Database, Other

Setup

Install Database Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/ahmetbarut/mcp-database-server

Follow the installation instructions in the repository README, then restart your MCP client.

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.

Available on NPM:@ahmetbarut/mcp-database-server

# Use with npx (no installation required) npx @ahmetbarut/mcp-database-server # Or install globally npm install -g @ahmetbarut/mcp-database-server

- Multi-Database Support: SQLite, PostgreSQL, and MySQL with real connections
- Web UI: Built-in browser interface for managing database connections
- SQLite Config Store: All connection configs persisted locally in~/.mcp-database-server/connections.db
- MCP Protocol Compliance: Full JSON-RPC implementation with complete tool support
- Smart Auto-Detection: Automatically selects single active connection for queries
- Connection Recovery: Retry failed connections with detailed error reporting
- Security First: Parameterized queries, SQL injection protection, audit logging
- SSL Support: Configurable SSL per connection
- Type Safety: Full TypeScript implementation with Zod validation
- Node.js v23 Compatible: Works with latest Node.js versions

Server starts and Web UI opens athttp://localhost:3693. Add your database connections from the browser.

The built-in Web UI provides a visual interface for managing database connections:

- Add/Edit/Deletedatabase connections (SQLite, PostgreSQL, MySQL)
- Test connectionsbefore saving
- SSL togglefor network databases
- Persistent storage— connections survive server restarts

Access it athttp://localhost:3693when the server is running.

Add to yourclaude_desktop_config.json:

{ "mcpServers": { "database": { "command": "npx", "args": ["-y", "@ahmetbarut/mcp-database-server"] } } }
{ "mcpServers": { "database": { "command": "npx", "args": ["-y", "@ahmetbarut/mcp-database-server"] } } }
{ "mcpServers": { "database": { "command": "npx", "args": ["-y", "@ahmetbarut/mcp-database-server"], "env": { "WEB_UI_PORT": "4000" } } } }

After starting, open the Web UI in your browser to add database connections.

Execute SQL queries on a database connection with parameterized query support.

{ "connection_name": "my-postgres", "query": "SELECT * FROM users WHERE status = $1", "parameters": ["active"] }

List databases from a specific connection or all configured connections. Supports smart auto-detection when only one connection is active.

{ "connection_name": "my-postgres" }

List all database connections with status and details.

{ "include_credentials": false }
{ "connection_name": "my-postgres" }

All database connections are managed through theWeb UIand stored in a local SQLite database at~/.mcp-database-server/connections.db.

- Host, port, database, username, password
- SSL support (optional)

- Host, port, database, username, password
- SSL support (optional)

# Clone the repository git clone https://github.com/ahmetbarut/mcp-database-server.git cd mcp-database-server # Install dependencies npm install # Development mode (hot-reload) npm run dev # Build npm run build # Run tests npm test # Run tests with coverage npm run test:coverage # Lint npm run lint # Type check npm run type-check
mcp-database-server/ ├── src/ │ ├── index.ts # CLI entry point │ ├── server/ │ │ └── mcp-server.ts # MCP server, tool handlers │ ├── database/ │ │ ├── base.ts # Abstract base driver │ │ ├── factory.ts # Driver factory & connection manager │ │ └── drivers/ # SQLite, PostgreSQL, MySQL drivers │ ├── config/ │ │ ├── settings.ts # Config manager (loads from SQLite store) │ │ └── config-store.ts # SQLite-backed connection storage │ ├── web/ │ │ ├── web-server.ts # HTTP server for Web UI │ │ ├── routes.ts # REST API endpoints │ │ └── ui.ts # Embedded HTML/CSS/JS interface │ ├── types/ # TypeScript types & Zod schemas │ └── utils/ # Logger, exceptions, helpers ├── tests/unit/ # Jest test suites └── dist/ # Compiled output
npx @ahmetbarut/mcp-database-server │ ├── MCPDatabaseServer │ ├── MCP stdio transport (JSON-RPC) │ ├── DatabaseConnectionManager │ └── WebUIServer (http://localhost:3693) │ └── ConnectionConfigStore (~/.mcp-database-server/connections.db) └── SQLite database with connection configs

- Config Storeloads saved connections from local SQLite DB
- Connection Managerinitializes database drivers for each config
- MCP Serverexposes tools via JSON-RPC over stdio
- Web UIprovides browser-based CRUD for connections via REST API

- Parameterized queries— prevents SQL injection
- Credential masking— passwords hidden inlist_connectionsoutput
- Audit logging— all operations logged via Winston
- Input validation— Zod schemas for all configuration

Test Suites: 2 passed, 2 total Tests: 23 passed, 23 total
npm test # Run all tests npm run test:watch # Watch mode npm run test:coverage # Coverage report

- Check if port 3693 is already in use
- Try a different port:WEB_UI_PORT=4000

- Use the "Test Connection" button in Web UI before saving
- Verify database server is running and accessible
- Check credentials and network connectivity
- For PostgreSQL: disable SSL if server doesn't support it

- Ensurenpx @ahmetbarut/mcp-database-serverruns without errors
- Restart the MCP client after config changes
- Check MCP client logs for error details

MIT License - see LICENSE file for details.
- Follow TypeScript coding standards
- Add tests for new functionality
- Update documentation for API changes
- Follow security guidelines

For issues and questions, use theGitHub issue tracker.

Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite

A single-binary MCP server for MySQL, MariaDB, PostgreSQL, and SQLite

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.

ORMCP provides a curated, object-oriented, MCP-compliant view of relational data in any JDBC-compliant database (e.g., PostgreSQL, MySQL, Oracle, SQL Server, DB2, SQLite) — improving reasoning clarity, reducing token usage, and establishing a clear governance boundary.

Interact with PostgreSQL, MySQL, MariaDB, and SQLite databases using SQLAlchemy.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.