### HTTP Streamable Command Line Configuration (Windows Example) Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md Example of starting the MCP Firebird server with HTTP transport on Windows using Git Bash, specifying the database path with escaped backslashes. ```bash # Windows example (Git Bash) - Stateless by default npx -y mcp-firebird \ --transport-type http \ --http-port 3012 \ --database "F:\Proyectos\SAI\EMPLOYEE.FDB" \ --user SYSDBA \ --password masterkey ``` -------------------------------- ### STDIO Example: Basic Query Execution Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md Demonstrates starting the MCP Firebird server with STDIO transport. Clients like Claude Desktop can then interact with it via standard input/output. ```bash # Start the server npx -y mcp-firebird --transport-type stdio --database /path/to/db.fdb # The server will communicate via STDIO # Claude Desktop or other MCP clients can now interact with it ``` -------------------------------- ### Quick Start with Default Driver (No Wire Encryption) Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md Use this command for a quick setup when wire encryption is not required. It runs MCP Firebird directly using npx. ```bash npx -y mcp-firebird --database=/path/to/database.fdb ``` -------------------------------- ### Install MCP Python SDK Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/clients.md Install the official MCP Python SDK using pip. This is required for using the Python client examples. ```bash pip install mcp ``` -------------------------------- ### MCP Firebird Production Setup (Unified) Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md Example configuration for a production environment using the Unified transport. Specifies a remote database host, port, and uses an environment variable for the password. ```bash 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 ``` -------------------------------- ### Install Firebird via Homebrew Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Install the Firebird database server using Homebrew. Verify the installation by listing installed packages. ```bash # Install Firebird via Homebrew brew install firebird # Verify installation brew list firebird ``` -------------------------------- ### MCP Firebird Development Setup (SSE) Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md Example configuration for setting up MCP Firebird for development using the SSE transport. Uses a local database file and default ports. ```bash npx mcp-firebird \ --transport-type sse \ --sse-port 3003 \ --database ./dev-database.fdb \ --user SYSDBA \ --password masterkey ``` -------------------------------- ### Directory Structure Example Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md Illustrates the organization of example files and directories for MCP Firebird. ```bash examples/ ├── README.md # This file ├── ExampleClaudeV2.mp4 # Video demonstration ├── config/ # Configuration examples │ ├── claude-desktop.json # Claude Desktop configuration │ ├── vscode-mcp.json # VS Code MCP configuration │ └── environment-variables.env # Environment variables example ├── clients/ # Client examples │ ├── typescript/ # TypeScript client examples │ │ ├── streamable-http-client.ts │ │ └── stdio-client.ts │ ├── python/ # Python client examples │ │ ├── streamable_http_client.py │ │ └── requirements.txt │ └── javascript/ # JavaScript client examples │ └── streamable-http-client.js └── legacy/ # Legacy SSE examples (deprecated) ├── sse-client.html ├── sse-client.js └── sse_client.py ``` -------------------------------- ### Install Build Tools and Firebird on Arch Linux Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Installs necessary build tools and Python, then installs the Firebird package from the AUR. Finally, installs the native driver globally. ```bash # Install build tools sudo pacman -S base-devel python # Install Firebird (from AUR) yay -S firebird # Install native driver sudo npm install -g node-firebird-driver-native ``` -------------------------------- ### Python Requirements Example Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md Lists Python package dependencies for client examples. ```python # requirements.txt ``` -------------------------------- ### Automated Native Driver Installation Script (Windows) Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Download and execute a PowerShell script to automate the installation of `mcp-firebird` with the native driver on Windows. This script simplifies the setup process. ```powershell # Download and run the installation script Invoke-WebRequest -Uri "https://raw.githubusercontent.com/PuroDelphi/mcpFirebird/main/install-with-native-driver.ps1" -OutFile "install.ps1" . install.ps1 ``` -------------------------------- ### Desktop Application Integration with C# Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/use-cases.md This example demonstrates starting and stopping the MCP Firebird server process from a C# desktop application. It also includes a placeholder for generating reports by interacting with MCP Firebird. ```csharp // Example of integrating MCP Firebird with a desktop application using System; using System.Diagnostics; class McpFirebirdIntegration { private Process mcpProcess; public void StartMcpServer() { mcpProcess = new Process(); mcpProcess.StartInfo.FileName = "npx"; mcpProcess.StartInfo.Arguments = "-y mcp-firebird --database C:\\path\\to\\database.fdb"; mcpProcess.StartInfo.UseShellExecute = false; mcpProcess.Start(); } public void StopMcpServer() { if (!mcpProcess.HasExited) { mcpProcess.Kill(); } } public string GenerateReport(string reportType) { // Call Claude API with MCP connection // Process results and return formatted report return "Generated report content"; } } ``` -------------------------------- ### Unified Server Client Usage Examples Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md Examples of how to connect to the unified server using different client types and endpoints. ```bash # Modern clients use HTTP Streamable npx @modelcontextprotocol/inspector http://localhost:3003/mcp # Legacy clients use SSE npx @modelcontextprotocol/inspector http://localhost:3003/sse # Auto-detection endpoint curl http://localhost:3003/mcp-auto ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Install the necessary command-line developer tools for macOS. Verify the installation by checking the path. ```bash # Install Xcode Command Line Tools xcode-select --install # Verify installation xcode-select -p # Should output: /Library/Developer/CommandLineTools ``` -------------------------------- ### Build and Run Docker Compose Services Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/docker.md Use these commands to manage the Docker Compose setup for MCP Firebird. This includes starting services in detached mode, viewing logs, and stopping services. ```bash # Build and run with Docker Compose docker compose up -d # Check logs docker compose logs -f mcp-firebird # Stop services docker compose down ``` -------------------------------- ### STDIO Example: Using with Custom Scripts Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md A Node.js example demonstrating how to spawn the MCP Firebird server as a child process and communicate with it using standard input/output streams for sending requests and receiving responses. ```javascript // custom-client.js import { spawn } from 'child_process'; const mcpServer = spawn('npx', [ 'mcp-firebird@alpha', '--transport-type', 'stdio', '--database', '/path/to/database.fdb', '--host', 'localhost', '--port', '3050', '--user', 'SYSDBA', '--password', 'masterkey' ]); // Send MCP messages via stdin mcpServer.stdin.write(JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'list-tables', arguments: {} } }) + '\n'); // Receive responses via stdout mcpServer.stdout.on('data', (data) => { console.log('Response:', data.toString()); }); ``` -------------------------------- ### STDIO Transport Command Line Usage Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md Examples of how to start the MCP Firebird server using the STDIO transport via the command line. Includes basic, Windows, and Linux/Unix variations. ```bash # Basic STDIO usage npx -y mcp-firebird \ --transport-type stdio \ --database /path/to/database.fdb \ --host localhost \ --port 3050 \ --user SYSDBA \ --password masterkey ``` ```bash # Windows example npx -y mcp-firebird ^ --transport-type stdio ^ --database "F:\Proyectos\SAI\EMPLOYEE.FDB" ^ --host localhost ^ --port 3050 ^ --user SYSDBA ^ --password masterkey ``` ```bash # Linux/Unix example npx -y mcp-firebird \ --transport-type stdio \ --database /var/lib/firebird/data/employee.fdb \ --host localhost \ --port 3050 \ --user SYSDBA \ --password masterkey ``` -------------------------------- ### Install Firebird Client on CentOS/RHEL/Fedora Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Installs the Firebird client and development files using yum, or provides steps to download, extract, and install from a tarball. ```bash # Install Firebird sudo yum install firebird-classic firebird-devel # Or download from firebirdsql.org wget https://github.com/FirebirdSQL/firebird/releases/download/v4.0.0/Firebird-4.0.0.2496-0.amd64.tar.gz tar -xzf Firebird-4.0.0.2496-0.amd64.tar.gz cd Firebird-4.0.0.2496-0.amd64 sudo ./install.sh ``` -------------------------------- ### Install Build Tools on macOS Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/advanced-installation.md Installs Xcode command-line tools and the Firebird client library on macOS. ```bash xcode-select --install brew install firebird ``` -------------------------------- ### Legacy SSE Client HTML Example Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md Example of a legacy client using Server-Sent Events (SSE) in HTML. ```html // sse-client.html ``` -------------------------------- ### Install Firebird Client Tools on Linux (Fedora/RHEL) Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/installation.md Install the Firebird client tools on Fedora or RHEL-based Linux distributions using dnf. ```bash sudo dnf install firebird-utils ``` -------------------------------- ### Install Build Tools on CentOS/RHEL/Fedora Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Installs the 'Development Tools' group and Python 3 on CentOS/RHEL/Fedora systems. Verifies the installation of GCC and Python 3. ```bash # Install Development Tools group sudo yum groupinstall "Development Tools" # Install Python 3 sudo yum install python3 # Verify installation gcc --version python3 --version ``` -------------------------------- ### Python SSE Client Examples Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md Python script demonstrating how to interact with the MCP Firebird SSE transport using the requests library. Includes examples for calling tools, executing queries, and retrieving table data. ```python import requests import json MCP_SERVER_URL = 'http://localhost:3003' def call_mcp_tool(tool_name, arguments=None): """Call an MCP tool via SSE transport""" payload = { 'jsonrpc': '2.0', 'id': 1, 'method': 'tools/call', 'params': { 'name': tool_name, 'arguments': arguments or {} } } response = requests.post( f'{MCP_SERVER_URL}/messages', headers={'Content-Type': 'application/json'}, json=payload ) return response.json() # Example: List tables result = call_mcp_tool('list-tables') print(json.dumps(result, indent=2)) # Example: Execute query result = call_mcp_tool('execute-query', { 'query': 'SELECT * FROM EMPLOYEES WHERE SALARY > 50000' }) print(json.dumps(result, indent=2)) # Example: Get table data with filtering result = call_mcp_tool('get-table-data', { 'tableName': 'CUSTOMERS', 'whereClause': 'COUNTRY = \'USA\'', 'orderBy': 'CUSTOMER_NAME', 'limit': 100 }) print(json.dumps(result, indent=2)) ``` -------------------------------- ### Install Homebrew Package Manager Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Install Homebrew, a package manager for macOS, if it's not already installed. Verify the installation by checking the version. ```bash # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Verify installation brew --version ``` -------------------------------- ### Install mcp-firebird and Native Driver Globally Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Install the `mcp-firebird` package and the native driver globally. Verify they are installed in the same location. This is required for the native driver to function correctly, especially for features like wire encryption. ```bash # Step 1: Install mcp-firebird globally npm install -g mcp-firebird # Step 2: Install native driver globally npm install -g node-firebird-driver-native # Step 3: Verify both are in the same location npm list -g mcp-firebird npm list -g node-firebird-driver-native # Step 4: Run directly (WITHOUT npx) mcp-firebird --use-native-driver --database "path/to/database.fdb" --user SYSDBA --password masterkey ``` -------------------------------- ### Configuration Example Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/metadata-tools.md Configure allowed operations and authorization types in your .env file or security script. These tools typically require EXECUTE permission. ```env # Allow metadata inspection ALLOWED_OPERATIONS=SELECT,EXECUTE # Or use role-based permissions AUTHORIZATION_TYPE=basic ROLE_PERMISSIONS_ADMIN_OPERATIONS=SELECT,INSERT,UPDATE,DELETE,EXECUTE ``` -------------------------------- ### Install MCP SDK for TypeScript/JavaScript Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/clients.md Install the official MCP SDK using npm. This is the first step to using the Streamable HTTP client transport. ```bash npm install @modelcontextprotocol/sdk ``` -------------------------------- ### Install Firebird Client Tools on Linux (Debian/Ubuntu) Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/installation.md Install the Firebird client tools on Debian or Ubuntu-based Linux distributions using apt-get. ```bash sudo apt-get install firebird3.0-utils ``` -------------------------------- ### Install Firebird Client on CentOS/RHEL Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/advanced-installation.md Installs the Firebird client library on CentOS or RHEL-based Linux systems. ```bash sudo yum install firebird-classic ``` -------------------------------- ### Start Unified Server via Command Line Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md Launch the mcp-firebird server using command-line arguments for unified transport mode. ```bash # Start unified server (supports both SSE and HTTP Streamable) npx -y mcp-firebird \ --transport-type unified \ --http-port 3003 \ --database /path/to/database.fdb \ --host localhost \ --port 3050 \ --user SYSDBA \ --password masterkey ``` -------------------------------- ### GitHub Copilot - List All Tables Query Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/vscode-integration.md Example prompt for GitHub Copilot to list all tables in a Firebird database. ```plaintext List all tables in my database ``` -------------------------------- ### Install Native Node.js Firebird Driver Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md Installs the native Node.js driver for Firebird. Can be installed globally or locally within a project. ```bash # Install globally npm install -g node-firebird-driver-native # Or install locally in your project npm install node-firebird-driver-native ``` -------------------------------- ### Install and Run MCP Firebird with Native Driver (Wire Encryption) Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md This sequence installs build tools, MCP Firebird globally, the native driver, and then runs the application with encryption enabled. It requires global installations and direct execution without npx. ```bash # Step 1: Install build tools # 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 # Step 2: Install MCP Firebird globally npm install -g mcp-firebird # Step 3: Install native driver globally npm install -g node-firebird-driver-native # Step 4: Run directly (WITHOUT npx) mcp-firebird --use-native-driver \ --database=/path/to/database.fdb \ --host=localhost \ --user=SYSDBA \ --password=masterkey ``` -------------------------------- ### TypeScript STDIO Client Example Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md Example of a TypeScript client using the STDIO transport. ```typescript // stdio-client.ts ``` -------------------------------- ### Install Build Tools on Ubuntu/Debian Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/advanced-installation.md Installs necessary build tools and Python for compiling native modules on Ubuntu or Debian-based Linux systems. ```bash sudo apt-get update sudo apt-get install -y build-essential python3 firebird-dev ``` -------------------------------- ### HTML/JavaScript SSE Client Example Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md A basic web client using Fetch API to send JSON-RPC requests to the MCP Firebird SSE endpoint. This example demonstrates listing tables. ```html MCP Firebird SSE Client

