Home / MCP / MCP SQLAlchemy MCP Server

MCP SQLAlchemy MCP Server

Provides ODBC access via SQLAlchemy to Virtuoso and similar DBMS with query, describe, and SP/SQL execution capabilities.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "mcp_sqlalchemy": {
            "command": "uv",
            "args": [
                "--directory",
                "/path/to/mcp-sqlalchemy-server",
                "run",
                "mcp-sqlalchemy-server"
            ],
            "env": {
                "ODBC_DSN": "VOS",
                "ODBC_USER": "dba",
                "ODBC_PASSWORD": "dba",
                "API_KEY": "xxx"
            }
        }
    }
}

You run an MCP server that exposes ODBC access via SQLAlchemy, enabling you to query Virtuoso and other SQLAlchemy-backed DBMS through a lightweight FastAPI-based service. This guide walks you through using the server with an MCP client, installing it locally, configuring connections, and leveraging the provided data access tools.

How to use

Connect to the MCP server from an MCP client using the server’s stdio command configuration or a configured HTTP endpoint if available. You can list schemas, inspect tables, describe table structures, filter table names, and execute queries or stored procedures against the connected database. The available tools return results in JSON, Markdown, or JSONL formats as appropriate.

How to install

# Prerequisites
python3 --version
python3 -m ensurepip --upgrade
pip3 --version

# Install the runtime/adapter utilities
pip3 install uv
# Ensure ODBC runtime is available and configured on your system
# Check ODBC installation configuration and available DSNs as part of setup in practice
```,
# Optional: verify environment variables for the MCP server (adjust values to your environment)
# ODBC_DSN is the DSN name configured for Virtuoso or target DB
# ODBC_USER and ODBC_PASSWORD are credentials for the DSN
# API_KEY is used for client authentication with the MCP server
export ODBC_DSN=VOS
export ODBC_USER=dba
export ODBC_PASSWORD=dba
export API_KEY=your_api_key_here
```,

Additional sections

The MCP server supports a suite of actions that you can invoke from your MCP client. Its toolset includes schema and table discovery, detailed table description, name-based table filtering, and multiple query result formats to suit reporting and integration needs.

Configuration

Configure your Claude Desktop or MCP client to run the server using the provided runtime command and environment variables. The example below shows how to start the MCP server using the runtime runner with the appropriate environment bindings.

Troubleshooting

If you encounter issues, verify that the ODBC DSN is reachable, the credentials are correct, and the server process has the required permissions to access the database. Check the MCP client logs for errors related to authentication, DSN resolution, or query execution.

Notes

Keep your API key secure and rotate credentials regularly. When running in production, consider restricting access to the MCP server endpoints and implementing proper network controls to prevent unauthorized usage.

Available tools

podbc_get_schemas

List database schemas accessible to the connected DBMS

podbc_get_tables

List tables within a selected schema or all schemas

podbc_describe_table

Describe a table's columns, data types, nullability, and keys

podbc_filter_table_names

Filter tables by a substring within their names

podbc_query_database

Execute a SQL query and return results as JSON

podbc_query_database_md

Execute a SQL query and return results as Markdown

podbc_query_database_jsonl

Execute a SQL query and return results as JSONL

podbc_spasql_query

Execute a SPASQL query (Virtuoso-specific)

podbc_sparql_query

Execute a SPARQL query (Virtuoso-specific)

podbc_virtuoso_support_ai

Virtuoso AI assistant interaction for support prompts