Token导航 LogoToken导航

MCP Server · 数据服务

Mongodb Mysql Server

用于mysql和mongodb的mcp

stdio官方级别未说明来源级核验工具 14@smithery/cli
数据分析MongoDBMySQLClaude开发工具Claude DesktopCursor

快速开始

作者 / 组织
yaoxiaolinglong
提供方
yaoxiaolinglong
运行时
Node.js

工具数量

14

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

8

仓库热度

收录来源

3 个

MCP.so

选型结论

Mongodb Mysql Server 属于数据服务类 MCP Server,公开资料标注 14 个工具,通过stdio 本地进程接入,适配 Claude Desktop、Claude、Cursor,有可以直接复制的安装命令;接入前先确认权限范围。

分类

数据服务

传输方式

stdio

认证方式

无需认证

部署方式

公开资料未说明

安装与配置

安装命令

npx -y @smithery/cli install @yaoxiaolinglong/mcp-mongodb-mysql-server --client claude

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 14 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

MCP-MongoDB-MySQL-Server

这是一个基于 enemyrr/mcp-mysql-server 项目的二次开发版本,添加了MongoDB支持。 This is a fork of enemyrr/mcp-mysql-server with added MongoDB support.

项目简介 | Introduction

这是一个Model Context Protocol服务器,提供MySQL和MongoDB数据库操作功能。该服务器使AI模型能够通过标准化接口与MySQL和MongoDB数据库交互。

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为Claude Desktop自动安装MySQL/MongoDB数据库服务器:

To install MySQL/MongoDB Database Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @yaoxiaolinglong/mcp-mongodb-mysql-server --client claude

手动安装 | Installing Manually

  1. 克隆并构建项目 | Clone and build the project:
git clone https://github.com/yaoxiaolinglong/mcp-mongodb-mysql-server.git
cd mcp-mongodb-mysql-server
npm install
npm run build
  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

您可以通过以下三种方式配置MySQL数据库连接:

You can configure the MySQL database connection in three ways:

  1. .env文件中的数据库URL(推荐)| Database URL in .env (Recommended):
DATABASE_URL=mysql://user:password@host:3306/database
  1. .env文件中的单独参数 | Individual Parameters in .env:
DB_HOST=localhost
DB_USER=your_user
DB_PASSWORD=your_password
DB_DATABASE=your_database
  1. 通过工具直接连接 | Direct Connection via Tool:
use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "connect_db",
  arguments: {
    url: "mysql://user:password@host:3306/database"
    // 或者 | OR
    workspace: "/path/to/your/project" // 将使用项目的.env文件 | Will use project's .env
    // 或者 | OR
    host: "localhost",
    user: "your_user",
    password: "your_password",
    database: "your_database"
  }
});

MongoDB配置 | MongoDB Configuration

您可以通过以下三种方式配置MongoDB数据库连接:

You can configure the MongoDB database connection in three ways:

  1. .env文件中的MongoDB URL(推荐)| MongoDB URL in .env (Recommended):
MONGODB_URI=mongodb://user:password@host:27017/database
MONGODB_DATABASE=your_database
  1. 通过工具直接连接 | Direct Connection via Tool:
use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "connect_mongodb",
  arguments: {
    url: "mongodb://user:password@host:27017/database"
    // 或者 | OR
    workspace: "/path/to/your/project" // 将使用项目的.env文件 | Will use project's .env
    // 或者 | OR
    database: "your_database" // 将使用默认连接URI | Will use default connection URI
  }
});

可用工具 | 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.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "query",
  arguments: {
    sql: "SELECT * FROM users WHERE id = ?",
    params: [1]
  }
});
3. execute

执行INSERT、UPDATE或DELETE查询,支持可选的预处理语句参数。

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

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "execute",
  arguments: {
    sql: "INSERT INTO users (name, email) VALUES (?, ?)",
    params: ["John Doe", "john@example.com"]
  }
});
4. list_tables

列出连接的数据库中的所有表。

List all tables in the connected database.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "list_tables"
});
5. describe_table

获取特定表的结构。

Get the structure of a specific table.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "describe_table",
  arguments: {
    table: "users"
  }
});
6. create_table

创建一个新表,指定字段和索引。

Create a new table with specified fields and indexes.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "create_table",
  arguments: {
    table: "users",
    fields: [
      {
        name: "id",
        type: "int",
        autoIncrement: true,
        primary: true
      },
      {
        name: "email",
        type: "varchar",
        length: 255,
        nullable: false
      }
    ],
    indexes: [
      {
        name: "email_idx",
        columns: ["email"],
        unique: true
      }
    ]
  }
});
7. add_column

