Firebird MCP Server

io.github.lucasgabriel0802由 GitHub 帳號 lucasgabriel0802 發布v0.1.0更新於 Oct 24, 2026

Firebird (2.5 to 5.0) MCP server with PLAN inspection and multi-database routing

已驗證STDIO僅桌面資料庫資料與分析

概覽

AI 產生的概覽

本機 MCP 伺服器,讓 AI 助理連線 Firebird 2.5–5.0 資料庫,檢視結構、執行唯讀查詢、分析執行計畫並執行 DDL/DML。

可以做什麼
管理資料庫連線:建立與編輯 Firebird 連線目錄、列出資料庫、切換目前資料庫並重新載入設定,支援依專案篩選與自動探索專案設定檔。檢視結構與中繼資料:列出資料表、檢視表、預存程序與產生器,並檢視資料表的欄位、主外鍵與索引。分析效能:編譯查詢以取出執行計畫,標示全表掃描並建議索引。執行查詢:執行有列數上限的唯讀 SELECT 語句並立即提交交易。修改資料與結構:執行 INSERT、UPDATE、DELETE、預存程序呼叫與 DDL 語句,皆需明確的確認參數。
適用情境
適合助理需要在專案中處理 Firebird 資料庫的情境:探索不熟悉的資料表結構、排查查詢為何緩慢,或在開發與生產資料庫上草擬並執行 SQL。也適合單一工作區有多個 Firebird 資料庫、希望助理自動選擇正確資料庫的團隊。
執行需求
以 Python 套件(firebird-mcp)或 Docker 方式在本機透過 stdio 執行。需要透過網路以 TCP 存取 Firebird 伺服器(預設連接埠 3050)。資料庫憑證(主機、連接埠、資料庫路徑、使用者、密碼、字元集)保存在 JSON 設定檔中,可為使用者家目錄下的全域目錄或專案層級檔案;FIREBIRD_CONFIG_PATH 變數可指定明確的設定檔。
安裝前請注意
設定檔以明文保存資料庫密碼,且專案層級檔案優先於全域目錄。傳入確認參數後,伺服器可執行改資料與改結構的語句(INSERT、UPDATE、DELETE、預存程序呼叫、CREATE、ALTER、DROP),在生產環境執行前應核對語句並做好備份。唯讀限制僅適用於查詢工具。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Firebird MCP Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Firebird MCP Server 🔥

[License: MIT] [MCP Standard] [Python 3.10+] [Firebird 2.5 to 5.0] [M8ven Score]

🌐 Language / Idioma: English | Português (Brasil)

Open-source Model Context Protocol (MCP) server for Firebird Database, developed for free and independent community use with support for all major releases (Firebird 2.5, 3.0, 4.0, and 5.0).

Built according to the open industry standards for MCP servers (stdio / JSON-RPC 2.0), ensuring turnkey compatibility with any AI client or IDE: Google Antigravity IDE, Cursor, Claude Desktop, VS Code (with Cline / Roo Code / Copilot extensions), Windsurf, Zed, and CLI tools.


🎯 Key Highlights

  1. Pure Python Wire Protocol (Zero DLL Dependencies):
    • Connects directly over TCP (default port 3050) using pure Python (firebirdsql).
    • Requires no native C/C++ compilation and eliminates the need to install fbclient.dll (Windows) or libfbclient.so (Linux) on the host running the AI client or IDE.
    • Fully compatible with legacy authentication (Legacy_Auth in FB 2.5) as well as modern pluggable SRP authentication in FB 3.0, 4.0, and 5.0.
  2. Multi-Database Support per Project:
    • Allows a single project workspace to declare and manage multiple databases (e.g., main, audit_logs, staging), switching dynamically via chat prompts or tool arguments.
  3. Workspace Auto-Discovery (.firebird-mcp.json):
    • Automatically detects database configuration files placed at the root of your project or repository.
  4. Execution Plan & Performance Analysis (PLAN):
    • Compiles queries to extract the Firebird optimizer's execution plan (PLAN) without scanning entire datasets, detecting unindexed full-table scans (NATURAL SCAN) and memory/disk sorting bottlenecks (SORT).
  5. Strict Query Safety & MVCC Best Practices:
    • fb_query enforces read-only operations (SELECT), guarding against accidental data modification.
    • Commits read transactions immediately upon completion, preventing OAT (Oldest Active Transaction) stalls, garbage collection starvation, and runaway .fdb database file growth.
  6. Broad System Catalog Mapping:
    • Comprehensive introspection of Firebird system catalog tables (RDB$), supporting types across versions: BOOLEAN (FB3+), INT128, DECFLOAT(16/34), TIMESTAMP WITH TIME ZONE (FB4+), BLOB SUB_TYPE TEXT/BINARY, and index selectivity (RDB$STATISTICS).

