MCP Alchemy
A MCP (model context protocol) server that gives the LLM access to and knowledge about relational databases like SQLite, Postgresql, MySQL & MariaDB, Oracle, and MS-SQL.
Overview
MCP-Alchemy is a Python server implementing the Model Context Protocol (MCP) for SQL database operations, designed to give Machine Learning Models access to relational databases like SQLite, PostgreSQL, MySQL, MariaDB, Oracle, and MS-SQL.
To use MCP-Alchemy, clone the repository, set up the appropriate database connection details in the environment variables, and run the server using the provided command structure in your configuration file.
- Execute SQL queries with readable vertical output format. - Introspect database schemas and column relationships. - List and filter tables in the database. - Handle large result sets with smart truncation. - Allow full result access via Claude Desktop artifacts. - Clean handling of NULL values and date formats.
- Integrating LLMs with SQL databases for enhanced data retrieval.
- Simplifying SQL query execution and output formatting for developers.
- Facilitating database introspection and schema management for data engineers.
Add to your AI client
Use these steps to connect MCP Alchemy in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mcp-alchemy-runekaagaard": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-alchemy-runekaagaard"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mcp-alchemy-runekaagaard": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-alchemy-runekaagaard"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcp-alchemy-runekaagaard": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-alchemy-runekaagaard"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcp-alchemy-runekaagaard": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-alchemy-runekaagaard"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-alchemy-runekaagaard": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-alchemy-runekaagaard"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcp-alchemy-runekaagaard": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-alchemy-runekaagaard"
]
}
}
}FAQ
**What databases are supported?**
MCP-Alchemy supports any SQLAlchemy compatible database, including MySQL, PostgreSQL, SQLite, Oracle, and MS-SQL.
**Do I need to install anything to run MCP-Alchemy?**
Yes, you need to set up your database connection details via environment variables as outlined in the documentation before running the server.
**Is there a limit on the query length supported by MCP-Alchemy?**
Yes, the default maximum output length is 4000 characters, but this can be increased by setting the `EXECUTE_QUERY_MAX_CHARS` environment variable.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":492,"uuid":"c33a8ac8-dbf0-42a7-af10-57143a83e392","name":"mcp-alchemy","title":"MCP Alchemy","description":"A MCP (model context protocol) server that gives the LLM access to and knowledge about relational databases like SQLite, Postgresql, MySQL & MariaDB, Oracle, and MS-SQL.","avatar_url":"https://avatars.githubusercontent.com/u/378464?v=4","created_at":"2024-12-30T02:51:28.378+00:00","updated_at":"2025-01-05T02:55:05.678+00:00","status":"created","author_name":"runekaagaard","author_avatar_url":"https://avatars.githubusercontent.com/u/378464?v=4","tags":"[]","category":"databases","is_featured":false,"sort":1,"url":"https://github.com/runekaagaard/mcp-alchemy","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/23a40cb4140c34c70e1dcfbb69c537ea7583f269533f1d16e60743f321cbcecc/68747470733a2f2f7777772e70756c73656d63702e636f6d2f62616467652f746f702d7069636b2f72756e656b616167616172642d616c6368656d79","type":null,"metadata":"{\"star\":\"218\",\"license\":\"MPL-2.0 license\",\"language\":\"Python\",\"is_official\":false,\"latest_commit_time\":\"2025-05-23 17:06:22\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]