MCP Server ODBC via SQLAlchemy logo

MCP Server ODBC via SQLAlchemy

by OpenLinkSoftware

A lightweight MCP server for ODBC built with FastAPI, pyodbc, and SQLAlchemy. This server is compatible with Virtuoso DBMS and other DBMS backends that implement a SQLAlchemy provider.

View on GitHub

Last updated: N/A

What is MCP Server ODBC via SQLAlchemy?

An MCP server that provides access to ODBC data sources using SQLAlchemy. It allows you to interact with databases like Virtuoso, PostgreSQL, MySQL, and SQLite through a standardized protocol.

How to use MCP Server ODBC via SQLAlchemy?

  1. Configure your ODBC DSN. 2. Install the necessary dependencies (uv, pyodbc). 3. Clone the repository and configure environment variables. 4. Run the server using uv run mcp-sqlalchemy-server. 5. Use the provided tools to interact with the database.

Key features of MCP Server ODBC via SQLAlchemy

  • Get Schemas

  • Get Tables

  • Describe Table

  • Search Tables

  • Execute Stored Procedures (Virtuoso)

  • Execute Queries (JSONL, Markdown)

Use cases of MCP Server ODBC via SQLAlchemy

  • Data extraction and transformation

  • Reporting and visualization

  • Integration with AI tools like Claude

  • Database schema exploration

  • Executing SQL/SPARQL queries

FAQ from MCP Server ODBC via SQLAlchemy

What databases are supported?

The server supports any database with a SQLAlchemy provider, including Virtuoso, PostgreSQL, MySQL, and SQLite.

How do I configure the server to connect to my database?

You need to configure an ODBC DSN and set the appropriate environment variables (ODBC_DSN, ODBC_USER, ODBC_PASSWORD).

What query formats are supported?

The server supports executing standard SQL queries and returning results in JSONL and Markdown table formats. It also supports SPASQL and SPARQL queries for Virtuoso.

What is the purpose of the API_KEY environment variable?

The API_KEY is used for authentication and authorization. It's required to access certain tools and features.

How can I troubleshoot issues with the server?

You can use the MCP Inspector to troubleshoot server interactions. Install it using npm install -g @modelcontextprotocol/inspector and run it with npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-sqlalchemy-server run mcp-sqlalchemy-server.