MCP Firebird SSE Client



    


```

--------------------------------

### Legacy SSE Client Python Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md

Example of a legacy client using Server-Sent Events (SSE) in Python.

```python
// sse_client.py

```

--------------------------------

### Python HTTP Streamable Client Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md

Example of a Python client using the HTTP Streamable transport.

```python
# streamable_http_client.py

```

--------------------------------

### JavaScript HTTP Streamable Client Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md

Example of a JavaScript client using the HTTP Streamable transport.

```javascript
// streamable-http-client.js

```

--------------------------------

### Legacy SSE Client JavaScript Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md

Example of a legacy client using Server-Sent Events (SSE) in JavaScript.

```javascript
// sse-client.js

```

--------------------------------

### Install Firebird Client Tools and Update PATH

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/troubleshooting.md

Resolve 'gbak not found' errors by installing Firebird client tools or adding the Firebird bin directory to your system's PATH.

```bash
# Install Firebird client tools (Debian/Ubuntu)
sudo apt-get install firebird3.0-utils

# Add to PATH (Windows)
set PATH=%PATH%;C:\Program Files\Firebird\Firebird_3_0\bin
```

--------------------------------

### Install Build Tools on CentOS/RHEL

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/advanced-installation.md

Installs essential development tools and Python for native module compilation on CentOS or RHEL-based Linux systems.

```bash
sudo yum groupinstall "Development Tools"
sudo yum install python3 firebird-devel
```

--------------------------------

### Example .env file for MCP Firebird

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/configuration.md

An example .env file demonstrating how to set environment variables for MCP Firebird configuration, including EMA and transport settings.

```dotenv
FIREBIRD_HOST=localhost
FIREBIRD_PORT=3050
FIREBIRD_DATABASE=F:\Proyectos\SAI\EMPLOYEE.FDB
FIREBIRD_USER=SYSDBA
FIREBIRD_PASSWORD=masterkey
FIREBIRD_ROLE= 

