CouchDB MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Supports configuration through environment variables that can be stored in a .env file for CouchDB connection settings.

  • Provides specific configuration path information for Claude Desktop integration on macOS systems.

  • Serves as the runtime environment for the MCP server, with version 14 or higher required as a prerequisite.

CouchDB-MCP-服务器

用于与 CouchDB 交互的模型上下文协议服务器

这是一个基于 TypeScript 的 MCP 服务器,提供管理 CouchDB 数据库和文档的工具。它使 AI 助手能够通过简单的界面与 CouchDB 进行交互。

特征

工具

基础工具(所有 CouchDB 版本)

  • createDatabase创建一个新的 CouchDB 数据库
    • dbName作为必需参数
    • 如果数据库不存在则创建它
  • listDatabases - 列出所有 CouchDB 数据库
    • 返回数据库名称数组
  • deleteDatabase - 删除 CouchDB 数据库
    • dbName作为必需参数
    • 删除指定的数据库及其所有文档
  • createDocument创建新文档或更新数据库中的现有文档
    • 必需参数:
      • dbName :数据库名称
      • docId :文档 ID
      • data :文档数据(JSON对象)
        • 对于更新,请在_rev字段中包含当前文档修订版本
    • 返回:
      • 对于新文档:文档 ID 和新修订版本
      • 对于更新:文档 ID 和更新的修订版本
    • 根据_rev字段的存在自动检测操作是创建还是更新
  • getDocument从数据库中获取文档
    • 必需参数:
      • dbName :数据库名称
      • docId :文档 ID
    • 返回文档内容

Mango 查询工具(仅限 CouchDB 3.x+)

  • createMangoIndex创建一个新的 Mango 索引
    • 必需参数:
      • dbName :数据库名称
      • indexName :索引的名称
      • fields :要索引的字段名称数组
    • 创建新索引以实现高效查询
  • deleteMangoIndex - 删除 Mango 索引
    • 必需参数:
      • dbName :数据库名称
      • designDoc :设计文档名称
      • indexName :索引的名称
    • 删除现有的 Mango 索引
  • listMangoIndexes - 列出数据库中的所有 Mango 索引
    • 必需参数:
      • dbName :数据库名称
    • 返回数据库中所有索引的信息
  • findDocuments - 使用 Mango 查询来查询文档
    • 必需参数:
      • dbName :数据库名称
      • query :Mango 查询对象
    • 使用 CouchDB 的 Mango 查询语法执行查询

版本支持

服务器自动检测 CouchDB 版本并启用相应的功能:

  • 所有版本:基本数据库和文档操作
  • CouchDB 3.x+:Mango 查询支持(索引和查询)

配置

服务器需要 CouchDB 连接 URL 和版本信息。您可以通过环境变量提供这些信息:

COUCHDB_URL=http://username:password@localhost:5984 COUCHDB_VERSION=1.7.2 You can create a `.env` file in the project root with this configuration. If not provided, it defaults to `http://localhost:5984`. ## Development Install dependencies: ```bash npm install

构建服务器:

npm run build

对于使用自动重建的开发:

npm run watch

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 coachdb-mcp-server:

npx -y @smithery/cli install @robertoamoreno/couchdb-mcp-server --client claude

要与 Claude Desktop 一起使用,请添加服务器配置:

在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "couchdb-mcp-server": { "command": "/path/to/couchdb-mcp-server/build/index.js", "env": { "COUCHDB_URL": "http://username:password@localhost:5984" } } } }

先决条件

  • Node.js 14 或更高版本
  • 运行 CouchDB 实例
  • 如果启用了身份验证,则需要正确的 CouchDB 凭据

调试

由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们推荐使用MCP Inspector ,它以包脚本的形式提供:

npm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

错误处理

该服务器包括针对常见场景的强大错误处理功能:

  • 数据库名称或文档 ID 无效
  • 数据库已存在/不存在
  • 连接问题
  • 身份验证失败
  • 无效的文档数据

所有错误均经过正确格式化并通过 MCP 协议返回相应的错误代码和消息。

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

基于 TypeScript 的 MCP 服务器,使 AI 助手能够通过简单的界面与 CouchDB 数据库交互,提供创建、读取和查询数据库和文档的工具。

  1. Features
    1. Tools
  2. Version Support
    1. Configuration
      1. Installation
        1. Installing via Smithery
        2. Prerequisites
        3. Debugging
      2. Error Handling
        ID: n2dyvn3v83