mongodb-mysql database.com
mongodb-mysql database.com logo

MongoDB-MySQL Database

Provides a unified interface for MySQL and MongoDB operations, enabling seamless interaction with both database systems...

Created byApr 23, 2025

MCP-MongoDB-MySQL-Server

[![GitHub stars](https://img.shields.io/github/stars/yaoxiaolinglong/mcp-mongodb-mysql-server?style=social)](https://github.com/yaoxiaolinglong/mcp-mongodb-mysql-server/stargazers) [![GitHub forks](https://img.shields.io/github/forks/yaoxiaolinglong/mcp-mongodb-mysql-server?style=social)](https://github.com/yaoxiaolinglong/mcp-mongodb-mysql-server/network/members) [![GitHub license](https://img.shields.io/github/license/yaoxiaolinglong/mcp-mongodb-mysql-server)](https://github.com/yaoxiaolinglong/mcp-mongodb-mysql-server/blob/main/LICENSE) [![Smithery](https://smithery.ai/badge/@yaoxiaolinglong/mcp-mongodb-mysql-server)](https://smithery.ai/server/@yaoxiaolinglong/mcp-mongodb-mysql-server)
[enemyrr/mcp-mysql-server](https://github.com/enemyrr/mcp-mysql-server) MongoDB This is a fork of [enemyrr/mcp-mysql-server](https://github.com/enemyrr/mcp-mysql-server) with added MongoDB support.

| Introduction

A Model Context Protocol server that provides MySQL and MongoDB database operations. This server enables AI models to interact with MySQL and MongoDB databases through a standardized interface.

| About This Fork

** | Author**: yaoxiaolinglong
** | Reason for Fork**: MySQL MongoDB MongoDB MCP MongoDB MySQL MongoDB
The original project only supports MySQL database, but MongoDB is often needed in practical applications. Due to the lack of ready-made MongoDB MCP tools, MongoDB support was added to the original project, making it a database server that supports both MySQL and MongoDB.

| Installation & Setup for Cursor IDE

Smithery | Installing via Smithery

[Smithery](https://smithery.ai/server/@yaoxiaolinglong/mcp-mongodb-mysql-server) Claude Desktop MySQL/MongoDB
To install MySQL/MongoDB Database Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@yaoxiaolinglong/mcp-mongodb-mysql-server):

| Installing Manually

  1. | Clone and build the project:
  1. Cursor IDE | Add the server in Cursor IDE settings:
  • (Cmd/Ctrl + Shift + P) | Open Command Palette (Cmd/Ctrl + Shift + P)
  • "MCP: Add Server" | Search for "MCP: Add Server"
  • | Fill in the fields: - | Name: `mysql-mongodb` - | Type: `command` - | Command: `node /absolute/path/to/mcp-mongodb-mysql-server/build/index.js`
** | Note**: `/absolute/path/to/` Replace `/absolute/path/to/` with the actual path where you cloned and built the project.

| Database Configuration

MySQL | MySQL Configuration

You can configure the MySQL database connection in three ways:
  1. **.env URL | Database URL in .env (Recommended)**:
  1. **.env | Individual Parameters in .env**:
  1. ** | Direct Connection via Tool**:

MongoDB | MongoDB Configuration

You can configure the MongoDB database connection in three ways:
  1. **.env MongoDB URL | MongoDB URL in .env (Recommended)**:
  1. ** | Direct Connection via Tool**:

| Available Tools

MySQL | MySQL Tools

1. connect_db

MySQL URL
Connect to MySQL database using URL, workspace path, or direct credentials.

2. query

SELECT
Execute SELECT queries with optional prepared statement parameters.

3. execute

INSERT UPDATE DELETE
Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.

4. list_tables

List all tables in the connected database.

5. describe_table

Get the structure of a specific table.

6. create_table

Create a new table with specified fields and indexes.

7. add_column

Add a new column to an existing table.

MongoDB | MongoDB Tools

1. connect_mongodb

MongoDB URL
Connect to MongoDB database using URL, workspace path, or database name.

2. mongodb_list_collections

List all collections in the connected MongoDB database.

3. mongodb_find

MongoDB
Find documents in a MongoDB collection with optional filter, limit, skip, and sort.

4. mongodb_insert

MongoDB
Insert documents into a MongoDB collection.

5. mongodb_update

MongoDB
Update documents in a MongoDB collection.

6. mongodb_delete

MongoDB
Delete documents from a MongoDB collection.

7. mongodb_create_collection

MongoDB
Create a new collection in MongoDB.

| Features

  • URL | Multiple connection methods (URL, workspace, direct)
  • MySQL MongoDB | Support for both MySQL and MongoDB databases
  • | Secure connection handling with automatic cleanup
  • MySQL | Prepared statement support for MySQL query parameters
  • | Schema management tools for both databases
  • | Comprehensive error handling and validation
  • TypeScript | TypeScript support
  • | Automatic workspace detection

| Security

  • MySQL SQL | Uses prepared statements to prevent SQL injection in MySQL
  • | Supports secure password handling through environment variables
  • | Validates queries and operations before execution
  • | Automatically closes connections when done

| Error Handling

  • | Connection failures
  • | Invalid queries or parameters
  • | Missing configuration
  • | Database errors
  • | Schema validation errors

| Contributing

Contributions are welcome! Please feel free to submit a Pull Request to https://github.com/yaoxiaolinglong/mcp-mongodb-mysql-server

| Acknowledgements

This project is based on [enemyrr/mcp-mysql-server](https://github.com/enemyrr/mcp-mysql-server). Thanks to the original author for their contribution.

| License

MIT