# Enterprise Managed Authorization (EMA)
FIREBIRD_API_KEY=my_secret_token_123

# Transport configuration
TRANSPORT_TYPE=sse  # Recommended: sse (HTTP Streamable). Legacy: stdio
SSE_PORT=3003
```

--------------------------------

### Native Driver Installation Output

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/wire-encryption-limitation.md

This is the expected output when the native driver is successfully installed. It indicates that the native addon is being compiled and linked.

```text
> node-firebird-native-api@3.1.2 install
> node-gyp rebuild

  CXX(target) Release/obj.target/addon/src/...
  SOLINK_MODULE(target) Release/addon.node
```

--------------------------------

### Install Firebird Client on Ubuntu/Debian

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/advanced-installation.md

Installs the Firebird 3.0 or 4.0 client library on Ubuntu or Debian-based Linux systems.

```bash
sudo apt-get install firebird3.0-client
# or for Firebird 4.0
sudo apt-get install firebird4.0-client
```

--------------------------------

### Install Firebird Client Tools on macOS

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/installation.md

Install the Firebird client tools on macOS using the Homebrew package manager.

```bash
# Using Homebrew
brew install firebird
```

--------------------------------

### List Triggers Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/metadata-tools.md

Example JSON output for listing triggers. Includes total count and details for each trigger such as name, table, type, sequence, status, and description.

```json
{
  "totalTriggers": 5,
  "triggers": [
    {
      "name": "TRG_AUDIT_INSERT",
      "tableName": "EMPLOYEES",
      "triggerType": "AFTER INSERT",
      "sequence": 0,
      "inactive": false,
      "description": "Audit trail for employee insertions"
    }
  ]
}
```

--------------------------------

### Legacy Client (SSE) Request Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

Demonstrates making a POST request to the legacy SSE endpoint for client communication.

```typescript
// Legacy client (SSE) - still works!
const legacyResponse = await fetch('http://localhost:3003/messages', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'tools/call',
    params: {
      name: 'list-tables',
      arguments: {}
    }
  })
});
```

--------------------------------

### Describe Trigger Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/metadata-tools.md

Example JSON output for describing a specific trigger. Includes all details from listing triggers plus the trigger's PSQL source code.

```json
{
  "name": "TRG_AUDIT_INSERT",
  "tableName": "EMPLOYEES",
  "triggerType": "AFTER INSERT",
  "sequence": 0,
  "inactive": false,
  "source": "BEGIN\n  INSERT INTO AUDIT_LOG (TABLE_NAME, OPERATION, USER_NAME)\n  VALUES ('EMPLOYEES', 'INSERT', CURRENT_USER);\nEND",
  "description": "Audit trail for employee insertions"
}
```

--------------------------------

### Install MCP Firebird CLI

Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md

Install the MCP Firebird command-line interface globally using npm. This is a prerequisite for running the server.

```bash
npm install -g mcp-firebird
```

--------------------------------

### GitHub Copilot - Analyze Query Performance

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/vscode-integration.md

Example prompt for GitHub Copilot to analyze the performance of a given SQL query.

```plaintext
Analyze the performance of this query: SELECT * FROM ORDERS WHERE ORDER_DATE > '2023-01-01'
```

--------------------------------

### Native Driver Installation Output

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md

This is the expected output when the native Node.js Firebird driver is successfully installed and compiled.

```text
> node-firebird-native-api@3.1.2 install
> node-gyp rebuild

  CXX(target) Release/obj.target/addon/src/...
  SOLINK_MODULE(target) Release/addon.node
