MCP Server ODBC via SQLAlchemy

by OpenLinkSoftware

24 stars
250 downloads
Not rated
GitHub

About

An MCP server for connecting to any ODBC-compliant database via SQLAlchemy, supporting various DBMS backends.

Details

Author
OpenLinkSoftware
GitHub stars
24
Downloads
250
Categories
Database, Other

- List schema names from the connected database
- Retrieve table information by schema or default
- Describe table structure including columns, keys, and nullability
- Search tables by name substring
- Execute stored procedures (Virtuoso-specific)
- Run SQL queries returning JSONL or Markdown table results

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Server ODBC via SQLAlchemy
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, install dependencies with uv, configure an ODBC DSN in ~/.odbc.ini, set environment variables (ODBC_DSN, ODBC_USER, ODBC_PASSWORD, API_KEY), and run mcp-sqlalchemy-server. For Claude Desktop, add the server to claude_desktop_config.json as shown in the README.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp server odbc via sqlalchemy": {
            "my_database": {
                "command": "uv",
                "args": [
                    "--directory",
                    "/path/to/mcp-sqlalchemy-server",
                    "run",
                    "mcp-sqlalchemy-server"
                ],
                "env": {
                    "DB_URL": "virtuoso+pyodbc://user:password@VOS"
                }
            }
        }
    }
}

McpServers

{
    "my_database": {
        "command": "uv",
        "args": [
            "--directory",
            "/path/to/mcp-sqlalchemy-server",
            "run",
            "mcp-sqlalchemy-server"
        ],
        "env": {
            "DB_URL": "virtuoso+pyodbc://user:password@VOS"
        }
    }
}

MCP Server ODBC via SQLAlchemy

A lightweight MCP (Model Context Protocol) server for ODBC built with FastAPI, pyodbc, and SQLAlchemy. This server is compatible with Virtuoso DBMS and other DBMS backends that implement a SQLAlchemy provider.

mcp-client-and-servers|648x499

---

Features

- Get Schemas: Fetch and list all schema names from the connected database.
- Get Tables: Retrieve table information for specific schemas or all schemas.
- Describe Table: Generate a detailed description of table structures, including:
- Column names and data types
- Nullable attributes
- Primary and foreign keys
- Search Tables: Filter and retrieve tables based on name substrings.
- Execute Stored Procedures: In the case of Virtuoso, execute stored procedures and retrieve results.
- Execute Queries:
- JSONL result format: Optimized for structured responses.
- Markdown table format: Ideal for reporting and visualization.

---

Prerequisites

1. Install uv:

   pip install uv

Or use Homebrew:
   brew install uv

2. unixODBC Runtime Environment Checks:

1. Check installation configuration (i.e., location of key INI files) by running: odbcinst -j
2. List available data source names by running: odbcinst -q -s

3. ODBC DSN Setup: Configure your ODBC Data Source Name (~/.odbc.ini) for the target database. Example for Virtuoso DBMS:

   [VOS]
Description = OpenLink Virtuoso
Driver = /path/to/virtodbcu_r.so
Database = Demo
Address = localhost:1111
WideAsUTF16 = Yes

3. SQLAlchemy URL Binding: Use the format:

   virtuoso+pyodbc://user:password@VOS

---

Installation

Clone this repository:

git clone https://github.com/OpenLinkSoftware/mcp-sqlalchemy-server.git
cd mcp-sqlalchemy-server

Environment Variables


Update your .envby overriding the defaults to match your preferences
ODBC_DSN=VOS
ODBC_USER=dba
ODBC_PASSWORD=dba
API_KEY=xxx

---

Configuration

For Claude Desktop users:
Add the following to claude_desktop_config.json:

{
"mcpServers": {
"my_database": {
"command": "uv",
"args": ["--directory", "/path/to/mcp-sqlalchemy-server", "run", "mcp-sqlalchemy-server"],
"env": {
"ODBC_DSN": "dsn_name",
"ODBC_USER": "username",
"ODBC_PASSWORD": "password",
"API_KEY": "sk-xxx"
}
}
}
}

---

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.