OP

OpenLink SQLAlchemy PyODBC DBMS MCP Server

Connect to DBMS via SQLAlchemy PyODBC using OpenLink on the MCP server for secure, high-performance generic database access and driver management.

Quick Install
npx -y @OpenLinkSoftware/mcp-sqlalchemy-server

Overview

The OpenLink SQLAlchemy PyODBC DBMS MCP Server exposes generic database access and driver management through the Model Context Protocol (MCP). It combines SQLAlchemy’s ORM and core capabilities with PyODBC and OpenLink ODBC drivers so you can connect to many DBMS backends using a single, managed server process. By centralizing driver configuration, credential handling, and connection pooling on an MCP server, clients (including LLM-based agents) can request SQL execution, schema discovery, or driver operations without bundling DB drivers locally.

This design is useful when you need secure, high-performance, multi-database capabilities in environments where clients are lightweight (e.g., microservices, chatbots, or notebook front-ends). The server handles DSN/driver details, connection setup, and result serialization while exposing a compact MCP-compatible tool surface that other systems can call over HTTP/JSON or the MCP messaging pattern.

Features

  • Generic DB access via SQLAlchemy + PyODBC and OpenLink drivers
  • Centralized ODBC driver and DSN management
  • Support for multiple database dialects (RDBMS agnostic via SQLAlchemy)
  • Connection pooling and performance optimizations handled server-side
  • Secure credential handling (env/config driven) and optional TLS
  • MCP-compatible tool exposure for easy integration with model agents and orchestration systems
  • Lightweight deployment: runs as a single Python service

Installation / Configuration

Clone the repository, create a Python virtual environment, install dependencies, then configure environment variables or a .env file.

Example steps:

# Clone and enter the repo
git clone https://github.com/OpenLinkSoftware/mcp-sqlalchemy-server.git
cd mcp-sqlalchemy-server

# Create and activate a virtualenv (POSIX)
python -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Basic .env example (adjust values to your environment):

# .env
MCP_HOST=0.0.0.0
MCP_PORT=8080

# Database connection parameters - use your DSN/driver
DB_DSN=my_database_dsn
DB_USER=db_user
DB_PASS=supersecret

# PyODBC/OpenLink driver name (URL-encode spaces when used in SQLAlchemy URI)
ODBC_DRIVER=OpenLink+ODBC+Driver

# TLS (optional)
TLS_CERT=/path/to/cert.pem
TLS_KEY=/path/to/key.pem

Example SQLAlchemy connection URI using PyODBC and an OpenLink driver:

# Format (example for a database that supports DSN):
# dialect+pyodbc://user:password@dsn?driver=ODBC+Driver+Name

DATABASE_URL = "mssql+pyodbc://db_user:supersecret@my_database_dsn?driver=OpenLink+ODBC+Driver"

Starting the server (generic example — consult the repository for the exact entrypoint):

# Example: run with Python
python -m mcp_sqlalchemy_server

# Or run with an ASGI server like uvicorn if provided
uvicorn mcp_sqlalchemy_server.app:app