+ node-firebird-driver-native@3.2.2
```

--------------------------------

### Verify MCP Firebird Installation

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/installation.md

Verify the correct installation of MCP Firebird by checking its version using npx.

```bash
npx mcp-firebird --version
```

--------------------------------

### Install Firebird Client Library on Linux (Ubuntu/Debian)

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/wire-encryption-limitation.md

Install the Firebird client library required for the native driver on Ubuntu or Debian-based Linux systems. Use the appropriate package for your Firebird version.

```bash
sudo apt-get install firebird3.0-client
# or for Firebird 4.0+
sudo apt-get install firebird4.0-client
```

--------------------------------

### Troubleshoot 'Permission denied' on Linux/macOS

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md

Handle 'Permission denied' errors during global npm installations by using 'sudo' or opting for a local installation.

```bash
# Use sudo for global installation
sudo npm install -g node-firebird-driver-native

# Or install locally (no sudo needed)
npm install node-firebird-driver-native
```

--------------------------------

### GitHub Copilot - Execute Specific Query

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/vscode-integration.md

Example prompt for GitHub Copilot to execute a specific SQL query against the Firebird database.

```plaintext
Execute this query: SELECT * FROM EMPLOYEES WHERE DEPARTMENT_ID = 10
```

--------------------------------

### Global Installation of Stable MCP Firebird Version

Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md

Installs the latest stable version of MCP Firebird globally. This is a prerequisite for running the server directly.

```bash
# Global installation
npm install -g mcp-firebird

