返回市场
MCP火鸟服务器

MCP火鸟服务器

作者:PuroDelphi36 星标更新:2025-11-19

项目介绍

Verified on MseeP

MCP Firebird

smithery badge

实现Anthropic的MCP(模型上下文协议)用于Firebird数据库。

使用示例

https://github.com/user-attachments/assets/e68e873f-f87b-4afd-874f-157086e223af

什么是MCP Firebird?

MCP Firebird是一个实现了Anthropic的MCP(模型上下文协议)的服务器,适用于Firebird SQL数据库。它允许大型语言模型(如Claude)安全且可控地访问、分析和操作Firebird数据库中的数据。

主要特性

  • SQL查询:在Firebird数据库上执行SQL查询
  • 模式分析:获取关于表、列和关系的详细信息
  • 数据库管理:执行备份、恢复和验证操作
  • 性能分析:分析查询性能并提出优化建议
  • 多种传输方式:支持STDIO、SSE(服务器发送事件)和可流式传输的HTTP传输
  • 现代协议支持:完全支持MCP可流式传输的HTTP(2025-03-26)和遗留SSE
  • 统一服务器:自动检测协议并兼容旧版
  • Claude集成:与Claude桌面和其他MCP客户端无缝工作
  • VSCode集成:与Visual Studio Code中的GitHub Copilot配合使用
  • 会话管理:强大的会话处理,包括自动清理和可配置超时
  • 安全性:包括SQL查询验证和安全配置选项
  • 双驱动支持:选择简单安装(默认)或支持线缆加密的本地驱动

🚀 快速开始使用Smithery(推荐用于云部署)

在5分钟内将MCP Firebird部署到云端!

smithery badge

Smithery是将MCP Firebird部署到生产环境最简单的方式:

一键部署 - 不需要基础设施设置 ✅ 自动扩展 - 自动处理流量高峰 ✅ 内置监控 - 跟踪使用情况和性能 ✅ 安全凭证 - 加密环境变量 ✅ 自动更新 - 始终运行最新版本 ✅ 全球CDN - 全球低延迟

如何在Smithery上部署

  1. 访问 smithery.ai
  2. 连接 您的GitHub账户
  3. 选择 mcpFirebird仓库
  4. 配置 您的Firebird数据库连接:
    host: "your-firebird-server.com"
    port: 3050
    database: "/path/to/database.fdb"
    user: "SYSDBA"
    password: "your-secure-password"
    useNativeDriver: true  # 启用线缆加密(可选)
    logLevel: "info"
    
  5. 点击部署 - 完成!✨

您的MCP Firebird服务器将在以下地址可用:

https://server.smithery.ai/your-username/mcp-firebird

与AI客户端一起使用

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(
  "https://server.smithery.ai/your-username/mcp-firebird"
);

const client = new Client({
  name: "my-ai-app",
  version: "1.0.0"
});

await client.connect(transport);

📚 详细的Smithery部署说明,请参阅 SMITHERY_DEPLOYMENT.md

🔒 线缆加密支持

MCP Firebird支持两种驱动选项

驱动安装线缆加密使用场景
纯JavaScript(默认)✅ 简单(npx❌ 无大多数用户,快速设置
本地驱动(可选)⚠️ 复杂(需要构建工具)✅ 有企业级,需要安全

快速开始(默认 - 无线缆加密)

npx mcp-firebird@alpha --database=/path/to/database.fdb

高级(支持线缆加密)

⚠️ 关键npx不适用于本地驱动。您必须全局安装。

⚠️ 重要:线缆加密必须在Firebird服务器firebird.conf)上配置,而不是客户端。

服务器配置(首先需要):

# 在服务器上的firebird.conf中
WireCrypt = Required  # 或Enabled

客户端安装(必须全局安装):

# 第一步:安装构建工具
# Windows:Visual Studio Build Tools (https://visualstudio.microsoft.com/downloads/)
# Linux:sudo apt-get install build-essential python3 firebird-dev
# macOS:xcode-select --install && brew install firebird

# 第二步:全局安装MCP Firebird
npm install -g mcp-firebird@alpha

# 第三步:全局安装本地驱动
npm install -g node-firebird-driver-native

# 第四步:直接运行(无需npx)
mcp-firebird --use-native-driver \
  --database=/path/to/database.fdb \
  --host=localhost \
  --user=SYSDBA \
  --password=masterkey