向现有表添加新列。

Add a new column to an existing table.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "add_column",
  arguments: {
    table: "users",
    field: {
      name: "phone",
      type: "varchar",
      length: 20,
      nullable: true
    }
  }
});

MongoDB工具 | MongoDB Tools

1. connect_mongodb

连接到MongoDB数据库,使用URL、工作区路径或数据库名称。

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

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "connect_mongodb",
  arguments: {
    url: "mongodb://user:password@host:27017/database"
  }
});
2. mongodb_list_collections

列出连接的MongoDB数据库中的所有集合。

List all collections in the connected MongoDB database.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "mongodb_list_collections"
});
3. mongodb_find

在MongoDB集合中查找文档,支持可选的过滤器、限制、跳过和排序。

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

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "mongodb_find",
  arguments: {
    collection: "users",
    filter: { age: { $gt: 18 } },
    limit: 10,
    skip: 0,
    sort: { name: 1 }
  }
});
4. mongodb_insert

向MongoDB集合中插入文档。

Insert documents into a MongoDB collection.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "mongodb_insert",
  arguments: {
    collection: "users",
    documents: [
      { name: "John Doe", email: "john@example.com", age: 30 },
      { name: "Jane Smith", email: "jane@example.com", age: 25 }
    ]
  }
});
5. mongodb_update

更新MongoDB集合中的文档。

Update documents in a MongoDB collection.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "mongodb_update",
  arguments: {
    collection: "users",
    filter: { name: "John Doe" },
    update: { $set: { age: 31 } },
    many: false // 只更新一个文档(默认)| Update only one document (default)
  }
});
6. mongodb_delete

从MongoDB集合中删除文档。

Delete documents from a MongoDB collection.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "mongodb_delete",
  arguments: {
    collection: "users",
    filter: { name: "John Doe" },
    many: false // 只删除一个文档(默认)| Delete only one document (default)
  }
});
7. mongodb_create_collection

在MongoDB中创建新集合。

Create a new collection in MongoDB.

use_mcp_tool({
  server_name: "mysql-mongodb",
  tool_name: "mongodb_create_collection",
  arguments: {
    collection: "new_collection",
    options: { capped: true, size: 1000000 }
  }
});

功能特点 | 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

服务器提供以下详细错误消息:| The server provides detailed error messages for:

  • 连接失败 | Connection failures
  • 无效的查询或参数 | Invalid queries or parameters
  • 缺少配置 | Missing configuration
  • 数据库错误 | Database errors
  • 架构验证错误 | Schema validation errors

贡献 | Contributing

欢迎贡献!请随时提交Pull Request到 https://github.com/yaoxiaolinglong/mcp-mongodb-mysql-server

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

致谢 | Acknowledgements

本项目基于 enemyrr/mcp-mysql-server 开发,感谢原作者的贡献。

This project is based on enemyrr/mcp-mysql-server. Thanks to the original author for their contribution.

许可证 | License

MIT

工具与能力

工具数量

14

资源数量

0

提示词数量

0

能力标签

developer-toolsmcpmongodbmysqldatabaseserver数据库管理JavaScript

支持客户端

Claude DesktopClaudeCursor

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

用自然语言查库

不用手写 SQL,直接问数据,让模型组织查询语句。

数据巡检

定期拉指标、做对比,把异常项整理成一段说明。

打通业务数据

把数据库、数仓和接口接进同一个上下文,减少导出再上传。

选择建议

值得选的地方

  • 工具数量 14 个,一次接入能覆盖的操作比单点工具更全。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已经适配 Claude Desktop、Claude、Cursor,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好 Node.js,换机器要重新装一遍。
  • 公开摘要偏短,具体能力和限制要回到仓库确认。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在数据服务场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Mongodb Mysql Server

MCP.so · 本页

14stdio有3 个2026-05-17
Memory 9d25f64e

MCP World

9未说明未标注1 个2026-05-17
Prisma MCP Server

MCP World

0stdio有3 个2026-05-17
Astr Bot

MCP World

0stdio有1 个2026-05-17
Getzep MCP

MCP World

9stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Mongodb Mysql Server 怎么安装?

公开资料给出的安装命令是 npx -y @smithery/cli install @yaoxiaolinglong/mcp-mongodb-mysql-server --client claude,运行环境为 Node.js。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Mongodb Mysql Server 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 Node.js;保存后完全退出客户端再打开,配置才会生效。

Mongodb Mysql Server 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Mongodb Mysql Server 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Mongodb Mysql Server 支持哪些客户端?

公开资料标注支持 Claude Desktop、Claude、Cursor;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP