db_mcp

Provides MCP access to MySQL, Redis, and MongoDB with configurable security modes and preconfigured connections.
  • typescript

1

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months 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": {
    "wannanbigpig-db-mcp": {
      "command": "node",
      "args": [
        "/path/to/db-mcp/dist/index.js"
      ],
      "env": {
        "DB_MCP_CONFIG_PATH": "/path/to/config.json",
        "DB_MCP_SECURITY_MODE": "read_only"
      }
    }
  }
}

db-mcp is a Model Context Protocol server that connects to and queries MySQL, Redis, and MongoDB databases. It lets you run common database operations through a unified MCP interface, enabling you to query data, manage records, and run administrative commands from MCP-enabled clients.

How to use

You run the db-mcp server locally or remotely and connect to it from any MCP client. Once connected, you can perform read queries, write operations, and administrative actions against MySQL, Redis, and MongoDB databases through the MCP APIs exposed by the server. Use the client to issue commands that map to database operations, such as querying data, inserting documents, updating records, or executing SQL statements. You can switch between databases, run complex queries, and leverage security modes to restrict or permit certain actions.

How to install

Prerequisites you must have before installing db-mcp include Node.js and a package manager.

# Clone the repository
git clone git@github_pig:wannanbigpig/db-mcp.git
cd db-mcp

# Install dependencies
npm install

# Build the project
npm run build

Validation after building involves starting the server in development mode or running the built file directly.

# Development mode (for testing)
npm run dev

# Or run the built file directly
node dist/index.js

Security and configuration

You can configure safety levels and predefine database connections. Security is controlled via the DB_MCP_SECURITY_MODE environment variable or a dedicated tooling option. You can start with read_only to allow only queries, restricted to permit some modifications, or full_access to allow all operations.

Predefined connections can be set up by copying a sample configuration file and editing it with your database connection details. The configuration file supports MySQL, Redis, and MongoDB connection settings.

Troubleshooting

If you encounter issues during install or runtime, check your Node.js version is at least 18.0.0, clean and reinstall dependencies if needed, and verify that the compiled artifacts exist in the dist directory.

Developer tips

Development tasks include installing dependencies, building, and running in development or watch modes to observe changes. Use npm run dev for development server startup and npm run build to generate production-ready artifacts.

Available tools

mysql_connect

Connect to MySQL with optional connection pooling, providing host, port, user, password, and database name.

mysql_query

Execute SQL statements against MySQL, including queries and DDL statements.

mysql_insert

Insert data into a MySQL table using a structured data object and parameterized queries.

mysql_update

Update MySQL records with a data object and a WHERE filter.

mysql_delete

Delete MySQL records using a WHERE filter.

mysql_pool_status

Query the status of the MySQL connection pool if pooling is enabled.

redis_connect

Connect to a Redis instance with host, port, password, and database index.

redis_get

Retrieve a value by key from Redis.

redis_set

Set a value for a Redis key with optional TTL.

redis_keys

Find Redis keys matching a pattern.

redis_del

Delete a Redis key.

mongodb_connect

Connect to a MongoDB instance with a URL and database name.

mongodb_find

Find documents in a MongoDB collection with filters, sorting, skip and limit.

mongodb_find_one

Find a single document in a MongoDB collection.

mongodb_insert_one

Insert a single document into a MongoDB collection.

mongodb_insert_many

Insert multiple documents into a MongoDB collection.

mongodb_update_one

Update a single document in a MongoDB collection.

mongodb_delete_one

Delete a single document from a MongoDB collection.

mongodb_count

Count documents in a collection matching a filter.

mongodb_list_collections

List all collections in the connected database.

mongodb_disconnect

Disconnect from MongoDB.

set_security_mode

Set the MCP security mode (read_only / restricted / full_access).

get_security_mode

Get the current MCP security mode.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
db_mcp MCP Server - wannanbigpig/db-mcp | VeilStrat