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

qcc-dev-cli

v1.0.0

Published

企业信息查询 CLI 工具 - 支持 MCP 服务和 Legacy API

Downloads

43

Readme

qcc-cli

企业信息查询命令行工具,支持 MCP 服务和 API 两种调用方式。

功能特性

  • 双模式架构:同时支持 MCP 服务(推荐)和 API(兼容)
  • 动态更新qcc update 从服务器动态获取最新工具列表
  • 简化命令:服务名从 endpoint 自动提取(company 而非 qcc_company
  • 参数验证:白名单验证 + 必填参数检查,拒绝无效参数
  • 配置驱动:接口定义由配置文件管理,新增接口无需修改代码
  • 统一鉴权:自动处理认证,MCP 使用 Authorization,API 使用 MD5 签名
  • Markdown 输出:MCP 调用结果自动格式化为 Markdown,支持 --json 原始输出
  • 安全设计:敏感信息遮蔽,配置文件权限自动设置

安装

从 npm 安装(推荐)

npm install -g qcc-dev-cli
qcc --version  # 验证安装成功

开发模式安装

git clone <repo-url>
cd qcc-cli
npm install
npm link  # 创建全局软链接

快速开始

1. 初始化配置

# MCP 配置(推荐)
qcc init --mcpBaseUrl https://mcp.example.com/api --authorization your-token

# API 配置(兼容模式)
qcc init --baseUrl https://api.qichacha.com --key your-key --secretKey your-secret

2. 检查配置状态

qcc check

输出示例:

✓ 配置文件: /home/user/.qcc/config.json

MCP 模式:
  ✓ baseUrl: https://mcp.example.com/api
  ✓ authorization: [已配置]

API 模式:
  ○ 已禁用 (api.enabled=false)

3. 更新工具信息

qcc update

4. 查询企业信息

# MCP 模式(推荐)
qcc company get_company_registration_info --searchKey "企查查科技股份有限公司"
qcc ipr get_patent_info --searchKey "企查查科技股份有限公司"

# 输出原始 JSON 格式
qcc company get_company_registration_info --searchKey "企查查" --json

# API 模式(兼容)
qcc 886 "企业名称"
qcc 410 --keyword "企业名称"

命令参考

| 命令 | 说明 | |------|------| | qcc init | 初始化配置 | | qcc check | 检查配置状态(双模式) | | qcc config set <key> <value> | 设置配置项 | | qcc config get <key> | 获取配置项 | | qcc config list | 列出所有配置 | | qcc list | 显示 API 接口列表 | | qcc list-tools [server] | 显示 MCP 工具列表 | | qcc update | 更新 MCP 工具缓存 | | qcc <server> <tool> | 调用 MCP 工具 | | qcc <apiCode> | 调用 API |

MCP 服务

可用服务

| 服务 | 描述 | 工具数 | |------|------|--------| | company | 企业基础信息 | 12 | | ipr | 企业知识产权 | 6 | | operation | 企业经营信息 | 13 | | risk | 企业风险信息 | 34 |

调用示例

# 查询企业工商信息
qcc company get_company_registration_info --searchKey "企查查科技股份有限公司"

# 查询企业股东
qcc company get_shareholder_info --searchKey "企查查科技股份有限公司"

# 查询企业专利
qcc ipr get_patent_info --searchKey "企查查科技股份有限公司"

# 查询企业招投标
qcc operation get_bidding_info --searchKey "企查查科技股份有限公司"

# 查询企业风险
qcc risk get_risk_info --searchKey "企查查科技股份有限公司"

API 接口

| 编码 | 名称 | 说明 | |------|------|------| | 886 | 企业模糊搜索 | 根据关键词搜索企业 | | 410 | 企业工商信息 | 查询企业工商登记信息 | | 2001 | 企业信息核验 | 核验企业信息准确性 | | 2003 | 客户身份识别 | 金融机构客户身份核实 | | 2006 | 综合风险排查 | 检查企业风险情况 |

配置

配置文件路径:~/.qcc/config.json

{
  "version": "2.1",
  "mcp": {
    "enabled": true,
    "baseUrl": "MCP服务基础地址",
    "authorization": "Authorization Token",
    "timeout": 30000
  },
  "api": {
    "enabled": false,
    "baseUrl": "API基础地址",
    "key": "AppKey",
    "secretKey": "SecretKey"
  }
}

配置命令

# 启用/禁用模式
qcc config set mcp.enabled true
qcc config set api.enabled true

# 设置 MCP 配置
qcc config set mcp.baseUrl https://mcp.example.com/api
qcc config set mcp.authorization "Bearer token"

# 设置 API 配置
qcc config set api.baseUrl https://api.example.com
qcc config set api.key your-key
qcc config set api.secretKey your-secret

# 查看配置
qcc config list
qcc config get mcp.baseUrl

安全说明

  • 配置文件权限自动设置为 600(仅所有者可读写)
  • 敏感信息在命令输出中显示为 [已配置]

项目结构

qcc-cli/
├── bin/
│   └── index.js              # CLI 入口(简化版)
├── src/
│   ├── cliSetup.js           # CLI 命令注册逻辑
│   ├── commands/
│   │   ├── list.js           # API 接口列表
│   │   ├── list-tools.js     # MCP 工具列表
│   │   ├── init.js           # 初始化配置
│   │   ├── invoke.js         # API 调用
│   │   ├── call-mcp.js       # MCP 工具调用
│   │   ├── update.js         # 更新工具缓存
│   │   ├── config.js         # 配置管理命令
│   │   └── check.js          # 检查配置状态
│   ├── services/
│   │   ├── mcpService.js     # MCP 协议调用
│   │   ├── configService.js  # 配置管理
│   │   └── apiService.js     # API 调用
│   ├── config/
│   │   ├── mcpServers.json   # MCP 服务定义
│   │   ├── mcpTools.js       # MCP 工具定义
│   │   └── apiList.json      # API 接口配置
│   └── utils/
│       ├── httpClient.js     # HTTP 客户端
│       ├── cacheUtils.js     # 工具缓存读写
│       ├── jsonToMarkdown.js # JSON 转 Markdown
│       └── validator.js      # 输入验证
├── tests/                    # 测试文件(覆盖率 82%+)
└── CLAUDE.md                 # 项目指南

开发

# 安装依赖
npm install

# 运行测试
npm test

# 测试覆盖率
npm run test:coverage

# 代码检查
npm run lint

变更日志

v2.3.0 (2026-03-20)

命名规范化

  • 配置项命名调整:legacy.*api.*
  • MCP 配置命名调整:endpointbaseUrlauthTokenauthorization

新增功能

  • 新增 qcc config 命令,支持设置/获取/列出配置项
  • qcc check 根据 enabled 字段智能检查配置
  • qcc init 支持配置文件损坏检测和处理

配置改进

  • 配置版本升级到 2.1
  • api.enabled 默认为 false,需手动启用

v2.2.0 (2026-03-20)

架构优化

  • 切断循环依赖,提取 cacheUtils.js
  • 删除冗余的 userConfig.js,统一配置管理
  • 服务层不再直接退出进程,改为抛出错误
  • 拆分入口文件,命令注册移至 cliSetup.js
  • 统一 mcpService.js 导出风格

功能增强

  • qcc check 支持双模式检查
  • MCP 模式新增参数验证
  • 敏感信息遮蔽
  • 配置文件权限自动设置

性能优化

  • 消除 update 命令的重复网络请求

测试改进

  • 覆盖率从 63.53% 提升到 82.03%
  • 测试数量从 132 增加到 211

v2.1.0 (2026-03-19)

新增功能

  • MCP 调用结果自动格式化为 Markdown 输出
  • 新增 --json 参数,支持输出原始 JSON 格式

v2.0.0 (2026-03-19)

新增功能

  • 支持 MCP 服务调用
  • 新增 qcc updateqcc list-tools 命令
  • 服务名简化:从 qcc_company 改为 company

架构改进

  • 双模式架构:MCP 模式 + API 模式
  • 统一配置管理,支持 v1.x 配置自动迁移
  • 工具信息缓存机制

License

MIT