为什么不能使用npx?npx从其临时缓存运行一个包时,它无法访问全局安装的模块,如node-firebird-driver-native。两个包必须在同一位置全局安装。

📚 详细的安装说明,请参阅:

🖥️ 使用Smithery CLI进行本地安装

⭐ 推荐用于本地AI客户端(Claude桌面、Cursor等)

Smithery CLI提供了最简单的安装和配置MCP Firebird的方法,以供本地使用:

快速安装

# 交互式安装(提示配置)
npx -y @smithery/cli@latest install mcp-firebird --client claude

# 预配置安装(跳过提示)
npx -y @smithery/cli@latest install mcp-firebird --client claude --config '{
  "database": "/path/to/database.fdb",
  "user": "SYSDBA",
  "password": "masterkey",
  "useNativeDriver": false
}'

功能

  • 一键安装 - 不需要手动配置
  • 多个客户端 - 支持Claude桌面、Cursor等
  • 交互式设置 - 提示所有必需的设置
  • 自动配置 - 自动配置您的AI客户端
  • 轻松管理 - 列出、检查和卸载服务器

常用命令

# 列出已安装的服务器
npx @smithery/cli list servers --client claude

# 检查服务器配置
npx @smithery/cli inspect mcp-firebird

# 卸载服务器
npx @smithery/cli uninstall mcp-firebird --client claude

📖 完整指南: Smithery CLI安装指南

手动安装

稳定版本

# 全局安装(稳定版)
npm install -g mcp-firebird

# 运行服务器
npx mcp-firebird --database /path/to/database.fdb

# 或使用特定稳定版本
npm install -g mcp-firebird@2.2.3

稳定功能(v2.2.3):

  • 🐛 修复:SSE JSON解析错误 - 解决“无效消息:[object Object]”错误
  • ✨ 支持可流式传输的HTTP传输(MCP 2025-03-26)
  • 🔄 统一服务器,自动检测协议
  • 📊 增强的会话管理和监控
  • 🛠️ 现代MCP SDK集成(v1.13.2)
  • 🔧 改进的错误处理和日志记录
  • 🧪 包含9+项SSE功能测试的全面测试套件

Alpha版本(最新功能)

# 安装具有最新功能的Alpha版本
npm install -g mcp-firebird@alpha

# 或使用特定Alpha版本
npm install -g mcp-firebird@2.4.0-alpha.0

Alpha功能(v2.4.0-alpha.0):

  • 新功能:准备下一个开发周期
  • ✨ 包括v2.2.3的所有稳定功能
  • 🔄 统一服务器,自动检测协议
  • 📊 增强的会话管理和监控
  • 🛠️ 现代MCP SDK集成(v1.13.2)
  • 🔧 改进的错误处理和日志记录
  • 🧪 包含9+项SSE功能测试的全面测试套件
  • 📚 增强的文档,包括故障排除指南

注意:SSE JSON解析错误修复现在在稳定版v2.2.3中可用

对于备份/恢复操作,您需要安装Firebird客户端工具。详情请参阅完整安装

对于VSCode和GitHub Copilot集成,请参阅VSCode集成

基本使用

与Claude桌面一起使用

  1. 编辑Claude桌面配置:

    code $env:AppData\Claude\claude_desktop_config.json  # Windows
    code ~/Library/Application\ Support/Claude/claude_desktop_config.json  # macOS
    
  2. 添加MCP Firebird配置:

    {
      "mcpServers": {
        "mcp-firebird": {
          "command": "npx",
          "args": [
            "mcp-firebird",
            "--host",
            "localhost",
            "--port",
            "3050",
            "--database",
            "C:\\path\\to\\database.fdb",
            "--user",
            "SYSDBA",
            "--password",
            "masterkey"
          ],
          "type": "stdio"
        }
      }
    }
    
  3. 重启Claude桌面

传输配置

MCP Firebird支持多种传输协议,以适应不同的客户端需求和部署场景。

STDIO传输(默认)

STDIO传输是Claude桌面集成的标准方法:

{
  "mcpServers": {
    "mcp-firebird": {
      "command": "npx",
      "args": [
        "mcp-firebird",
        "--database", "C:\\path\\to\\database.fdb",
        "--user", "SYSDBA",
        "--password", "masterkey"
      ],
      "type": "stdio"
    }
  }
}

SSE传输(服务器发送事件)

