Token导航 LogoToken导航TokenDH.com
Mong Tap logo
AI代理stdio官方级别未说明来源级核验

Mong Tap

MCP Server

MongTap是一款基于统计建模的MongoDB兼容服务器,允许LLMs通过自然语言创建、查询和管理数据库,无需实际数据存储。

工具数

8

提示词数

0

GitHub Stars

2

资源数

0
JavaScriptClaudeAI代理Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

smallmindsco

提供方

smallmindsco

最后核验

2026/5/17 20:28

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MongTap - 用于大型语言模型(LLMs)的MongoDB MCP服务器

YouTube上的演示视频:

![Watch the video](https://youtu.be/Uv4nM2C9qoc)

SmallMinds有限责任公司

MongTap是一个模型上下文协议(MCP)服务器,它通过统计建模提供与MongoDB兼容的数据库功能。它使得像Claude这样的大型语言模型(LLM)能够使用自然语言创建、查询和管理数据库,而无需实际的数据存储。

仓库(或存储库): \ 网站smallminds.co 翻译成中文可以是“小智域”(注:这里的“smallminds”直译为“小头脑”,但为了更符合中文网站域名的命名习惯,我将其意译为“小智域”,表示一个专注于智慧或小知识分享的平台或社区)。不过,具体的翻译可能还需要根据该网站的实际内容和定位来调整\ 联系andrew@smallminds.co(可译为:“安德鲁@小智公司邮箱”,但具体翻译可能需根据“smallminds.co”的实际含义调整,这里假设其为“小智公司”的简写)

特点/特性

  • 🚀 表情符号“🚀”通常表示火箭、快速上升或急速前进,可以翻译为“🚀(火箭/快速上升)”。不过,在实际语境中,这个表情符号往往被用来表达兴奋、期待或快速进展的情绪,所以也可以根据具体情境翻译为“🚀(兴奋/期待)”或“🚀(快速进展)”。 MongoDB 传输协议 - 与MongoDB驱动程序和工具完全兼容
  • 🧠 代表“大脑”或“思考”的意思。 统计建模 - 使用DataFlood技术实时生成逼真数据
  • 🔧(扳手,表示修理或工具的意思) MCP集成 - 与Claude Desktop及其他MCP兼容的大型语言模型(LLM)无缝协作
  • 📊 表格/数据图表 自然语言 - 根据描述或样本数据训练模型
  • ⚡(闪电符号,无具体文字含义,常用于表示速度、活力或电力等) 高性能 - 每秒生成20,000多份文档
  • 🎯(瞄准靶心) 零存储 - 数据是通过统计生成的,而非存储的

进一步的文件/文档

安装

先决条件

  • Node.js 20多个版本
  • Claude Desktop(用于MCP集成)
  • 无需安装MongoDB!

快速入门

  1. 克隆仓库:
git clone https://github.com/smallmindsco/MongTap.git
cd MongTap
  1. 安装依赖项(最少):
npm install
  1. 测试安装:
node src/mcp/index.js
  1. 启动 MongoDB 服务器(可选):
node start-mongodb-server.js

Claude 桌面配置

要在Claude Desktop中使用MongTap,您需要将其配置为MCP服务器。

1. 定位Claude桌面配置

找到您的Claude桌面配置文件:

  • macOS(发音:/ˈmækɒs/,中文常译为“麦奥斯”或直接使用原名“macOS”): ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows%APPDATA%\Claude\claude_desktop_config.json
  • Linux~/.config/Claude/claude_desktop_config.json

2. 将MongTap添加到配置中

编辑配置文件并将MongTap添加到 mcpServers 部分/章节:

{
  "mcpServers": {
    "mongtap": {
      "command": "node",
      "args": [
        "/absolute/path/to/MongTap/src/mcp/index.js"
      ],
      "env": {
        "NODE_ENV": "production",
        "LOG_LEVEL": "info"
      }
    }
  }
}

重要的替换 /absolute/path/to/MongTap 替换为您的MongTap安装的实际路径。

3. 重启Claude桌面应用

保存配置后,重启Claude桌面应用以使更改生效。

在Claude桌面版中使用MongTap

配置完成后,MongTap 提供了强大的数据库操作和数据生成工具。

快速参考

工具目的关键特性
generateDataModel创建统计模型根据样本或描述
startMongoServer启动 MongoDB 服务器完全支持线协议
stopMongoServer停止服务器实例清理关闭
listActiveServers查看运行中的服务器监控所有实例
queryModel生成文档$seed和$entropy控制
trainModel改进模型增量学习
listModels查看可用模型本地模型库存
getModelInfo模型详情模式和统计信息

MCP 工具参考

1. 生成数据模型

描述根据样本文档或文本描述创建统计模型以生成数据。

参数

  • name (必填):模型的名称
  • description (可选):对数据结构的自然语言描述
  • samples (可选):用于训练模型的样本文档数组

示例

generateDataModel({
  name: "users",
  description: "User profiles with name, email, age, and signup date"
})
// OR with samples
generateDataModel({
  name: "products",
  samples: [
    { name: "Laptop", price: 999, category: "Electronics" },
    { name: "Desk", price: 299, category: "Furniture" }
  ]
})

2. 启动MongoDB服务器

描述启动一个本地兼容MongoDB的服务器,该服务器从统计模型中生成数据。

参数

  • port (可选):要监听的端口(0 表示自动分配,默认:27017)
  • database (可选):默认数据库名称(默认:“mcp”)

示例

startMongoServer({ port: 27017, database: "myapp" })
// Returns: { port: 27017, status: "running" }

3. 停止MongoDB服务器

描述通过端口号停止正在运行的MongoDB兼容服务器实例。

参数:

  • port (必需):要停止的服务器端口

示例

stopMongoServer({ port: 27017 })
// Returns: { success: true, message: "Server stopped" }

4. 列出活动服务器

描述获取当前所有正在运行的MongoDB兼容服务器实例的列表。

参数

示例:

listActiveServers()
// Returns: { count: 2, servers: [
//   { port: 27017, database: "test", status: "running", uptime: 3600 },
//   { port: 27018, database: "dev", status: "running", uptime: 1800 }
// ]}

5. 查询模型

描述从统计模型中生成文档,可选择查询过滤器和生成控制。

参数:

  • model (必填):要查询的模型名称
  • query (可选):使用特殊参数的MongoDB风格查询:

- $seed可重复生成的编号 - $entropy数字0-1用于控制随机性水平

  • count (可选):要生成的文档数量(默认:10)

示例:

queryModel({
  model: "users",
  query: { age: { $gte: 18 }, $seed: 42, $entropy: 0.3 },
  count: 5
})
// Returns 5 consistently generated adult users with low randomness

6. 训练模型

描述使用额外的样本文档更新现有的统计模型,以提高生成质量。

参数

  • model (必填):要训练的模型名称
  • documents (必需):用于训练的文档数组

示例:

trainModel({
  model: "products",
  documents: [
    { name: "Mouse", price: 29, category: "Electronics" },
    { name: "Chair", price: 199, category: "Furniture" }
  ]
})
// Returns: { success: true, samplesAdded: 2, totalSamples: 4 }

7. 列出模型(或“模型列表”)

描述获取本地存储的所有可用统计模型的列表。

参数

示例

listModels()
// Returns: ["users", "products", "orders", "inventory"]

8. 获取模型信息(getModelInfo)

描述检索特定统计模型的详细模式和统计数据。

参数

  • model (必填):模型名称

示例:

getModelInfo({ model: "users" })
// Returns: {
//   name: "users",
//   schema: { type: "object", properties: { ... } },
//   sampleCount: 100,
//   lastUpdated: "2025-01-15T10:30:00Z",
//   fields: ["name", "email", "age", "signupDate"]
// }

MCP 提示

MongTap 包含针对常见数据库场景的预构建提示:

1. 创建电子商务数据库

描述创建一个包含产品、客户和订单的完整电子商务数据库。

使用方法/用途请Claude“使用create_ecommerce_db提示”来即时搭建一个完整的电子商务数据库结构。

2. 创建用户资料

描述创建一个包含认证和偏好设置的用户资料模型。

用法非常适合快速建立用户管理系统。

3. 分析模型

描述分析现有模型,并提供关于其结构的见解。

使用方法理解你的统计模型中的模式和分布。

4. 代际控制(或称为“世代控制”)

描述了解如何使用 $seed 和 $entropy 参数进行受控生成。

使用方法获取有关可重复且受控的数据生成的详细信息。

MCP Resources(公司名,可译为“MCP资源公司”或根据具体语境保留原名)

MongTap 提供只读资源用于监控:

1. 模型://列表

描述所有训练好的DataFlood模型列表\ 类型应用/JSON(或:JSON格式的应用)\ 回报模型名称和元数据的数组

2. servers://status(服务器状态)

描述所有MongoDB服务器的状态\ 类型: application/json(译为中文可表述为):JSON应用(或JSON数据格式)\ 退货服务器端口、数据库和连接数

3. 模型路径:{name}/schema

描述获取特定模型的JSON模式\ 类型application/json(JSON数据格式)\ 退货完整的JSON Schema定义

4. 模型路径:{name}/示例

描述从模型中获取样本数据\ 类型application/json\ 退货样本文件数组

5. 文档://生成控制

描述关于 $seed 和 $entropy 查询参数的文档说明\ 类型text/markdown 翻译为中文是:Markdown 文本\ 退货详细的使用指南

与克劳德的示例对话

根据描述创建数据模型

You: Create a data model for a user profile with name, email, age, and registration date.

Claude: I'll create a user profile model for you using MongTap.

[Uses generateDataModel tool]

I've created a user profile model with the following structure:
- name (string)
- email (string, email format)
- age (integer, 0-120)
- registrationDate (string, date-time format)

The model is now ready to generate realistic user data.

启动MongoDB服务器

You: Start a MongoDB server for my application on port 27017.

Claude: I'll start a MongoDB server for you.

[Uses startMongoServer tool]

MongoDB server started successfully:
- Port: 27017
- Database: test
- Connection string: mongodb://localhost:27017/test

You can now connect to this server using any MongoDB client or driver.

The server supports advanced generation control through $seed and $entropy parameters in queries.

生成示例数据

You: Generate 100 user profiles from the model we created.

Claude: I'll generate 100 user profiles for you.

[Uses queryModel tool]

Generated 100 user profiles. Here's a sample:
1. { name: "John Smith", email: "john.smith@example.com", age: 28, registrationDate: "2024-01-15T10:30:00Z" }
2. { name: "Jane Doe", email: "jane.doe@example.com", age: 34, registrationDate: "2024-02-20T14:45:00Z" }
...

All documents follow the statistical patterns of your model.

基于样本数据的训练

You: Here are some product samples. Train a model from them:
- { name: "Widget", price: 19.99, category: "tools", stock: 100 }
- { name: "Gadget", price: 29.99, category: "electronics", stock: 50 }
- { name: "Gizmo", price: 39.99, category: "tools", stock: 75 }

Claude: I'll train a product model from your samples.

[Uses generateDataModel tool with samples]

Model trained successfully! The model learned:
- name: product names (string patterns)
- price: range 19.99-39.99 (number distribution)
- category: "tools" or "electronics" (enum)
- stock: range 50-100 (integer distribution)

The model can now generate similar products with realistic variations.

与MongoDB客户端建立连接

MongTap服务器与MongoDB客户端完全兼容。一旦您通过Claude启动了服务器:

使用 MongoDB Shell(mongosh)

mongosh "mongodb://localhost:27017/test"

使用 Node.js 的 MongoDB 驱动程序

const { MongoClient } = require('mongodb');

async function connect() {
    const client = new MongoClient('mongodb://localhost:27017');
    await client.connect();
    
    const db = client.db('test');
    const collection = db.collection('users');
    
    // Insert triggers model training
    await collection.insertMany([
        { name: 'Alice', age: 30 },
        { name: 'Bob', age: 25 }
    ]);
    
    // Find generates data from the model
    const users = await collection.find({}).toArray();
    console.log(users); // Statistically generated users
    
    // Use generation control parameters
    const consistentData = await collection.find({
        $seed: 12345,  // Consistent results
        $entropy: 0.5  // Moderate randomness
    }).toArray();
    
    await client.close();
}

使用Python(pymongo)

from pymongo import MongoClient

client = MongoClient('mongodb://localhost:27017/')
db = client['test']
collection = db['users']

# Insert trains the model
collection.insert_many([
    {'name': 'Alice', 'age': 30},
    {'name': 'Bob', 'age': 25}
])

# Find generates from the model
for user in collection.find():
    print(user)  # Statistically generated users
    
# Use generation control
for user in collection.find({'$seed': 12345, '$entropy': 0.3}):
    print(user)  # Consistent, low-entropy generation

高级用法

多个服务器实例

您可以同时运行多个MongoDB服务器:

You: Start three MongoDB servers for development, testing, and staging environments.

Claude: I'll start three separate MongoDB servers for you.

[Uses startMongoServer multiple times]

Started 3 MongoDB servers:
1. Development - Port: 27017, Database: dev
2. Testing - Port: 27018, Database: test  
3. Staging - Port: 27019, Database: staging

Each server maintains its own models and can be accessed independently.

模型持久化

模型会自动保存,并且可以在不同会话中重复使用:

You: List all available models.

Claude: [Uses listModels tool]

Available models:
1. users - User profiles with name, email, age
2. products - Product catalog with pricing
3. orders - Order management system
4. customers - Customer database

You can query any of these models or train new ones.

受限生成

生成具有特定约束和控制参数的数据:

You: Generate 50 users aged between 25 and 35 with consistent results using seed 12345.

Claude: I'll generate users with those specific constraints and seed control.

[Uses queryModel with constraints and generation parameters]

Generated 50 users with consistent results:
- All aged between 25-35  
- Using seed 12345 for reproducible generation
- $entropy parameter controls randomness level
- Same query will always return identical results

配置选项

环境变量

  • LOG_LEVEL - 日志级别(错误、警告、信息、调试、追踪)
  • MONGTAP_PORT - MCP服务器的默认端口(默认:3000)
  • MONGTAP_STORAGE - 模型存储路径(默认:./welldb-models)
  • MONGTAP_MAX_SERVERS - 最大并发 MongoDB 服务器数(默认:10)

MCP服务器模式

MCP服务器可以在不同的模式下运行:

# Standard I/O mode (for Claude Desktop)
node src/mcp/index.js

# TCP mode (for network access)
node src/mcp/index.js tcp --port 3000

# Standalone mode (for testing)
node src/mcp/index.js standalone

建筑学

MongTap由三个主要部分组成:

  1. DataFlood-JS - 从样本中学习的统计建模引擎
  2. WellDB-Node - MongoDB 二进制协议实现
  3. MCP服务器 - 大语言模型(LLM)工具的集成层
┌─────────────────┐     MCP Protocol      ┌──────────────┐
│ Claude Desktop  │ ◄──────────────────► │  MCP Server  │
└─────────────────┘                       └──────┬───────┘
                                                 │
                                                 ▼
┌─────────────────┐     MongoDB Wire     ┌──────────────┐
│ MongoDB Client  │ ◄──────────────────► │ WellDB-Node  │
└─────────────────┘                       └──────┬───────┘
                                                 │
                                                 ▼
                                          ┌──────────────┐
                                          │ DataFlood-JS │
                                          │  (Modeling)  │
                                          └──────────────┘

故障排除

Claude Desktop 不显示 MongTap 工具

  1. 检查配置文件路径是否正确
  2. 确保MongTap的路径是绝对路径,而非相对路径
  3. 完全重启Claude桌面版
  4. 检查日志: tail -f ~/Library/Logs/Claude/mcp-*.log (macOS)

MongoDB 客户端无法连接

  1. 验证服务器是否正在运行:在Claude中使用“listActiveServers”命令
  2. 检查端口是否未被使用: lsof -i :27017
  3. 确保防火墙允许本地连接
  4. 尝试使用IP地址连接: mongodb://127.0.0.1:27017

模型生成似乎不正确

  1. 提供更多的样本数据以进行更好的训练
  2. 在样本中使用一致的数据格式
  3. 检查模型信息以查看学习到的模式
  4. 如有需要,可使用额外约束进行重新训练

发展

运行测试

# Run all tests
npm test

# Run specific test suite
node test/mcp/test-mcp-server.js
node test/welldb-node/test-mongodb-server.js
node test/dataflood-js/test-inferrer.js

# Run integration tests
node test/welldb-node/test-integration.js

项目结构

MongTap/
├── src/
│   ├── mcp/                 # MCP server implementation
│   │   ├── mcp-server.js    # Core MCP server
│   │   ├── prompt-analyzer.js # NLP for prompts
│   │   └── server-manager.js # Multi-server management
│   ├── welldb-node/         # MongoDB protocol
│   │   ├── server/          # MongoDB server implementation
│   │   └── storage/         # DataFlood storage adapter
│   └── dataflood-js/        # Statistical modeling
│       ├── schema/          # Schema inference
│       ├── generator/       # Document generation
│       └── training/        # Model training
└── README.md               # This file

许可证

MIT 许可证 - 请参阅 许可证 详情请查阅文件。

隐私政策

MongTap的设计以隐私为核心原则:

数据收集

  • 不收集个人数据 - MongTap不收集任何用户数据
  • 无分析或追踪功能 - 未收集使用统计数据
  • 无外部连接 - 所有操作均在本地进行
  • 没有数据持久性 - 模型是统计表示,而非实际数据

数据存储

  • 所有模型均存储在您本地的机器上
  • 存储位置可通过(相应系统/工具)进行完全配置 mongtap.config.json
  • 未使用任何云服务或外部存储
  • 生成的数据是合成的,并不代表真实信息

数据安全

  • 仅本地操作确保数据永不离开您的机器
  • 无需认证(无需凭证,因此不存在凭证泄露风险)
  • 开源代码允许进行全面的安全审计
  • 输入验证可防止注入攻击

安全

MongTap 实施全面的安全措施:

  • 输入验证所有输入在处理前均经过验证
  • 错误处理优雅的错误处理可防止信息泄露
  • 无外部依赖核心功能具有最小的依赖性
  • 本地操作除非明确配置,否则不会暴露在网络中
  • 开源为安全审计提供完整的代码透明度

如需详细的安全信息,请参阅 docs/SECURITY_AUDIT.md 翻译为中文是:文档/安全审计.md

支持

致谢

  • 用于统计建模的DataFlood技术
  • 用于协议规范的MongoDB
  • 针对MCP协议的Anthropic(注:此处“Anthropic”可能指某个特定技术、协议或框架的名称,根据上下文具体翻译,若“Anthropic”本身为专有名词且无特定中文译名,则可保留原样或根据具体情境意译为“针对MCP协议的\[某特定技术/方案\]”)
  • 用于大型语言模型(LLM)集成的Claude桌面版

______________________________________________________________________

MongTap 生成的是统计数据,并不存储实际数据。它非常适合开发、测试和演示等场景,这些场景需要真实数据,但又不希望承担实际存储的开销。

目录标签

目录标签

JavaScriptClaudeAI代理MongoDB兼容本地部署自然语言数据库统计建模LLM集成零存储

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

8

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiononelocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

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

仍需确认:installCommand

来源信息

继续浏览同类 MCP