# Run the server
npx -y mcp-firebird --database /path/to/database.fdb
```

--------------------------------

### GitHub Copilot - Describe Table Structure Query

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/vscode-integration.md

Example prompt for GitHub Copilot to describe the structure of a specific table in a Firebird database.

```plaintext
Describe the structure of the CUSTOMERS table
```

--------------------------------

### Basic SSE Server Command Line

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

Start a basic SSE server using npx with essential connection parameters. An API key can be optionally provided for security.

```bash
# Basic SSE server
npx -y mcp-firebird \
  --transport-type sse \
  --sse-port 3003 \
  --database /path/to/database.fdb \
  --host localhost \
  --port 3050 \
  --user SYSDBA \
  --password masterkey \
  --api-key your_super_secret_key
```

--------------------------------

### Full SSE Server Configuration

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

Start an SSE server with a comprehensive set of configuration options, including host, port, database path, user, and password.

```bash
# Full configuration
npx -y mcp-firebird \
  --transport-type sse \
  --sse-port 3003 \
  --host 192.168.1.100 \
  --port 3050 \
  --database /firebird/data/database.fdb \
  --user SYSDBA \
  --password masterkey
```

--------------------------------

### Verify Node.js Architecture

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md

Check the architecture of your Node.js installation. It should be 'x64' to match the 64-bit Firebird client DLL.

```javascript
node -p "process.arch"
# Should output: x64
```

--------------------------------

### Generate Documentation for Procedures

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/metadata-tools.md

Retrieve information about database procedures to aid in documentation generation. 'list-procedures' gets all procedures, and 'describe-procedure' provides detailed information for each.

```javascript
// Get all procedures and their descriptions
const procedures = await client.callTool('list-procedures', {});

// Get detailed information for each procedure
for (const proc of procedures.procedures) {
  const details = await client.callTool('describe-procedure', {
    procedureName: proc.name
  });
  // Generate documentation from details
}
```

--------------------------------

### Modern Client (HTTP Streamable) Connection Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

Connect to the mcp-firebird server using the modern HTTP Streamable protocol with the SDK client.

```typescript
// Modern client (HTTP Streamable)
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const modernTransport = new StreamableHTTPClientTransport(
  "http://localhost:3003/mcp"
);

const modernClient = new Client({
  name: "modern-client",
  version: "1.0.0"
}, {
  capabilities: {}
});

