npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wangy_as/query-db-oracle

v1.0.0

Published

Oracle数据库查询工具 for MCP

Downloads

12

Readme

@wangy_as/query-db-oracle

MCP (Model Context Protocol) Oracle数据库查询工具

项目描述

这是一个为 MCP 生态系统开发的 Oracle 数据库查询工具。它提供了命令行界面,可以方便地进行 Oracle 数据库查询操作,并与 Model Context Protocol SDK 无缝集成。

安装方法

全局安装(使用 npm):

npm install -g @wangy_as/query-db-oracle

或使用 yarn:

yarn global add @wangy_as/query-db-oracle

主要功能

  • Oracle 数据库查询功能
  • 集成 MCP SDK
  • 命令行界面(基于 yargs)
  • 使用 TypeScript 和 Zod 实现类型安全

依赖项

使用说明

运行工具

可以通过 npx 或直接运行构建后的文件来使用该工具。

使用 npx

npx query-db-oracle --user system --password your_password --serviceName ORCL

直接运行

  1. 构建项目:

    npm run build
  2. 运行工具:

    ./build/index.js --user system --password your_password --serviceName ORCL

配置参数

在 MCP 服务器中使用本工具时,需要配置以下数据库连接参数:

  • --host: Oracle 服务器地址(默认:localhost)
  • --port: Oracle 服务器端口(默认:1521)
  • --user: Oracle 用户名(必填)
  • --password: Oracle 密码(必填)
  • --serviceName: Oracle 服务名(必填)
  • --connectString: Oracle 连接字符串(可选,如果提供则忽略其他连接参数)

可用功能

工具提供四个主要功能:

  1. execute-query: 执行 SELECT 查询语句

    • 用于查询数据的只读操作
    • 返回查询结果的 JSON 格式数据
  2. execute-non-query: 执行 INSERT、UPDATE、DELETE 语句

    • 用于修改数据的操作
    • 返回操作结果的影响行数等信息
  3. get-tables: 获取数据库中的所有表清单

    • 返回表名、表空间、行数等信息
  4. get-table-structure: 获取指定表的字段结构信息

    • 返回字段名、数据类型、长度、是否可为空等信息

Oracle客户端配置

在使用前,需要确保已安装 Oracle Instant Client 并设置环境变量:

# 设置Oracle客户端库路径
export ORACLE_CLIENT_LIB=/path/to/oracle/instantclient

错误处理

工具会自动处理以下情况:

  • 数据库连接失败
  • SQL 语句执行错误
  • 参数验证错误

如果遇到错误,会在控制台输出详细的错误信息。

注意事项

  1. 确保 Oracle 数据库服务器已经启动并可访问
  2. 确保提供的数据库用户具有足够的操作权限
  3. 建议在生产环境中使用专门的数据库用户,避免使用系统账户
  4. 密码等敏感信息建议通过环境变量或配置文件传入,避免在命令行中明文显示
  5. Oracle 数据库区分大小写,表名和字段名通常使用大写

许可证

ISC

作者

wangy_as