🗄️ Multi-Database & Per-Project Configuration

Real-world production codebases (such as enterprise ERPs in Delphi, Laravel, or Python) frequently require:

  • Different databases per project/workspace.
  • Multiple databases within the same project (e.g., operational database ERP_DATA.FDB and audit trail AUDIT_LOGS.FDB).

Where and How to Configure Databases:

Firebird MCP provides two flexible organization patterns:

Option A (Recommended Default): Central Global Catalog (~/.firebird-mcp.json)

Instead of scattering .firebird-mcp.json files across every repository, maintain a single central catalog in your user home directory (~/.firebird-mcp.json on Linux/macOS or C:\Users\YourUser\.firebird-mcp.json on Windows).

In this catalog, you register all databases on your machine and use the "projects" property to specify which projects/repositories use each database:

json
{  "default": "erp_main",  "databases": {    "erp_main": {      "host": "localhost",      "port": 3050,      "database": "/var/data/ERP_DATA.FDB",      "user": "SYSDBA",      "password": "masterkey",      "charset": "WIN1252",      "description": "Primary ERP operational database",      "projects": ["web_projects", "erp-desktop"],      "tags": ["erp", "financial", "sales"]    },    "erp_audit": {      "host": "localhost",      "port": 3050,      "database": "/var/data/AUDIT_LOGS.FDB",      "user": "SYSDBA",      "password": "masterkey",      "charset": "WIN1252",      "description": "Secondary database for audit trails and logs",      "projects": ["web_projects", "erp-desktop"],      "tags": ["audit", "logs", "security"]    },    "pos_store": {      "host": "192.168.1.10",      "port": 3050,      "database": "C:\\POS\\STORE.FDB",      "user": "SYSDBA",      "password": "masterkey",      "charset": "WIN1252",      "description": "Store front checkout database",      "projects": ["pos-vcl"],      "tags": ["pos", "cashier"]    },    "shared_staging": {      "host": "localhost",      "port": 3050,      "database": "/data/STAGING.FDB",      "user": "SYSDBA",      "password": "masterkey",      "charset": "WIN1252",      "description": "Shared staging/test database accessible across all projects",      "projects": []    }  }}

Tip on Shared Databases: Databases with an empty "projects": [] array or "*" are treated as global shared databases and remain visible across all workspaces.

Option B: Local Project Configuration (.firebird-mcp.json)

If you prefer a repository to isolate its own credentials, place a .firebird-mcp.json file in the project root. The MCP checks for a local project file first; if present, it has absolute precedence over the global catalog.


How the Agent Interacts with Databases:

  1. Automatic Workspace Context (CWD):
    • When you open a workspace (e.g., /home/lucas/web_projects), the MCP automatically resolves the active project and filters databases matching that project.
    • Single Database in Project: The MCP auto-selects the database without asking unnecessary questions.
    • Multiple Databases in Project (e.g., main and audit): For generic commands (e.g., "run a select on orders"), the MCP halts and asks which database to use.
  2. Direct Investigation Targeting (Zero Friction):
    • If you mention the database in your prompt (e.g., "investigate bug on audit database" or "check table X on pos"), the agent/MCP resolves the alias immediately and connects without asking confirmation questions.
  3. Smart Approximate Search:
    • Switch databases using fb_use_database("audit") — the MCP matches exact names, substrings (e.g., erp_audit), and associated tags.
  4. ⚠️ Rigid Safety Rule: Mandatory Double Confirmation for DDL and Data Manipulation (DML):
    • Structural commands (CREATE, ALTER, DROP, RECREATE) and data mutation commands (INSERT, UPDATE, DELETE, EXECUTE PROCEDURE) are NEVER executed directly without prior explicit user consent.
    • The assistant must present the exact SQL/DDL statement, explain its technical purpose, detail the impact (affected rows/tables, lock risks, irreversibility), and request confirmation.
    • The MCP server blocks execution with an error unless the confirmed=True parameter is passed following the user's explicit affirmative response.

🛠️ Available MCP Tools

