mcp-confluent

Official
by confluentinc

Integrations

  • Allows configuration of Confluent Cloud credentials and endpoints through environment variables, supporting secure authentication with various Confluent services.

  • Enables AI assistants to interact with Confluent Cloud REST APIs, providing tools for managing Kafka topics, connectors, and Flink SQL statements through natural language interactions.

mcp-汇合

一个 MCP 服务器实现,使 AI 助手能够与 Confluent Cloud REST API 交互。该服务器允许 Claude Desktop 和 Goose CLI 等 AI 工具通过自然语言交互来管理 Kafka 主题、连接器和 Flink SQL 语句。

演示

Goose 命令行界面

克劳德桌面

目录

用户指南

入门

  1. **创建.env文件:**将示例.env文件结构(如下所示)复制到项目根目录中名为.env的新文件中。
  2. **填充.env文件:**填写 Confluent Cloud 环境所需的值。有关每个变量的详细信息,请参阅配置部分。
  3. 安装 Node.js (如果尚未安装)
    • 我们建议使用NVM (Node 版本管理器)来管理 Node.js 版本
    • 安装并使用 Node.js:
    nvm install 22 nvm use 22

配置

在项目的根目录中创建一个.env文件,其配置如下:

# .env file BOOTSTRAP_SERVERS="pkc-v12gj.us-east4.gcp.confluent.cloud:9092" KAFKA_API_KEY="..." KAFKA_API_SECRET="..." KAFKA_REST_ENDPOINT="https://pkc-v12gj.us-east4.gcp.confluent.cloud:443" KAFKA_CLUSTER_ID="" KAFKA_ENV_ID="env-..." FLINK_ENV_ID="env-..." FLINK_ORG_ID="" FLINK_REST_ENDPOINT="https://flink.us-east4.gcp.confluent.cloud" FLINK_ENV_NAME="" FLINK_DATABASE_NAME="" FLINK_API_KEY="" FLINK_API_SECRET="" FLINK_COMPUTE_POOL_ID="lfcp-..." CONFLUENT_CLOUD_API_KEY="" CONFLUENT_CLOUD_API_SECRET="" CONFLUENT_CLOUD_REST_ENDPOINT="https://api.confluent.cloud" SCHEMA_REGISTRY_API_KEY="..." SCHEMA_REGISTRY_API_SECRET="..." SCHEMA_REGISTRY_ENDPOINT="https://psrc-zv01y.northamerica-northeast2.gcp.confluent.cloud"

环境变量参考

多变的描述默认值必需的
引导服务器用于建立与 Kafka 集群的初始连接的 Kafka 代理地址列表,格式为 host1:port1,host2:port2(字符串)是的
配置路径用于存储和检索会话持久性的基于对话的配置的文件系统路径(未来实现)(字符串)是的
CONFLUENT_CLOUD_API_KEYConfluent Cloud 平台管理的主 API 密钥,用于管理整个组织的资源(字符串(最小值:1))是的
CONFLUENT_CLOUD_API_SECRET主 API 密钥与 CONFLUENT_CLOUD_API_KEY 配对,用于全面的 Confluent Cloud 平台管理(字符串(最小值:1))是的
FLINK_API_KEY用于访问 Confluent Cloud 的 Flink 服务的身份验证密钥,包括计算池和 SQL 语句管理(字符串(最小值:1))是的
FLINK_API_SECRET与 FLINK_API_KEY 配对的秘密令牌,用于对 Confluent Cloud 的 Flink 服务进行身份验证访问(字符串(最小值:1))是的
KAFKA_API_密钥与 Kafka 集群建立安全连接所需的身份验证凭证(用户名)(字符串(最小值:1))是的
KAFKA_API_SECRET与 KAFKA_API_KEY 配对的身份验证凭证(密码),用于安全的 Kafka 集群访问(字符串(最小值:1))是的
SCHEMA_REGISTRY_API_KEY用于访问 Schema Registry 服务以管理和验证数据模式的身份验证密钥(字符串(最小值:1))是的
SCHEMA_REGISTRY_API_SECRET与 SCHEMA_REGISTRY_API_KEY 配对的身份验证密钥,用于安全 Schema Registry 访问(字符串(最小值:1))是的
CONFLUENT_CLOUD_REST_ENDPOINTConfluent Cloud 的 REST API 服务的基本 URL(默认)
FLINK_COMPUTE_POOL_IDFlink 计算池的唯一标识符,必须以“lfcp-”前缀开头(字符串)
FLINK_DATABASE_NAME在 Flink SQL 操作中用作数据库引用的关联 Kafka 集群的名称(字符串(最小值:1))
FLINK_ENV_IDFlink 环境的唯一标识符,必须以“env-”前缀开头(字符串)
FLINK_ENV_NAME用于识别和显示目的的 Flink 环境的人类可读名称(字符串(最小值:1))
FLINK_ORG_IDConfluent Cloud 中用于 Flink 资源管理的组织标识符(字符串(最小值:1))
FLINK_REST_ENDPOINT用于 SQL 语句和计算池管理的 Confluent Cloud Flink REST API 端点的基本 URL(字符串)
KAFKA_CLUSTER_IDConfluent Cloud 生态系统中 Kafka 集群的唯一标识符(字符串(最小值:1))
KAFKA_ENV_IDKafka 集群的环境标识符,必须以“env-”前缀开头(字符串)
KAFKA_REST_ENDPOINTKafka 集群管理的 REST API 端点(字符串)
SCHEMA_REGISTRY_ENDPOINT用于访问 Schema Registry 服务以管理数据模式的 URL 端点(字符串)