SSE传输允许服务器作为Web服务运行,适用于Web应用程序和远程访问:

基本SSE配置

# 在默认端口3003启动SSE服务器
npx mcp-firebird --transport-type sse --database /path/to/database.fdb

# 自定义端口和完整配置
npx mcp-firebird \
  --transport-type sse \
  --sse-port 3003 \
  --database /path/to/database.fdb \
  --host localhost \
  --port 2050 \
  --user SYSDBA \
  --password masterkey

SSE环境变量配置

# 设置环境变量
export TRANSPORT_TYPE=sse
export SSE_PORT=3003
export DB_HOST=localhost
export DB_PORT=3050
export DB_DATABASE=/path/to/database.fdb
export DB_USER=SYSDBA
export DB_PASSWORD=masterkey

# 启动服务器
npx mcp-firebird

SSE客户端连接

一旦SSE服务器运行,客户端可以连接到:

  • SSE端点http://localhost:3003/sse
  • 消息端点http://localhost:3003/messages
  • 健康检查http://localhost:3003/health

可流式传输的HTTP传输(现代)

最新的MCP协议支持双向通信:

# 使用可流式传输的HTTP启动
npx mcp-firebird --transport-type http --http-port 3003 --database /path/to/database.fdb

统一传输(推荐)

同时支持SSE和可流式传输的HTTP协议,并自动检测:

# 启动统一服务器(支持SSE和可流式传输的HTTP)
npx mcp-firebird --transport-type unified --http-port 3003 --database /path/to/database.fdb

统一服务器端点

  • SSE(遗留)http://localhost:3003/sse
  • 可流式传输的HTTP(现代)http://localhost:3003/mcp
  • 自动检测http://localhost:3003/mcp-auto
  • 健康检查http://localhost:3003/health

配置示例

开发设置(SSE)

npx mcp-firebird \
  --transport-type sse \
  --sse-port 3003 \
  --database ./dev-database.fdb \
  --user SYSDBA \
  --password masterkey

生产设置(统一)

npx mcp-firebird \
  --transport-type unified \
  --http-port 3003 \
  --database /var/lib/firebird/production.fdb \
  --host db-server \
  --port 3050 \
  --user APP_USER \
  --password $DB_PASSWORD

Docker与SSE

docker run -d \
  --name mcp-firebird \
  -p 3003:3003 \
  -e TRANSPORT_TYPE=sse \
  -e SSE_PORT=3003 \
  -e DB_DATABASE=/data/database.fdb \
  -v /path/to/database:/data \
  purodelhi/mcp-firebird:latest

高级SSE配置

会话管理

配置会话超时和限制:

# 会话管理环境变量
export SSE_SESSION_TIMEOUT_MS=1800000    # 30分钟
export MAX_SESSIONS=1000                 # 最大并发会话数
export SESSION_CLEANUP_INTERVAL_MS=60000 # 每分钟清理一次

npx mcp-firebird --transport-type sse

CORS配置

对于Web应用程序,配置CORS设置:

# 允许特定来源
export CORS_ORIGIN="https://myapp.com,https://localhost:3000"
export CORS_METHODS="GET,POST,OPTIONS"
export CORS_HEADERS="Content-Type,mcp-session-id"

npx mcp-firebird --transport-type sse

SSL/TLS支持

对于生产部署,使用反向代理如nginx:

server {
    listen 443 ssl;
    server_name mcp-firebird.yourdomain.com;

    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;

    location / {
        proxy_pass http://localhost:3003;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

故障排除

Firebird连接问题

  1. 线缆加密不兼容(Firebird 3.0+) ⚠️ 关键

    错误请求的客户端和服务器之间的线缆加密级别不兼容

    重要node-firebird库不支持Firebird 3.0+的线缆加密。--wire-crypt参数不起作用。

    唯一解决方案:您必须禁用Firebird服务器上的线缆加密:

    对于Firebird 3.0,在firebird.conf中添加:

    WireCrypt = Disabled
    AuthServer = Srp, Legacy_Auth
    

    对于Firebird 4.0+,在firebird.conf中添加:

    WireCrypt = Disabled
    AuthServer = Srp256, Srp, Legacy_Auth
    

    对于Firebird 5.0 Docker:

    environment:
      FIREBIRD_CONF_WireCrypt: Disabled
      FIREBIRD_CONF_AuthServer: Srp256, Srp
    

    **如果您无法更改