Database & Connection Management

ToolParametersDescription
fb_create_configdatabase, alias, host, port, user, password, charset, description, projects, tags, filepathCreates and saves Central Global Catalog (~/.firebird-mcp.json) or local file with project tags.
fb_list_databasesproject_filter (optional)Lists all databases in catalog, highlighting matches for the active project.
fb_use_databasealiasSwitches the active database for the current session (with smart match by name, substring, or tag).
fb_configure_databasealias, database, host, port, user, password, charset, description, projects, tags, set_as_default, save_to_fileRegisters or updates a connection with projects/tags dynamically and persists to file.
fb_reload_configconfig_path (optional)Reloads the catalog from global or local file.

Schema & Metadata Introspection

ToolParametersDescription
fb_list_tablesdb_alias (optional)Lists all user tables (filters out RDB$ system tables).
fb_list_viewsdb_alias (optional)Lists all registered user views.
fb_list_proceduresdb_alias (optional)Lists all user Stored Procedures.
fb_list_generatorsdb_alias (optional)Lists all user Generators / Sequences.
fb_inspect_tabletable_name, db_alias (optional)Returns column definitions, precise data types, PK/FK constraints, and indices with real selectivity (RDB$STATISTICS).

Performance Analysis & Execution

ToolParametersDescription
fb_explain_plansql, db_alias (optional)Compiles the query in the engine, extracts the PLAN, highlights NATURAL SCAN warnings, and suggests indexing strategies.
fb_querysql, limit (default 50, max 1000), db_alias (optional)Executes read-only SELECT queries with safety guards and immediate transaction commits.
fb_execute_dmlsql, db_alias (optional), confirmed (default false)Executes explicit INSERT, UPDATE, DELETE, or EXECUTE PROCEDURE statements. Requires mandatory double confirmation (confirmed=True).
fb_execute_ddlddl, db_alias (optional), confirmed (default false)Executes structural DDL statements (CREATE INDEX, ALTER TABLE, etc.) with explicit commit. Requires mandatory double confirmation (confirmed=True).
fb_database_healthdb_alias (optional)Audits database health via MON$ tables (ODS version, page size, active attachments, and OAT-to-Next-Transaction gap).

💻 Installation & Execution

🐳 Option 1: Docker (Gold Standard — Recommended for Windows, macOS & Linux)

Running via Docker eliminates all local Python runtime and dependency requirements:

bash
# Clone and build the image locally:git clone https://github.com/lucasgabriel0802/firebird-mcp.gitcd firebird-mcpdocker build -t firebird-mcp:latest .
Universal IDE Configuration via Docker (Stdio Mode):

Configure your IDE to launch the container on-demand. This configuration works seamlessly on Windows, macOS, and Linux:

json
{  "mcpServers": {    "firebird": {      "command": "docker",      "args": [        "run",        "-i",        "--rm",        "-v", "${workspaceFolder}:/workspace",        "-w", "/workspace",        "--add-host", "host.docker.internal:host-gateway",        "firebird-mcp:latest"      ]    }  }}

Why this is the Gold Standard:

  • -i: Keeps stdin/stdout open for JSON-RPC without allocating a pseudo-TTY (no -t to avoid byte corruption).
  • --rm: Cleans up the container automatically when the IDE closes.
  • -v "${workspaceFolder}:/workspace": Mounts your current project for automatic .firebird-mcp.json discovery.
  • --add-host host.docker.internal:host-gateway: Resolves your host machine's IP (e.g. Firebird running on port 3050 in Windows, macOS, or Linux) using host.docker.internal.

🚀 Option 2: Docker Compose (Background Service & Batteried Testing DB)

A. Run as an HTTP/SSE Background Service

If you prefer running the MCP server as a permanent background service on port 8000:

bash
docker compose up -d firebird-mcp

Connect via SSE endpoint: http://localhost:8000/sse.

B. Full Local Testing Environment (with Firebird 5.0 Database)

Spin up both the MCP server and a ready-to-test Firebird 5.0 database container:

bash
docker compose --profile test-db up -d

This starts:

  • Firebird 5.0 on localhost:3050 (password: masterkey, database: TESTE.FDB).
  • Firebird MCP Server on http://localhost:8000/sse.

🐍 Option 3: Local Python Virtual Environment

bash
git clone https://github.com/lucasgabriel0802/firebird-mcp.git ~/firebird-mcpcd ~/firebird-mcppython3 -m venv venvsource venv/bin/activate  # On Windows: venv\Scripts\activatepip install -r requirements.txtpip install -e .