await modernClient.connect(modernTransport);
```

--------------------------------

### Nginx Reverse Proxy Configuration

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

Example Nginx configuration for proxying requests to an MCP Firebird backend. This setup is crucial for securing network transports like SSE, HTTP Streamable, and Unified in production environments.

```nginx
server {
    listen 443 ssl;
    server_name mcp.example.com;

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

    location / {
        proxy_pass http://localhost:3003;
        proxy_set_header Host $host;
        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;
    }
}
```

--------------------------------

### Web Application Integration with Node.js and Express

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/use-cases.md

This snippet shows how to start the MCP Firebird server and create an API endpoint in an Express application to interact with it via Claude API. Ensure MCP Firebird is installed and configured.

```javascript
// Example of integrating MCP Firebird with a web application
const express = require('express');
const { spawn } = require('child_process');
const app = express();

// Start MCP Firebird server
const mcpServer = spawn('npx', [
  '-y',
  'mcp-firebird',
  '--database', '/path/to/database.fdb',
  '--transport-type', 'sse',
  '--sse-port', '3003',
  '--api-key', 'your_secret_key'
]);

// API endpoint that uses MCP Firebird
app.get('/api/sales-report', async (req, res) => {
  // Call Claude API with MCP Firebird connection info
  const claudeResponse = await callClaude({
    prompt: "Generate a sales report for the last month",
    tools: [{
      name: "mcp-firebird",
      url: "http://localhost:3003"
    }]
  });
  
  res.json(claudeResponse);
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

```

--------------------------------

### Iniciar Servidor MCP con Soporte para Eventos Proactivos

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/proactive-events.md

Inicia el servidor MCP Firebird habilitando el driver nativo y especificando el puerto para SSE/HTTP. Incluye configuración de base de datos y autenticación.

```bash
npx -y mcp-firebird \
  --transport-type sse \
  --sse-port 3003 \
  --use-native-driver \
  --database /ruta/a/base.fdb \
  --user SYSDBA \
  --password masterkey \
  --api-key tu_clave_secreta
```

--------------------------------

### Install Native Driver Globally or Locally

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md

Installs the node-firebird-driver-native using npm. Can be installed globally for system-wide access or locally within a project.

```bash
# Install globally
sudo npm install -g node-firebird-driver-native

# Or install locally
npm install node-firebird-driver-native
```

--------------------------------

### Understand Dependencies for Migration Planning

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/metadata-tools.md

Inspect packages to understand code organization and dependencies before migrating or modifying database objects. 'list-packages' retrieves all packages, and 'describe-package' provides details for a specific package.

```javascript
// List all packages to understand code organization
const packages = await client.callTool('list-packages', {});

// Get package details to understand dependencies
const pkgDetails = await client.callTool('describe-package', {
  packageName: 'PKG_EMPLOYEE_UTILS'
});
```

--------------------------------

### TypeScript HTTP Streamable Client Example

Source: https://github.com/purodelphi/mcpfirebird/blob/main/examples/README.md

Example of a TypeScript client using the HTTP Streamable transport.

```typescript
// streamable-http-client.ts

```

--------------------------------

### Install Node Firebird Native Driver

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/advanced-installation.md

Installs the native Firebird driver globally using npm. This step involves compiling native code and may require build tools and the Firebird client library to be installed beforehand.

```bash
npm install -g node-firebird-driver-native
```

--------------------------------

### Start MCP Firebird Server with SSE and Native Driver

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/proactive-events.en.md

Launch the MCP Firebird server, enabling SSE transport, the native driver, and specifying database connection details and authentication.

```bash
npx -y mcp-firebird \
  --transport-type sse \
  --sse-port 3003 \
  --use-native-driver \
  --database /path/to/database.fdb \
  --user SYSDBA \
  --password masterkey \
  --api-key your_secret_key
```

--------------------------------

### get-methods

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/tools.md

Returns a description of all available MCP tools.

```APIDOC
## get-methods

### Description
Returns a description of all available MCP tools.

### Method
POST

### Endpoint
/tools/get-methods

### Request Body
This endpoint does not require a request body.

### Request Example
```json
{}
```

### Response
#### Success Response (200)
- **methods** (array) - An array of available tool names and their descriptions.

#### Response Example
```json
{
  "methods": [
    {"name": "execute-query", "description": "Executes a SQL query..."},
    {"name": "list-tables", "description": "Lists all user tables..."}
  ]
}
```
```

--------------------------------

### Transport and Database Configuration via Environment Variables

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

Configure transport types (STDIO, SSE) and database connection details using environment variables. Adjust SSE session timeouts and enable wire encryption as needed.

```bash
# Transport Configuration
TRANSPORT_TYPE=stdio|sse          # Transport type
SSE_PORT=3003                     # SSE server port
SSE_SESSION_TIMEOUT_MS=300000     # Session timeout (5 minutes)

# Database Configuration
FIREBIRD_HOST=localhost           # Firebird server host
FIREBIRD_PORT=3050               # Firebird server port
FIREBIRD_DATABASE=/path/to/db    # Database file path
FIREBIRD_USER=SYSDBA             # Database user
FIREBIRD_PASSWORD=masterkey      # Database password

# Security
ENABLE_WIRE_ENCRYPTION=true      # Enable wire encryption (Firebird 3.0+)

# Logging
LOG_LEVEL=info                   # Log level: debug, info, warn, error
```

--------------------------------

### Install MCP Firebird Node.js Package

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/installation.md

Install the mcp-firebird npm package globally for recommended usage or as a project dependency.

```bash
# Global installation (Recommended)
npm install -g mcp-firebird

# Project installation
npm install mcp-firebird
```

--------------------------------

### MCP Firebird Docker Setup (SSE)

Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md

Demonstrates how to run MCP Firebird in a Docker container using the SSE transport. It maps ports, sets environment variables, and mounts a volume for the database.

```bash
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 \
  purodelphi/mcp-firebird:latest
```

--------------------------------

### Troubleshoot 'Cannot find module 'node-firebird-driver-native''

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md

Diagnose and resolve the 'Cannot find module' error by checking if the native driver is installed globally and installing it if necessary.

```bash
# Check if installed globally
npm list -g node-firebird-driver-native

# If not found, install it
npm install -g node-firebird-driver-native
```

--------------------------------

### Install Alpha Version of MCP Firebird

Source: https://github.com/purodelphi/mcpfirebird/blob/main/README.md

Installs the latest alpha version of MCP Firebird globally, providing access to the newest features. You can also specify a particular alpha version.

```bash
# Install alpha version with latest features
npm install -g mcp-firebird@alpha

# Or use specific alpha version
npm install -g mcp-firebird@2.4.0-alpha.0
```

--------------------------------

### Troubleshoot 'node-gyp rebuild failed'

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/native-driver-installation.md

Provides solutions for 'node-gyp rebuild failed' errors, typically caused by missing build tools. Instructions are provided for Windows, Linux, and macOS.

```bash
# Solution for macOS:
xcode-select --install
```

--------------------------------

### List Functions

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/metadata-tools.md

Lists all functions (UDFs and PSQL) in the database, providing details like name, module, entry point, and description. Useful for cataloging available functions.

```json
{
  "totalFunctions": 2,
  "functions": [
    {
      "name": "FN_CALCULATE_TAX",
      "moduleName": null,
      "entryPoint": null,
      "returnArgument": 0,
      "description": "Calculates tax based on salary",
      "validBlr": true
    }
  ]
}
```

--------------------------------

### Connect with Native Driver and Wire Encryption

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/advanced-installation.md

When wire encryption is required or enabled on the server, use the native driver with the `--use-native-driver` flag. Ensure the database path, host, user, and password are correctly specified.

```bash
npx mcp-firebird --use-native-driver \
  --database=/path/to/database.fdb \
  --host=localhost \
  --user=SYSDBA \
  --password=masterkey
```

--------------------------------

### get-execution-plan

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/tools.md

Gets the execution plan for a SQL query.

```APIDOC
## get-execution-plan

### Description
Gets the execution plan for a SQL query to understand how the database will execute it.

### Method
POST

### Endpoint
/tools/get-execution-plan

### Request Body
- **sql** (string) - Required - The SQL query for which to get the execution plan.

### Request Example
```json
{
  "sql": "SELECT * FROM EMPLOYEES WHERE DEPARTMENT_ID = ?"
}
```

### Response
#### Success Response (200)
- **executionPlan** (string) - The execution plan of the query.

#### Response Example
```json
{
  "executionPlan": "PLAN SORT (EMPLOYEES INDEX (PK_EMPLOYEES))"
}
```
```

--------------------------------

### Dockerfile for MCP Firebird Server

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/docker.md

This Dockerfile sets up a Node.js environment to run the MCP Firebird server using the SSE transport. It installs Firebird client tools, copies application code, installs dependencies, and configures environment variables for the server.

```dockerfile
# Use Node.js LTS with Debian as base image
FROM node:20-slim

# Install Firebird client tools
RUN apt-get update && \
    apt-get install -y --no-install-recommends firebird3.0-utils firebird3.0-client && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Create working directory
WORKDIR /app

# Copy configuration files and dependencies
COPY package*.json ./
COPY tsconfig.json ./

# Install dependencies
RUN npm install

# Copy source code
COPY src/ ./src/

# Compile the TypeScript project
RUN npm run build

# Expose port for SSE
EXPOSE 3003

# Default environment variables
ENV FIREBIRD_HOST=localhost
ENV FIREBIRD_PORT=3050
ENV FIREBIRD_USER=SYSDBA
ENV FIREBIRD_PASSWORD=masterkey
ENV FIREBIRD_DATABASE=/firebird/data/database.fdb
ENV TRANSPORT_TYPE=http
ENV HTTP_PORT=3003
ENV LOG_LEVEL=info
# Add EMA protection by default (Change this in production!)
ENV FIREBIRD_API_KEY=change_me_123

# Create directory for the database
RUN mkdir -p /firebird/data && \
    chown -R node:node /firebird

# Switch to node user for security
USER node

# Command to start the modern unified server
CMD ["node", "dist/cli.js", "--use-native-driver"]
```

--------------------------------

### Use Template Prompts for Guided Workflows

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

This function retrieves template prompts for guided workflows, such as database health checks, query optimization, or migration planning. It sends a POST request to the MCP server's messages endpoint with a 'prompts/get' method.

```javascript
// Use template prompts for guided workflows
async function getPrompt(promptName, args = {}) {
    const response = await fetch(`${MCP_SERVER_URL}/messages`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            jsonrpc: '2.0',
            id: Date.now(),
            method: 'prompts/get',
            params: {
                name: promptName,
                arguments: args
            }
        })
    });

    return await response.json();
}

// Database health check
const healthCheck = await getPrompt('database-health-check', {
    focusAreas: ['performance', 'security']
});
console.log('Health Check Guide:', healthCheck);

// Query optimization guide
const optimizationGuide = await getPrompt('query-optimization-guide', {
    queryType: 'select'
});
console.log('Optimization Guide:', optimizationGuide);

// Migration planning
const migrationPlan = await getPrompt('migration-planning', {
    migrationType: 'schema-change',
    description: 'Add new customer loyalty program tables'
});
console.log('Migration Plan:', migrationPlan);
```

--------------------------------

### describe-batch-tables

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/tools.md

Gets the detailed schema of multiple tables in parallel.

```APIDOC
## describe-batch-tables

### Description
Gets the detailed schema of multiple tables in parallel for improved performance.

### Method
POST

### Endpoint
/tools/describe-batch-tables

### Request Body
- **tableNames** (array) - Required - An array of table names to describe.
- **maxConcurrent** (integer) - Optional - Maximum number of concurrent operations (default: 5, max: 10).

### Request Example
```json
{
  "tableNames": ["EMPLOYEES", "DEPARTMENTS", "JOB_HISTORY"],
  "maxConcurrent": 3
}
```

### Response
#### Success Response (200)
- **schemas** (object) - An object where keys are table names and values are their schema descriptions.

