# mcp-sqlalchemy-server

> mcp-sqlalchemy-server is an open-source MCP server for databases. MCP server giving AI clients SQL, schema and SPARQL access to ODBC and SQLAlchemy. It is available on CLI, API, Self-hosted, Linux, macOS and Windows.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, Self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/openlinksoftware/mcp-sqlalchemy-server
- **GitHub stars:** 25
- **License:** MIT
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-01

## About

This server lets an MCP-compatible AI client inspect and query relational databases reached through ODBC and SQLAlchemy. It is built on FastAPI, pyodbc and SQLAlchemy, and is aimed at Virtuoso but also documents connection URLs for PostgreSQL, MySQL and SQLite.

Once a data source name is configured under unixODBC, the server exposes tools to list schemas and tables, describe columns with types, nullability and keys, search table names by substring, and run SQL queries with results returned as JSON Lines or Markdown tables. Virtuoso-specific tools add SPARQL and SPASQL queries, stored procedure calls and access to the Virtuoso support assistant.

It suits developers and data teams who want an assistant to explore a database schema and run queries from a chat client such as Claude Desktop, with credentials supplied through environment variables.

## Features

- **Schema and table discovery:** Lists schemas and tables, and filters table names by a substring.
- **Table structure description:** Reports column names, data types, nullability, primary keys and foreign keys.
- **SQL query execution:** Runs SQL and returns rows as JSON Lines or as a Markdown table.
- **Virtuoso SPARQL and SPASQL:** Runs SPARQL and hybrid SPASQL queries against Virtuoso with row limits and timeouts.
- **Stored procedure calls:** Executes stored procedures on Virtuoso and returns their results.
- **Environment-based credentials:** Takes DSN, user and password from environment variables or per-call parameters.

## Good for

- Letting an AI assistant explore an unfamiliar database schema before writing queries
- Generating Markdown tables of query results for reports
- Querying a Virtuoso instance with SPARQL from a chat client
- Debugging a database connection through the MCP Inspector

## Tools

From the tool list in its README, going by the names, 2 of 10 tools change data; 2 names don't say. From the server's own tool labels and tool names; not verified by us.

- `podbc_get_schemas` (name suggests: reads): List database schemas accessible to the connected DBMS.
- `podbc_get_tables` (name suggests: reads): List tables associated with a selected database schema.
- `podbc_describe_table` (name suggests: reads): Describe columns, data types, nulls, autoincrement, primary and foreign keys of a table.
- `podbc_filter_table_names`: List tables whose names contain a given substring.
- `podbc_query_database` (name suggests: reads): Execute a SQL query and return results in JSONL format.
- `podbc_execute_query` (name suggests: changes): Execute a SQL query and return results in JSONL format.
- `podbc_execute_query_md` (name suggests: changes): Execute a SQL query and return results as a Markdown table.
- `podbc_spasql_query` (name suggests: reads): Execute a SPASQL query and return results.
- `podbc_sparql_query` (name suggests: reads): Execute a SPARQL query and return results.
- `podbc_virtuoso_support_ai`: Interact with the Virtuoso Support Assistant.

## FAQ

### Which databases does mcp-sqlalchemy-server support?

Virtuoso is the primary target. The documentation also gives tested connection URL formats for PostgreSQL, MySQL and SQLite.

### How is mcp-sqlalchemy-server configured?

Set up an ODBC data source name, then provide ODBC_DSN, ODBC_USER and ODBC_PASSWORD through environment variables or the MCP client configuration.

### What output formats do query tools return?

Query results can be returned as JSON Lines or as a Markdown table.

### Is mcp-sqlalchemy-server free?

Yes. mcp-sqlalchemy-server is open source, so you can use and self-host it for free.

### What are the best alternatives to mcp-sqlalchemy-server?

The closest alternatives to mcp-sqlalchemy-server are mcp-odbc-server, mcp-jdbc-server, mcp-alchemy, sql-query-mcp and mysql_mcp_server.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [mcp-odbc-server](https://ai-powered.com/mcp/mcp-odbc-server): mcp-odbc-server is an open-source MCP server for databases.
- [mcp-jdbc-server](https://ai-powered.com/mcp/mcp-jdbc-server): mcp-jdbc-server is an open-source MCP server for databases.
- [mcp-alchemy](https://ai-powered.com/mcp/mcp-alchemy): mcp-alchemy is an open-source MCP server for databases.
- [sql-query-mcp](https://ai-powered.com/mcp/sql-query-mcp): sql-query-mcp is an open-source MCP server for databases.
- [mysql_mcp_server](https://ai-powered.com/mcp/mysql-mcp-server-4): mysql_mcp_server is an open-source MCP server for databases.
- [MCP Server Mssql](https://ai-powered.com/mcp/mcp-server-mssql): MCP Server Mssql is an open-source MCP server for databases.
- [Fastmcp Sqltools](https://ai-powered.com/mcp/fastmcp-sqltools): Fastmcp Sqltools is an open-source MCP server for databases.
- [legion-mcp](https://ai-powered.com/mcp/legion-mcp): legion-mcp is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/mcp-sqlalchemy-server