⚙️ Universal Configuration for Any IDE

1. Google Antigravity IDE

In ~/.gemini/config/mcp_config.json (or workspace configuration):

Using Docker (via wrapper script or shell):

💡 Note: Antigravity IDE passes arguments literally and does not expand VS Code variables like ${workspaceFolder}. Use the repository's included docker-mcp.sh wrapper script:

Content of docker-mcp.sh (included in repository root):

bash
#!/usr/bin/env bashset -e
exec docker run -i --rm \  -v "${PWD}:/workspace" \  -w /workspace \  --add-host host.docker.internal:host-gateway \  firebird-mcp:latest "$@"

Ensure it is executable (chmod +x docker-mcp.sh) and reference it in your configuration:

json
{  "mcpServers": {    "firebird": {      "command": "/home/<userName>/firebird-mcp/docker-mcp.sh"    }  }}

Or using Python Virtual Environment:

json
{  "mcpServers": {    "firebird": {      "command": "/home/<userName>/firebird-mcp/venv/bin/python",      "args": ["-m", "firebird_mcp.server"],      "cwd": "${workspaceFolder}"    }  }}

2. Cursor

In .cursor/mcp.json at your project root or in Settings > Features > MCP:

json
{  "mcpServers": {    "firebird": {      "command": "docker",      "args": [        "run",        "-i",        "--rm",        "-v", "${workspaceFolder}:/workspace",        "-w", "/workspace",        "--add-host", "host.docker.internal:host-gateway",        "firebird-mcp:latest"      ]    }  }}

3. VS Code (Cline / Roo Code / Copilot MCP)

In cline_mcp_settings.json or Roo Code settings:

json
{  "mcpServers": {    "firebird": {      "command": "docker",      "args": [        "run",        "-i",        "--rm",        "-v", "${workspaceFolder}:/workspace",        "-w", "/workspace",        "--add-host", "host.docker.internal:host-gateway",        "firebird-mcp:latest"      ]    }  }}

4. Claude Desktop

In claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "firebird": {      "command": "python",      "args": ["-m", "firebird_mcp.server", "--config", "C:\\my_project\\.firebird-mcp.json"],      "cwd": "C:\\my_project"    }  }}

5. Windsurf

In ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "firebird": {      "command": "python3",      "args": ["-m", "firebird_mcp.server"],      "cwd": "${workspaceFolder}"    }  }}

6. Zed Editor

In Zed's settings.json:

json
{  "context_servers": {    "firebird": {      "command": {        "path": "python3",        "args": ["-m", "firebird_mcp.server"]      }    }  }}

🧠 Synergy: firebird-master Skill + firebird-mcp

This MCP server works hand-in-hand with the firebird-master skill:

┌────────────────────────────────────────────────────────┐│                   AI AGENT / COPILOT                   │├──────────────────────────┬─────────────────────────────┤│  SKILL: firebird-master  │     MCP: firebird-mcp       ││         (Brain)          │          (Muscle)           │├──────────────────────────┼─────────────────────────────┤│ • Cross-version syntax   │ • TCP socket wire protocol  ││   (FB 2.5 vs 3 vs 4 vs 5)│ • Executes & fetches PLAN   ││ • SQL anti-pattern rules │ • Introspects RDB$ schema   ││ • Delphi FireDAC best    │ • Gathers MON$ telemetry    ││   practices & index hints│ • Auto-discovers project DB │└──────────────────────────┴─────────────────────────────┘

⚖️ Disclaimer & Trademarks

  • Firebird: "Firebird" is a registered trademark of the Firebird Foundation. This is an independent open-source community project licensed under the MIT License and is not affiliated with, funded by, endorsed by, or officially associated with the Firebird Project or the Firebird Foundation.
  • Model Context Protocol: "Model Context Protocol" and "MCP" are trademarks of Anthropic, PBC. This project is an independent implementation compliant with open MCP standards.
  • Limitation of Liability: This software connects directly to database servers and executes queries or commands per user/agent instruction. Always maintain regular database backups and verify queries prior to execution on production environments. Under the terms of the MIT License, the software is provided "AS IS", without warranty of any kind, and the authors shall not be liable for any damages or data loss.

📄 License

Distributed under the MIT License.

來源:README.md,提交 036704e

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.0最新Oct 17, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分