Firebird Model Context Protocol (MCP) Server
mcp-firebird is a server implementation of Anthropic's Model Context Protocol (MCP) specifically designed for Firebird SQL databases. It enables AI agents, such as Claude Desktop, to securely and efficiently interact with Firebird databases for various tasks including schema inspection, executing read-only or write SQL queries, analyzing table structures, and generating SQL from natural language descriptions. The package, currently at version 2.6.0, provides a robust interface to unlock valuable data in Firebird systems for AI-driven applications. It supports Server-Sent Events (SSE) for real-time data streaming and offers enhanced command-line parameter handling and environment variable configuration. Developed by PuroDelphi, it is actively maintained with ongoing feature enhancements and performance optimizations, making it a comprehensive toolkit for integrating Firebird with modern AI workflows. Key differentiators include its dedicated focus and comprehensive features for Firebird within the MCP ecosystem, offering more extensive management and analysis tools compared to simpler, older implementations.
Common errors
-
Container startup failures: Ensure the DATABASE environment variable is properly set
cause The `DATABASE` environment variable (or equivalent CLI argument) is missing or points to an invalid path for the Firebird database file.fixSet the `DATABASE` environment variable or `--database` CLI argument to the correct absolute path of your Firebird `.fdb` database file. For Docker, ensure the path reflects the location inside the container's filesystem after volume mounting. -
ERROR: Unable to connect to Firebird database. Check host, port, user, and password.
cause Incorrect network configuration, invalid credentials, or the Firebird database server is not running or accessible.fixVerify that the Firebird database server is active and listening on the specified host and port. Double-check the `FIREBIRD_HOST`, `FIREBIRD_PORT`, `FIREBIRD_USER`, and `FIREBIRD_PASSWORD` environment variables or their CLI counterparts for accuracy. Check firewall rules. -
Error: EACCES: permission denied, access '/firebird/data/your_db.fdb'
cause The user account running the mcp-firebird server lacks sufficient read/write permissions for the Firebird database file or its directory.fixAdjust file system permissions for the Firebird database file and its parent directory to grant read and write access to the user account or group under which the mcp-firebird process is running.
Warnings
- breaking The Model Context Protocol (MCP) itself has undergone significant breaking changes, notably with the migration from MCP v1 to v2. Users should ensure their mcp-firebird server and any client applications are compatible with the specific MCP protocol version being used to avoid communication errors or unexpected behavior.
- gotcha Incorrect or insufficient Firebird database connection parameters (host, port, database path, user, password) will prevent the server from connecting to the database. These are critical for server startup and functionality.
- gotcha File system permissions issues on the Firebird database file (`.fdb`) or data volumes, as well as initialization scripts, can lead to container startup failures or database access errors.
- gotcha When running mcp-firebird within a Docker container, ensure that the `DATABASE` environment variable is correctly set to the path *inside the container* where the database file is mounted. Improper volume mounts or incorrect paths will lead to connection failures.
Install
-
npm install mcp-firebird -
yarn add mcp-firebird -
pnpm add mcp-firebird
Imports
- mcp-firebird
npx mcp-firebird
- MCP Server Configuration
import { configure } from 'mcp-firebird'Via environment variables or command-line arguments
Quickstart
import { spawn } from 'child_process';
const databasePath = process.env.FIREBIRD_DATABASE_PATH ?? '/firebird/data/test_db.fdb';
const user = process.env.FIREBIRD_USER ?? 'SYSDBA';
const password = process.env.FIREBIRD_PASSWORD ?? 'masterkey';
const host = process.env.FIREBIRD_HOST ?? 'localhost';
const port = process.env.FIREBIRD_PORT ?? '3050';
// Example of running mcp-firebird via npx with environment variables and CLI arguments
const mcpFirebirdProcess = spawn('npx', [
'mcp-firebird',
'--database', databasePath,
'--user', user,
'--password', password,
'--host', host,
'--port', port,
'--transport', 'sse', // Use Server-Sent Events transport
'--sse-port', '3003' // Specify SSE port
], {
stdio: 'inherit',
env: { ...process.env,
LOG_LEVEL: 'debug' // Example of an additional environment variable
}
});
mcpFirebirdProcess.on('error', (err) => {
console.error('Failed to start mcp-firebird process:', err);
});
mcpFirebirdProcess.on('exit', (code) => {
console.log(`mcp-firebird process exited with code ${code}`);
});
console.log('MCP Firebird server started. Connect your AI client (e.g., Claude Desktop) to this server.');
console.log(`Database: ${databasePath}, User: ${user}, Host: ${host}, Port: ${port}`);
console.log('SSE Transport active on port 3003.');