mcp-pyodbc
A simple MCP ODBC server using FastAPI, ODBC and PyODBC.
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:
-
Install uv (Python package): pip install uv
-
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
-
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
-
Start the MCP server (using uv as shown in the config): uv run mcp-pyodbc-server
-
Optional: set environment variables to configure DSN and credentials as needed, for example in a .env file that you load before starting the server.
-
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
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP