Connect to Databases via ODBC
Connect AI to databases via ODBC using PyODBC. Access schemas, tables, and execute SQL queries. Compatible with Virtuoso and other DBMS.
Why it matters
Access and query any database with an ODBC driver using a lightweight MCP server. Enables data retrieval, schema inspection, and SQL execution for diverse database systems.
Outcomes
What it gets done
Connect to databases using ODBC drivers.
Retrieve database schemas and table structures.
Execute SQL queries and retrieve results in various formats.
Integrate with Virtuoso DBMS for advanced SPASQL and AI features.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-openlink-generic-python-open-database-connectivity | bash Capabilities
Tools your agent gets
Get a list of database schemas available for the connected DBMS
Get a list of tables associated with the selected database schema
Provide a description of a table including column names, data types, and constraints
Get a list of tables based on a substring pattern from the selected database schema
Execute an SQL query and return results in JSON format
Execute an SQL query and return results in JSONL format
Execute an SQL query and return results in Markdown table format
Execute a SPASQL query and return results for Virtuoso DBMS
Interact with Virtuoso support assistant for LLM interaction
Overview
OpenLink Generic Python Open Database Connectivity MCP Server
What it does
This lightweight MCP server provides access to databases through ODBC using PyODBC. It enables interaction with database schemas, tables, and execution of SQL queries, returning results in various formats.
How it connects
Use this connector when you need to access relational databases through ODBC. This includes scenarios like data analysis, information retrieval, or populating knowledge bases with structured data. Do not use this connector if your database does not support ODBC.
Installation guide
A lightweight MCP server that provides access to databases through ODBC using PyODBC, compatible with Virtuoso DBMS and any DBMS with ODBC drivers.
Installation
From source code
git clone https://github.com/OpenLinkSoftware/mcp-pyodbc-server.git
cd mcp-pyodbc-server
Prerequisites - uv installation
pip install uv
Prerequisites - uv via Homebrew
brew install uv
Configuration
Claude Desktop
{
"mcpServers": {
"my_database": {
"command": "uv",
"args": ["--directory", "/path/to/mcp-pyodbc-server", "run", "mcp-pyodbc-server"],
"env": {
"ODBC_DSN": "dsn_name",
"ODBC_USER": "username",
"ODBC_PASSWORD": "password",
"API_KEY": "sk-xxx"
}
}
}
}
ODBC DSN Configuration
[VOS]
Description = OpenLink Virtuoso
Driver = /path/to/virtodbcu_r.so
Database = Demo
Address = localhost:1111
WideAsUTF16 = Yes
Available Tools
| Tool | Description |
|---|---|
podbc_get_schemas |
Get a list of database schemas available for the connected database management system (DBMS) |
podbc_get_tables |
Get a list of tables associated with the selected database schema |
podbc_describe_table |
Provide a description of a table, including column names, data types, null handling, auto-increment... |
podbc_filter_table_names |
Get a list of tables based on a substring pattern from the q field, associated with the selected database... |
podbc_query_database |
Execute an SQL query and return results in JSON format |
podbc_execute_query |
Execute an SQL query and return results in JSONL format |
podbc_execute_query_md |
Execute an SQL query and return results in Markdown table format |
podbc_spasql_query |
Execute a SPASQL query and return results (function specific to Virtuoso) |
podbc_virtuoso_support_ai |
Interaction with Virtuoso support assistant/agent for LLM interaction |
Features
- Schema retrieval: Extract and output all schema names from the connected database
- Table retrieval: Extract table information for specific schemas or all schemas
- Table description: Generate detailed descriptions of table structure with column information, nullable attributes, primary and foreign keys
- Table search: Filter and retrieve tables based on name substrings
- Stored procedure execution: Execute stored procedures when connected to Virtuoso
- Query execution: Support for JSONL results format and Markdown table format
- SPASQL support: Execute hybrid SQL/SPARQL queries (specific to Virtuoso)
- AI assistant integration: LLM interaction capabilities specific to Virtuoso
Environment Variables
Required
ODBC_DSN- ODBC data source name for connecting to the databaseODBC_USER- Database username for authenticationODBC_PASSWORD- Database password for authentication
Optional
API_KEY- API key for integration with AI services
Notes
ODBC driver setup and configuration is required. Compatible with Virtuoso DBMS and any DBMS with ODBC drivers. Includes MCP Inspector for troubleshooting: npm install -g @modelcontextprotocol/inspector and run with npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-pyodbc-server run mcp-pyodbc-server
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.