oracle-sqlplus-mcp
oracle-sqlplus-mcp
一个使用 sqlplus 作为连接后端的 Oracle 数据库 MCP (Model Context Protocol) 服务器。无需 Oracle Instant Client Node.js 绑定 —— 只需要一个可用的 sqlplus 二进制文件。
先决条件
sqlplus 必须已安装并可在
PATH中找到(随 Oracle Instant Client 或完整 Oracle 客户端提供)Node.js 18+
Related MCP server: sqlserver-mcp-colossal
安装
npm install -g oracle-sqlplus-mcp
# or run directly with npx (no install needed):
npx oracle-sqlplus-mcp连接字符串格式
username/password@host:port/servicename示例:
scott/tiger@localhost:1521/ORCL
myuser/mypass@192.168.1.10:1521/XEPDB1
admin/secret@db.example.com:1521/PRODClaude Desktop 配置
添加到你的 claude_desktop_config.json 中:
{
"mcpServers": {
"oracle": {
"command": "npx",
"args": ["-y", "oracle-sqlplus-mcp"],
"env": {
"ORACLE_CONNECTION": "username/password@host:port/servicename"
}
}
}
}可选环境变量
变量 | 默认值 | 描述 |
| (必需) | 完整连接字符串 |
|
| 如果不在 PATH 中,则指定 sqlplus 二进制文件的路径 |
|
| 查询超时时间(毫秒) |
自定义 sqlplus 路径示例
{
"mcpServers": {
"oracle": {
"command": "npx",
"args": ["-y", "oracle-sqlplus-mcp"],
"env": {
"ORACLE_CONNECTION": "scott/tiger@192.168.1.10:1521/ORCL",
"SQLPLUS_PATH": "C:\\oracle\\instantclient_21_9\\sqlplus.exe",
"QUERY_TIMEOUT_MS": "60000"
}
}
}
}可用工具
工具 | 描述 |
| 测试连接并返回 Oracle 版本 |
| 列出所有模式及其表计数 |
| 列出表,可选择按模式或名称模式过滤 |
| 显示列、数据类型、可空性、主键 |
| 从表中获取示例行 |
| 运行任何 SELECT 查询 |
| 运行 DDL/DML (INSERT, UPDATE, DELETE, CREATE 等) |
| 列出存储过程、函数、包 |
示例提示词
"Test the Oracle connection" (测试 Oracle 连接)
"List all schemas in the database" (列出数据库中的所有模式)
"Show me tables in the SCOTT schema" (显示 SCOTT 模式下的表)
"Describe the EMPLOYEES table" (描述 EMPLOYEES 表)
"Get 5 sample rows from HR.EMPLOYEES" (从 HR.EMPLOYEES 获取 5 行示例数据)
"Run this query: SELECT * FROM departments WHERE department_id < 50" (运行此查询:SELECT * FROM departments WHERE department_id < 50)
"List all stored procedures in the HR schema" (列出 HR 模式下的所有存储过程)
故障排除
sqlplus: command not found
将 SQLPLUS_PATH 设置为 sqlplus 二进制文件的完整路径。
ORA-12541: TNS:no listener
检查主机、端口以及 Oracle 监听器是否正在运行。
ORA-01017: invalid username/password
验证凭据。连接字符串格式:user/pass@host:port/service。
SP2-0306: Invalid option
确保 sqlplus 版本支持 -S 静默模式(所有现代版本均支持)。
Available Tools
8 toolsdescribe_tableA
Describe the columns, data types and constraints of a table.
Inputs: table_name (required).
execute_ddlA
Execute a DDL or DML statement (CREATE, INSERT, UPDATE, DELETE, ALTER, DROP). Use with caution — changes are committed immediately.
Inputs: statement (required).
execute_queryA
Execute a SQL SELECT query against the Oracle database and return the results. Use standard Oracle SQL syntax. Do NOT include a trailing semicolon — it is added automatically.
Inputs: query (required).
get_table_sampleA
Fetch a sample of rows from a table (default: 10 rows).
Inputs: table_name (required), limit.
list_proceduresA
List stored procedures and functions for a given schema.
Inputs: schema.
list_schemasA
List all schemas (users/owners) in the database that have at least one table.
Inputs: no named parameters.
list_tablesB
List all tables accessible to the current user, optionally filtered by schema/owner.
Inputs: schema, search.
test_connectionA
Test the Oracle connection and return server version info.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Every tool has a clearly distinct purpose: describing tables, executing DDL, running queries, sampling rows, listing procedures, schemas, tables, and testing connections. No overlapping functionality.
All tool names follow a consistent verb_noun pattern with underscores (e.g., describe_table, list_tables), making them easy to parse and predict.
Eight tools is an appropriate number for a database interaction server, covering essential operations without being overwhelming or too sparse.
The toolset covers core database operations (querying, DDL/DML, listing objects, describing, sampling) but lacks capabilities like viewing procedure source code or managing users, which are minor gaps.
Maintenance
Related MCP Connectors
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseBqualityCmaintenanceMCP server for accessing Oracle databases, enabling schema exploration, query execution, and performance analysis.12MIT
- AlicenseNot gradedqualityNot gradedmaintenanceA comprehensive MCP server for SQL Server database operations, enabling CRUD operations, schema exploration, and stored procedure execution through natural language.7 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server to connect to Oracle databases and run SQL queries (up to 150 rows) via a single 'query' tool.ISC
- AlicenseAqualityCmaintenanceMCP server for Oracle Database enabling AI assistants to explore schemas, run queries, write data, and monitor sessions via natural language. Features read-only mode by default and uses Oracle Thin mode for zero-install connectivity.102MIT