{"id":26937476,"url":"https://github.com/OpenLinkSoftware/mcp-sqlalchemy-server","last_synced_at":"2025-04-02T13:15:33.809Z","repository":{"id":283761203,"uuid":"952808023","full_name":"OpenLinkSoftware/mcp-sqlalchemy-server","owner":"OpenLinkSoftware","description":"A simple MCP ODBC server using FastAPI, ODBC and SQLAlchemy.","archived":false,"fork":false,"pushed_at":"2025-03-25T23:44:45.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-26T00:22:55.649Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenLinkSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-21T23:22:23.000Z","updated_at":"2025-03-25T23:44:48.000Z","dependencies_parsed_at":"2025-03-22T02:38:10.327Z","dependency_job_id":null,"html_url":"https://github.com/OpenLinkSoftware/mcp-sqlalchemy-server","commit_stats":null,"previous_names":["openlinksoftware/mcp-server-odbc","openlinksoftware/mcp-sqlalchemy-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLinkSoftware%2Fmcp-sqlalchemy-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLinkSoftware%2Fmcp-sqlalchemy-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLinkSoftware%2Fmcp-sqlalchemy-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLinkSoftware%2Fmcp-sqlalchemy-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenLinkSoftware","download_url":"https://codeload.github.com/OpenLinkSoftware/mcp-sqlalchemy-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246819776,"owners_count":20839095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-02T13:15:16.648Z","updated_at":"2025-04-02T13:15:33.798Z","avatar_url":"https://github.com/OpenLinkSoftware.png","language":"Python","readme":"---\n\n# MCP Server ODBC via SQLAlchemy\n\nA lightweight MCP (Model Context Protocol) 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.\n\n![mcp-client-and-servers|648x499](https://www.openlinksw.com/data/screenshots/mcp-architecture.png)\n\n---\n\n## Features\n\n- **Get Schemas**: Fetch and list all schema names from the connected database.\n- **Get Tables**: Retrieve table information for specific schemas or all schemas.\n- **Describe Table**: Generate a detailed description of table structures, including:\n  - Column names and data types\n  - Nullable attributes\n  - Primary and foreign keys\n- **Search Tables**: Filter and retrieve tables based on name substrings.\n- **Execute Stored Procedures**: In the case of Virtuoso, execute stored procedures and retrieve results.\n- **Execute Queries**:\n  - JSONL result format: Optimized for structured responses.\n  - Markdown table format: Ideal for reporting and visualization.\n\n---\n\n## Prerequisites\n\n1. **Install uv**:\n   ```bash\n   pip install uv\n   ```\n   Or use Homebrew:\n   ```bash\n   brew install uv\n   ```\n\n2. **ODBC DSN Setup**: Configure your ODBC Data Source Name (`~/.odbc.ini`) for the target database. Example for Virtuoso DBMS:\n   ```\n   [VOS]\n   Description = OpenLink Virtuoso\n   Driver = /path/to/virtodbcu_r.so\n   Database = Demo\n   Address = localhost:1111\n   WideAsUTF16 = Yes\n   ```\n\n3. **SQLAlchemy URL Binding**: Use the format:\n   ```\n   virtuoso+pyodbc://user:password@VOS\n   ```\n\n---\n\n## Installation\n\nClone this repository:\n```bash\ngit clone https://github.com/OpenLinkSoftware/mcp-sqlalchemy-server.git\ncd mcp-sqlalchemy-server\n```\n\n---\n\n## Configuration\n\nFor **Claude Desktop** users:\nAdd the following to `claude_desktop_config.json`:\n```json\n{\n  \"mcpServers\": {\n    \"my_database\": {\n      \"command\": \"uv\",\n      \"args\": [\"--directory\", \"/path/to/mcp-sqlalchemy-server\", \"run\", \"mcp-sqlalchemy-server\"],\n      \"env\": {\n        \"DB_URL\": \"virtuoso+pyodbc://user:password@VOS\"\n      }\n    }\n  }\n}\n```\n---\n# Usage \n## Database Management System (DBMS) Connection URLs \nHere are the pyodbc URL examples for connecting to DBMS systems that have been tested using this mcp-server.\n\n| Database      | URL Format                                    |\n|---------------|-----------------------------------------------|\n| Virtuoso DBMS | `virtuoso+pyodbc://user:password@ODBC_DSN`    |\n| PostgreSQL    | `postgresql://user:password@localhost/dbname` |\n| MySQL         | `mysql+pymysql://user:password@localhost/dbname` |\n| SQLite        | `sqlite:///path/to/database.db`               |\nOnce connected, you can interact with your WhatsApp contacts through Claude, leveraging Claude's AI capabilities in your WhatsApp conversations.\n\n## Tools Provided\n\n|name|description|\n|---|---|\n|get_schemas|List database schemas accessible to connected database management system (DBMS).|\n|get_tables|List tables associated with a selected database schema.|\n|describe_table|Provide the description of a table associated with a designated database schema. This includes information about column names, data types, nulls handling, autoincrement, primary key, and foreign keys|\n|filter_table_names|List tables, based on a substring pattern from the `q` input field, associated with a selected database schema.|\n|query_database|Execute a SQL query and return results in JSONL format.|\n|execute_query|Execute a SQL query and return results in JSONL format.|\n|execute_query_md|Execute a SQL query and return results in Markdown table format.|\n|spasql_query|Execute a SPASQL query and return results.|\n|sparql_query|Execute a SPARQL query and return results.|\n|virtuoso_support_ai|Interact with the Virtuoso Support Assistant/Agent -- a Virtuoso-specific feature for interacting with LLMs|\n\n---\n\n## Troubleshooting\n\nFor easier troubleshooting:\n1. Install the MCP Inspector:\n   ```bash\n   npm install -g @modelcontextprotocol/inspector\n   ```\n\n2. Start the inspector:\n   ```bash\n   npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-sqlalchemy-server run mcp-sqlalchemy-server\n   ```\n\nAccess the provided URL to troubleshoot server interactions.\n\n","funding_links":[],"categories":["Databases","Database \u0026 Messaging MCP Servers","MCP 服务器精选列表","🤖 AI/ML","پیاده‌سازی‌های سرور","APIs and HTTP Requests","Table of Contents"],"sub_categories":["SQL Databases","🗄️ 数据库交互","🗄️ \u003ca name=\"databases\"\u003e\u003c/a\u003eپایگاه‌های داده","Databases"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenLinkSoftware%2Fmcp-sqlalchemy-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOpenLinkSoftware%2Fmcp-sqlalchemy-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenLinkSoftware%2Fmcp-sqlalchemy-server/lists"}