Firebird MCP Server
Firebird MCP Server lets an AI client connect to Firebird databases (2.5–5.0) over pure-Python TCP and explore, query, and safely modify them across multiple per-project databases.
Database & connection management — create/register connection configs in a global or local catalog (
fb_create_config,fb_configure_database), list databases by project (fb_list_databases), switch the active database with fuzzy matching (fb_use_database), and reload config (fb_reload_config).Schema & metadata introspection — list tables, views, stored procedures, and generators (
fb_list_tables/views/procedures/generators), and deep-inspect a table's columns, exact types, PK/FK, indexes, and real selectivity (fb_inspect_table).Performance analysis — compile a query and extract its Firebird execution
PLAN, flaggingNATURAL SCANfull-table scans andSORTbottlenecks with indexing suggestions (fb_explain_plan).Read-only querying — run guarded
SELECTs with row limits of 1–1000 and immediate transaction commits to avoid OAT stalls and file bloat (fb_query).Data & structure changes with mandatory double confirmation — execute
INSERT/UPDATE/DELETE/EXECUTE PROCEDURE(fb_execute_dml) and DDL likeCREATE/ALTER/DROP/RECREATE(fb_execute_ddl), both blocked unlessconfirmed=Trueafter explicit user approval.Health & telemetry diagnostics — audit ODS version, page size, active attachments, and the OAT-to-Next-Transaction gap via
MON$tables (fb_database_health).Multi-database, per-project workflows — auto-discover
.firebird-mcp.json, resolve project-scoped and shared databases, and prompt only when a project has multiple ambiguous databases.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Firebird MCP Server explain plan for SELECT * FROM INVOICES WHERE CUSTOMER_ID = 42"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Firebird MCP Server 🔥
🌐 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
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) orlibfbclient.so(Linux) on the host running the AI client or IDE.Fully compatible with legacy authentication (
Legacy_Authin FB 2.5) as well as modern pluggable SRP authentication in FB 3.0, 4.0, and 5.0.
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.
Workspace Auto-Discovery (
.firebird-mcp.json):Automatically detects database configuration files placed at the root of your project or repository.
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).
Strict Query Safety & MVCC Best Practices:
fb_queryenforces 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
.fdbdatabase file growth.
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).
Related MCP server: MCP Database Manager
🗄️ 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.FDBand audit trailAUDIT_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:
{
"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:
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.
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.
Smart Approximate Search:
Switch databases using
fb_use_database("audit")— the MCP matches exact names, substrings (e.g.,erp_audit), and associated tags.
⚠️ 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=Trueparameter is passed following the user's explicit affirmative response.
🛠️ Available MCP Tools
Database & Connection Management
Tool | Parameters | Description |
|
| Creates and saves Central Global Catalog ( |
|
| Lists all databases in catalog, highlighting matches for the active project. |
|
| Switches the active database for the current session (with smart match by name, substring, or tag). |
|
| Registers or updates a connection with projects/tags dynamically and persists to file. |
|
| Reloads the catalog from global or local file. |
Schema & Metadata Introspection
Tool | Parameters | Description |
|
| Lists all user tables (filters out |
|
| Lists all registered user views. |
|
| Lists all user Stored Procedures. |
|
| Lists all user Generators / Sequences. |
|
| Returns column definitions, precise data types, PK/FK constraints, and indices with real selectivity ( |
Performance Analysis & Execution
Tool | Parameters | Description |
|
| Compiles the query in the engine, extracts the |
|
| Executes read-only |
|
| Executes explicit |
|
| Executes structural DDL statements ( |
|
| Audits database health via |
💻 Installation & Execution
🐳 Option 1: Docker (Gold Standard — Recommended for Windows, macOS & Linux)
Running via Docker eliminates all local Python runtime and dependency requirements:
# Clone and build the image locally:
git clone https://github.com/lucasgabriel0802/firebird-mcp.git
cd firebird-mcp
docker 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:
{
"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-tto avoid byte corruption).
--rm: Cleans up the container automatically when the IDE closes.
-v "${workspaceFolder}:/workspace": Mounts your current project for automatic.firebird-mcp.jsondiscovery.
--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) usinghost.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:
docker compose up -d firebird-mcpConnect 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:
docker compose --profile test-db up -dThis 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
git clone https://github.com/lucasgabriel0802/firebird-mcp.git ~/firebird-mcp
cd ~/firebird-mcp
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
pip 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 includeddocker-mcp.shwrapper script:
Content of docker-mcp.sh (included in repository root):
#!/usr/bin/env bash
set -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:
{
"mcpServers": {
"firebird": {
"command": "/home/<userName>/firebird-mcp/docker-mcp.sh"
}
}
}Or using Python Virtual Environment:
{
"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:
{
"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:
{
"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.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.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:
{
"mcpServers": {
"firebird": {
"command": "python3",
"args": ["-m", "firebird_mcp.server"],
"cwd": "${workspaceFolder}"
}
}
}6. Zed Editor
In Zed's settings.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.
Available Tools
15 toolsfb_configure_databaseC
Cadastra ou atualiza um banco de dados dinamicamente no catálogo (global ou local). Permite associar o banco a projetos específicos (projects=['web_projects']) e tags para filtragem contextual.
Inputs: alias (required), database (required), host, port, +8 more.
fb_create_configC
Cria e salva um novo arquivo de configuração (Catálogo Central Global ~/.firebird-mcp.json por padrão). Permite associar o banco a projetos específicos (ex: projects=['web_projects']) e tags.
Inputs: database (required), host, port, tags, +7 more.
fb_database_healthA
Diagnostica a integridade e telemetria do banco Firebird através das tabelas MON$:
Versão do Engine e ODS
Tamanho de página (Page Size) e sweep interval
Diagnóstico do gap OAT (Oldest Active Transaction) vs Next Transaction para prevenção de inchaço do .fdb
Total de conexões ativas, transações e statements abertos. Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: db_alias.
fb_execute_ddlA
Executa comandos estruturais DDL no Firebird (CREATE, ALTER, DROP, RECREATE, etc.) com commit explícito.
REGRA RÍGIDA DE SEGURANÇA — DUPLA CONFIRMAÇÃO OBRIGATÓRIA: O assistente NUNCA deve executar comandos estruturais sem autorização expressa do usuário. Etapas obrigatórias antes da execução:
Apresentar a instrução DDL exata que será executada.
Explicar claramente o que ela altera na estrutura do banco.
Detalhar o impacto técnico (bloqueios exclusivos de metadados, dependências, irreversibilidade de DROP).
Solicitar a confirmação direta do usuário para prosseguir.
SOMENTE após o usuário responder confirmando expressamente no chat, reexecute passando confirmed=True. Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: ddl (required), db_alias, confirmed.
fb_execute_dmlA
Executa comandos de manipulação de dados (INSERT, UPDATE, DELETE, EXECUTE PROCEDURE).
REGRA RÍGIDA DE SEGURANÇA — DUPLA CONFIRMAÇÃO OBRIGATÓRIA: O assistente NUNCA deve executar comandos DML sem autorização expressa do usuário. Etapas obrigatórias antes da execução:
Apresentar o SQL exato que será executado.
Explicar claramente o que o comando faz.
Detalhar o impacto no banco (tabelas e registros afetados, reversibilidade, riscos de lock ou perda de dados).
Solicitar a confirmação direta do usuário para prosseguir.
SOMENTE após o usuário responder confirmando expressamente no chat, reexecute passando confirmed=True. Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: sql (required), db_alias, confirmed.
fb_explain_planA
Compila uma consulta SQL no Firebird e extrai o plano de execução compilado (PLAN). Analisa leituras sequenciais (NATURAL SCAN) em tabelas, ordenações em memória (SORT) e fornece recomendações cirúrgicas de indexação e reescrita. Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: sql (required), db_alias.
fb_inspect_tableA
Inspeciona detalhadamente a estrutura de uma tabela no Firebird:
Colunas, tipos exatos (DECFLOAT, INT128, BOOLEAN, VARCHAR, BLOB SUB_TYPE), domínios e nullability
Chaves primárias (PK) e estrangeiras (FK)
Índices com ordem (ASC/DESC), colunas participantes e taxa de seletividade real (RDB$STATISTICS). Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: table_name (required), db_alias.
fb_list_databasesB
Lista todos os bancos de dados Firebird configurados no Catálogo Central Global (~/.firebird-mcp.json) ou arquivo local, identificando os bancos correspondentes ao projeto ativo. Informa se há necessidade de confirmação/pergunta ao usuário quando houver múltiplos bancos no projeto.
Inputs: project_filter.
fb_list_generatorsA
Lista todos os Generators / Sequences de usuário no banco especificado (ou ativo na sessão). Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: db_alias.
fb_list_proceduresA
Lista todas as Stored Procedures cadastradas no banco especificado (ou ativo na sessão). Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: db_alias.
fb_list_tablesA
Lista todas as tabelas de usuário (não de sistema) do banco especificado (ou ativo na sessão). Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: db_alias.
fb_list_viewsA
Lista todas as views de usuário do banco especificado (ou ativo na sessão). Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: db_alias.
fb_queryA
Executa consulta SELECT de leitura no Firebird com limite seguro de linhas (1 a 1000). Seguro: Rejeita comandos de alteração de dados e encerra a transação com commit imediato. Se houver múltiplos bancos no projeto e nenhum estiver ativo na sessão, pergunte antes ao usuário.
Inputs: sql (required), limit, db_alias.
fb_reload_configC
Recarrega a configuração de bancos a partir do Catálogo Central Global (~/.firebird-mcp.json) ou arquivo local do projeto.
Inputs: config_path.
fb_use_databaseA
Define o banco de dados ativo da sessão entre os configurados no catálogo. Suporta busca inteligente por nome exato, case-insensitive, substring no alias ou tag (ex: 'auditoria' -> 'erp_auditoria'). Todas as chamadas seguintes que não especificarem 'db_alias' utilizarão este banco ativo.
Inputs: alias (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have clearly distinct purposes: schema listing tools target different object types, and query/DML/DDL/explain/health are well separated. The main ambiguity is between fb_create_config and fb_configure_database, which both involve creating or updating database entries in the catalog with projects/tags, so an agent may struggle to choose between them.
Names are consistently prefixed with fb_ and use snake_case, and most follow a verb_noun pattern (fb_list_tables, fb_inspect_table, fb_execute_dml). Minor deviations such as fb_database_health and fb_query break the strict verb_noun pattern but remain readable and predictable.
15 tools is appropriate for a Firebird database MCP server, covering configuration, schema discovery, inspection, querying, DML, DDL, and health diagnostics. Each tool appears to have a distinct role, and the count sits within the well-scoped range.
The surface covers core database workflows: catalog configuration, database selection, listing tables/views/procedures/generators, table inspection, query execution, DML, DDL, and health checks. Minor gaps remain, such as detailed inspection for views/procedures/triggers and explicit transaction control, but agents can work around these with generic SQL query tools.
Maintenance
Related MCP Connectors
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Related MCP Servers
AlicenseAqualityCmaintenanceConnect any AI to PostgreSQL, MySQL, or SQL Server — 24 dialect-aware tools for query, schema, optimization, and more.2315 npm1MIT- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with and manage multiple database types (PostgreSQL, MySQL, SQLite, SQL Server, MongoDB, Redis) through natural language, supporting query analysis, schema management, data analysis, backup/restore, and security analysis.8 npm2MIT
- AlicenseBqualityCmaintenanceEnables AI assistants to connect to Microsoft SQL Server for schema discovery, querying, stored procedures, DDL, performance diagnostics, and developer utilities with configurable security modes.35MIT
- AlicenseAqualityCmaintenanceConnects AI agents to ASPEL SAE Firebird databases, enabling read-only queries for inventory, warehouse, sales, and client data across multiple warehouses and companies.101MIT