The OpenLink MCP Server for ODBC provides Large Language Models with transparent access to ODBC-accessible data sources through a Data Source Name configured for a specific ODBC Connector. It functions as a TypeScript layer built on top of node-odbc
that routes calls to the host system's local ODBC Driver Manager.
node.js
version. If it's not 21.1.0
or higher, upgrade or install explicitly using:
nvm install v21.1.0
npm install @modelcontextprotocol/sdk zod tsx odbc dotenv
nvm
version using:
nvm alias default 21.1.0
git clone https://github.com/OpenLinkSoftware/mcp-odbc-server.git
cd mcp-odbc-server
npm init -y
npm install @modelcontextprotocol/sdk zod tsx odbc dotenv
odbcinst -j
odbcinst -q -s
Create a .env
file in the same directory as the MCP server with the following settings:
API_KEY=sk-xxx
ODBC_DSN=Local Virtuoso
ODBC_USER=dba
ODBC_PASSWORD=dba
ODBCINI=/Library/ODBC/odbc.ini
After installation, the following tools will be available to MCP client applications:
Name | Description |
---|---|
get_schemas |
List database schemas accessible to connected database management system |
get_tables |
List tables associated with a selected database schema |
describe_table |
Provide the description of a table including column names, data types, etc. |
filter_table_names |
List tables based on a substring pattern from the q input field |
query_database |
Execute a SQL query and return results in JSON Lines format |
execute_query |
Execute a SQL query and return results in JSON Lines format |
execute_query_md |
Execute a SQL query and return results in Markdown table format |
spasql_query |
Execute a SPASQL query and return results |
sparql_query |
Execute a SPARQL query and return results |
virtuoso_support_ai |
Interact with the Virtuoso Support Assistant/Agent |
get_schemas
user
(optional): Database username, defaults to "demo"password
(optional): Database password, defaults to "demo"dsn
(optional): ODBC data source name, defaults to "Local Virtuoso"get_tables
schema
(optional): Database schema to filter tablesuser
(optional): Database usernamepassword
(optional): Database passworddsn
(optional): ODBC data source namefilter_table_names
q
(required): The substring to search for in table namesschema
(optional): Database schema to filter tablesuser
, password
, dsn
(optional): Connection parametersdescribe_table
schema
(required): Database schema nametable
(required): Table name to describeuser
, password
, dsn
(optional): Connection parametersquery_database
query
(required): SQL query stringuser
, password
, dsn
(optional): Connection parametersquery_database_md
query
(required): SQL query stringuser
, password
, dsn
(optional): Connection parametersquery_database_jsonl
query
(required): SQL query stringuser
, password
, dsn
(optional): Connection parametersspasql_query
(Virtuoso-specific)
query
(required): SPASQL query stringmax_rows
(optional): Maximum rows to return, defaults to 20timeout
(optional): Query timeout in ms, defaults to 30000user
, password
, dsn
(optional): Connection parameterssparql_query
(Virtuoso-specific)
query
(required): SPARQL query stringformat
(optional): Result format, defaults to 'json'timeout
(optional): Query timeout in ms, defaults to 30000user
, password
, dsn
(optional): Connection parametersvirtuoso_support_ai
(Virtuoso-specific)
prompt
(required): Prompt text for the AI functionapi_key
(optional): API key for the AI serviceuser
, password
, dsn
(optional): Connection parametersODBCINI=/Library/ODBC/odbc.ini npx -y @modelcontextprotocol/inspector npx tsx ./src/main.ts
git clone [email protected]:OpenLinkSoftware/inspector.git
cd inspector
npm run start
tsx /path/to/mcp-odbc-server/src/main.ts
If you encounter architecture conflicts:
nvm uninstall 21.1.0
arch
If it returns x86_64, switch to arm64:
arch arm64
nvm install 21.1.0
If you see "incompatible architecture" errors:
Verify Node.js is running in ARM64 mode:
node -p "process.arch" # Should output: arm64
Install unixODBC for ARM64:
which brew # Should point to /opt/homebrew/bin/brew
brew uninstall --force unixodbc
arch -arm64 brew install unixodbc
Rebuild the Node.js ODBC module:
cd /path/to/mcp-odbc-server
rm -rf node_modules/odbc
export npm_config_arch=arm64
npm install odbc --build-from-source
Verify the module architecture:
file node_modules/odbc/lib/bindings/napi-v8/odbc.node
# Should show "arm64" instead of "x86_64"
Create or edit ~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"ODBC": {
"command": "/path/to/.nvm/versions/node/v21.1.0/bin/node",
"args": [
"/path/to/mcp-odbc-server/node_modules/.bin/tsx",
"/path/to/mcp-odbc-server/src/main.ts"
],
"env": {
"ODBCINI": "/Library/ODBC/odbc.ini",
"NODE_VERSION": "v21.1.0",
"PATH": "~/.nvm/versions/node/v21.1.0/bin:${PATH}"
},
"disabled": false,
"autoApprove": []
}
}
}
Create or edit ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
:
{
"mcpServers": {
"ODBC": {
"command": "/path/to/.nvm/versions/node/v21.1.0/bin/node",
"args": [
"/path/to/mcp-odbc-server/node_modules/.bin/tsx",
"/path/to/mcp-odbc-server/src/main.ts"
],
"env": {
"ODBCINI": "/Library/ODBC/odbc.ini",
"NODE_VERSION": "v21.1.0",
"PATH": "/path/to/.nvm/versions/node/v21.1.0/bin:${PATH}"
},
"disabled": false,
"autoApprove": []
}
}
}
Execute the following query: SELECT TOP * from Demo..Customers
Execute the following query: SELECT TOP 5 * from Demo..Customers
@odbc {your-query-prompt}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "odbc" '{"command":"node","args":["node_modules/.bin/tsx","src/main.ts"],"env":{"ODBCINI":"/Library/ODBC/odbc.ini","NODE_VERSION":"v21.1.0","PATH":"~/.nvm/versions/node/v21.1.0/bin:${PATH}"},"disabled":false,"autoApprove":[]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"odbc": {
"command": "node",
"args": [
"node_modules/.bin/tsx",
"src/main.ts"
],
"env": {
"ODBCINI": "/Library/ODBC/odbc.ini",
"NODE_VERSION": "v21.1.0",
"PATH": "~/.nvm/versions/node/v21.1.0/bin:${PATH}"
},
"disabled": false,
"autoApprove": []
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"odbc": {
"command": "node",
"args": [
"node_modules/.bin/tsx",
"src/main.ts"
],
"env": {
"ODBCINI": "/Library/ODBC/odbc.ini",
"NODE_VERSION": "v21.1.0",
"PATH": "~/.nvm/versions/node/v21.1.0/bin:${PATH}"
},
"disabled": false,
"autoApprove": []
}
}
}
3. Restart Claude Desktop for the changes to take effect