#### Response Example
```json
{
  "schemas": {
    "EMPLOYEES": {"columns": [...]},
    "DEPARTMENTS": {"columns": [...]},
    "JOB_HISTORY": {"columns": [...]}
  }
}
```
```

--------------------------------

### get-field-descriptions

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/tools.md

Gets the stored descriptions for fields of a specific table.

```APIDOC
## get-field-descriptions

### Description
Gets the stored descriptions for fields of a specific table (if they exist).

### Method
POST

### Endpoint
/tools/get-field-descriptions

### Request Body
- **tableName** (string) - Required - The name of the table whose field descriptions are requested.

### Request Example
```json
{
  "tableName": "EMPLOYEES"
}
```

### Response
#### Success Response (200)
- **fieldDescriptions** (object) - An object where keys are field names and values are their descriptions.

#### Response Example
```json
{
  "fieldDescriptions": {
    "EMPLOYEE_ID": "Unique identifier for the employee.",
    "FIRST_NAME": "The employee's first name."
  }
}
```
```

--------------------------------

### HTTP Streamable Command Line Configuration (Stateless)

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/transport-types.md

Start the MCP Firebird server using HTTP transport in stateless mode via command line arguments. This is the default and recommended mode for most clients, including MCP Inspector.

```bash
# Default mode: Stateless (works with MCP Inspector and most clients)
npx -y mcp-firebird \
  --transport-type http \
  --http-port 3003 \
  --database /path/to/database.fdb \
  --user SYSDBA \
  --password masterkey
```

--------------------------------

### describe-trigger

Source: https://github.com/purodelphi/mcpfirebird/blob/main/docs/metadata-tools.md

Gets detailed information about a specific trigger including its source code.

```APIDOC
## describe-trigger

### Description
Gets detailed information about a specific trigger including its source code.

### Parameters
#### Path Parameters
- **triggerName** (string) - Required - Name of the trigger to describe

### Returns
- Complete trigger information including:
  - All fields from `list-triggers`
  - `source`: Complete PSQL source code of the trigger

### Response Example
```json
{
  "name": "TRG_AUDIT_INSERT",
  "tableName": "EMPLOYEES",
  "triggerType": "AFTER INSERT",
  "sequence": 0,
  "inactive": false,
  "source": "BEGIN\n  INSERT INTO AUDIT_LOG (TABLE_NAME, OPERATION, USER_NAME)\n  VALUES ('EMPLOYEES', 'INSERT', CURRENT_USER);\nEND",
  "description": "Audit trail for employee insertions"
}
```
```