用法

此 MCP 服务器设计用于与各种 MCP 客户端配合使用,例如 Claude Desktop 或 Goose CLI/Desktop。具体配置和交互方式取决于您使用的客户端。但一般步骤如下:

  1. **构建:**按照开发者指南中的说明从源代码构建并运行服务器。这通常涉及:
    • 安装依赖项( npm install
    • 构建项目( npm run buildnpm run dev
  2. **配置您的 MCP 客户端:**每个客户端都有其自身的方式来指定 MCP 服务器的地址和所需的凭据。您需要配置您的客户端(例如 Claude、Goose)以连接到该服务器运行的地址(可能是带有特定端口的localhost )。服务器运行的端口可以通过环境变量进行配置。
  3. **启动 MCP 客户端:**将客户端配置为连接到 MCP 服务器后,即可启动 MCP 客户端。启动时,它会在本地创建一个 MCP 服务器实例。该实例将负责管理数据模式并代表您与 Confluent Cloud 进行交互。
  4. **通过客户端与 Confluent 交互:**客户端连接后,您可以使用客户端界面与 Confluent Cloud 资源进行交互。客户端会向 MCP 服务器发送请求,然后 MCP 服务器会代表您与 Confluent Cloud 进行交互。

配置 Claude 桌面

有关安装 Claude Desktop 和 MCP 服务器的更多详细信息,请参阅此处

要配置 Claude Desktop 以使用此 MCP 服务器:

  1. 打开 Claude 桌面配置
    • 在 Mac 上: ~/Library/Application Support/Claude/claude_desktop_config.json
    • 在 Windows 上: %APPDATA%\Claude\claude_desktop_config.json
  2. 编辑配置文件
    • 在您喜欢的文本编辑器中打开配置文件
    • 使用以下方法之一添加或修改配置:
    { "mcpServers": { "confluent": { "command": "node", "args": [ "/path/to/confluent-mcp-server/dist/index.js", "--env-file", "/path/to/confluent-mcp-server/.env", ] } } }
    { "mcpServers": { "confluent": { "command": "npx", "args": [ "-y" "@confluentinc/mcp-confluent", "-e", "/path/to/confluent-mcp-server/.env" ] } } }

    /path/to/confluent-mcp-server/替换为您安装此 MCP 服务器的实际路径。

  3. 重启Claude桌面
    • 关闭并重新打开 Claude Desktop 以使更改生效
    • Claude Desktop 启动时,MCP 服务器将自动启动

现在,Claude Desktop 将配置为使用您的本地 MCP 服务器进行 Confluent 交互。

配置 Goose CLI

有关如何安装 Goose CLI 的详细说明,请参阅此处

安装后,请按照以下步骤操作:

  1. 运行配置命令:
    goose configure
  2. 按照交互式提示进行操作:
    • 选择Add extension
    • 选择Command-line Extension
    • 输入mcp-confluent作为扩展名称
    • 选择以下配置方法之一:
    node /path/to/confluent-mcp-server/dist/index.js --env-file /path/to/confluent-mcp-server/.env
    npx -y @confluentinc/mcp-confluent -e /path/to/confluent-mcp-server/.env

/path/to/confluent-mcp-server/替换为您安装此 MCP 服务器的实际路径。

开发者指南

项目结构

/ ├── src/ # Source code │ ├── confluent/ # Code related to Confluent integration (API clients, etc.) │ ├── tools/ # Tool implementations (each tool in a separate file) │ ├── index.ts # Main entry point for the server │ └── ... # Other server logic, utilities, etc. ├── dist/ # Compiled output (TypeScript -> JavaScript) ├── openapi.json # OpenAPI specification for Confluent Cloud ├── .env # Environment variables (example - should be copied and filled) ├── README.md # This file └── package.json # Node.js project metadata and dependencies

构建和运行

  1. 安装依赖项:
    npm install
  2. 开发模式(注意变化):
    npm run dev
    此命令将 TypeScript 代码编译为 JavaScript,并在src/目录中检测到更改时自动重建。
  3. 生产构建(一次性编译):
    npm run build
  4. 启动服务器:
    npm run start

测试

MCP 检查器

要测试 MCP 服务器,您可以使用MCP Inspector ,这是一个用于测试和调试 MCP 服务器的交互式开发工具。

# make sure you've already built the project either in dev mode or by running npm run build npx @modelcontextprotocol/inspector node $PATH_TO_PROJECT/dist/index.js --env-file $PATH_TO_PROJECT/.env

添加新工具

  1. 向枚举类ToolName添加一个新枚举。
  2. 将您的新工具添加到ToolFactory类中的处理程序映射中。
  3. 创建一个新文件,导出扩展BaseToolHandler类。
    1. 实现基类的handle方法。
    2. 实现基类的getToolConfig方法。
  4. 一旦满意,就将其添加到index.ts中的enabledTools集合中。

生成类型

# as of v7.5.2 there is a bug when using allOf w/ required https://github.com/openapi-ts/openapi-typescript/issues/1474. need --empty-objects-unknown flag to avoid it npx openapi-typescript ./openapi.json -o ./src/confluent/openapi-schema.d.ts --empty-objects-unknown

贡献

欢迎通过 Github Issues 提交 Bug 报告和反馈。贡献指南请参阅CONTRIBUTING.md

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

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.

为与 Confluent Kafka 和 Confluent Cloud REST API 交互而构建的 MCP 服务器实现。

  1. Demo
    1. Goose CLI
    2. Claude Desktop
  2. Table of Contents
    1. User Guide
      1. Getting Started
      2. Configuration
      3. Environment Variables Reference
      4. Usage
      5. Configuring Claude Desktop
      6. Configuring Goose CLI
    2. Developer Guide
      1. Project Structure
      2. Building and Running
      3. Testing
      4. Adding a New Tool
      5. Generating Types
      6. Contributing

    Related MCP Servers

    • -
      security
      A
      license
      -
      quality
      A lightweight MCP server that interacts with the Neon REST API, deployable on Cloudflare Workers for streamlined database management and integration.
      Last updated -
      5
      TypeScript
      MIT License
    • -
      security
      A
      license
      -
      quality
      A framework to use with AI to easily create a server for any service. Just drop the API Documentation in it and ask to create the MCP.
      Last updated -
      4
      TypeScript
      MIT License
    • A
      security
      F
      license
      A
      quality
      An MCP server implementation that enables interaction with the Unstructured API, providing tools to list, create, update, and manage sources, destinations, and workflows.
      Last updated -
      39
      25
      • Apple
    • -
      security
      F
      license
      -
      quality
      A remote MCP server implementation for Cloudflare that uses server-sent events (SSE) to enable Model Control Protocol communication.
      Last updated -
      TypeScript
      • Linux

    View all related MCP servers

    ID: 8zh4gg3sw9