Get the FREE Ultimate OpenClaw Setup Guide →

mcp-pyodbc

A simple MCP ODBC server using FastAPI, ODBC and PyODBC.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio openlinksoftware-mcp-pyodbc-server uv run mcp-pyodbc-server \
  --env API_KEY="your-api-key" \
  --env ODBC_DSN="your-dsn-name" \
  --env ODBC_USER="your-db-username" \
  --env ODBC_PASSWORD="your-db-password"

How to use

This MCP server provides an ODBC bridge to a database backend via PyODBC, allowing MCP clients to discover schemas, tables, and metadata, describe tables in detail, filter table names, and execute queries or stored procedures (where supported by the backend). It exposes a set of tools with predictable names such as podbc_get_schemas, podbc_get_tables, podbc_describe_table, podbc_filter_table_names, podbc_query_database, podbc_query_database_md, podbc_query_database_jsonl, podbc_spasql_query, and podbc_virtuoso_support_ai. Clients can request information about the connected database, fetch table lists, obtain column details, and run SQL or SPASQL-like queries, receiving results in JSONL, Markdown, or JSON formats suitable for scripting or visualization.

How to install

Prerequisites:

  • Python, pip, and uv installed on your host
  • A working ODBC driver and a configured DSN for your target database
  • UnixODBC runtime environment installed

Installation steps:

  1. Install uv (Python package): pip install uv

  2. Ensure an ODBC DSN is configured for your database (e.g., in ~/.odbc.ini) and that unixODBC is installed on your system. Verify with: odbcinst -j odbcinst -q -s

  3. Clone the repository and install server dependencies (if any are required by the project): git clone https://github.com/OpenLinkSoftware/mcp-pyodbc-server.git cd mcp-pyodbc-server

  4. Start the MCP server (using uv as shown in the config): uv run mcp-pyodbc-server

  5. Optional: set environment variables to configure DSN and credentials as needed, for example in a .env file that you load before starting the server.

  6. Verify the server is reachable via the MCP client that uses the mcp config you provide.

Additional notes

Tips and common considerations:

  • The ODBC DSN (ODBC_DSN) should point to a database with an appropriate driver installed on the host running the MCP server.
  • If your DSN requires authentication, provide ODBC_USER and ODBC_PASSWORD in the environment or a mounted .env.
  • The API_KEY is optional and can be used by clients that require authentication for MCP access.
  • For Virtuoso-specific features (e.g., SPASQL), ensure the backend supports those capabilities; otherwise, related tools may return appropriate errors.
  • When configuring Claude Desktop or other clients, mirror the mcpServers configuration to ensure the client can initialize the correct server with the right DSN and credentials.
  • If you encounter DSN resolution issues, confirm that the unixODBC directory paths and driver paths are correctly set in odbcinst.ini and odbc.ini.

Related MCP Servers

Sponsor this space

Reach thousands of developers