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

@kohlarnhin/context-ex

v1.0.1

Published

Smart Programming Specification Manager - AI-Optimized with 2 Super Tools

Readme

Context-Ex

AI 编程规范管理器 - 让 AI 按照你的规范写代码

npm version License: MIT Node.js

这是什么?

Context-Ex 是一个 MCP(Model Context Protocol)服务器,为 Claude、GPT 等 AI 提供编程规范管理合规验证能力。

核心价值:将你团队的编程规范、代码风格、架构约定等注入 AI 的工作流程,确保 AI 生成的代码符合你的标准。

亮点

1. Index-First 设计,省 Token

传统方式:把所有规范一次性塞给 AI → Token 爆炸

Context-Ex 方式:

specs.tags (标签列表,~500 tokens)
    ↓
specs.query (规范索引,无正文)
    ↓
specs.get (按需拉取正文)

2. 智能标签体系

65+ 内置标签,覆盖主流技术栈:

| 分类 | 示例标签 | |------|----------| | 语言 | language:java, language:ts, language:sql | | 框架 | framework:spring, framework:mybatis-plus | | 分层 | layer:controller, layer:service, layer:dao | | 主题 | topic:validation, topic:null-handling, topic:exceptions | | 策略 | policy:no-side-effects, policy:user-confirmation |

3. 合规验证闭环

代码修改后自动触发验证,输出相关规范清单,确保 AI 复核代码合规性。

安装

npm install @kohlarnhin/context-ex

MCP 配置

Claude Desktop / Cursor

{
  "mcpServers": {
    "context-ex": {
      "command": "npx",
      "args": ["@kohlarnhin/context-ex"]
    }
  }
}

本地开发

{
  "mcpServers": {
    "context-ex": {
      "command": "node",
      "args": ["/your/path/to/context-ex/dist/cli.js"]
    }
  }
}

MCP 工具

Context-Ex 提供 2 个精简工具,共 5 个 actions

specs - 规范管理

| Action | 用途 | 输出 | |--------|------|------| | tags | 获取标签字典 | 标签名、描述、使用计数 | | query | 搜索规范索引 | 编号、标题、摘要(无正文) | | get | 获取规范正文 | 完整内容 |

validate - 合规验证

| Action | 用途 | 输出 | |--------|------|------| | check | 触发合规检查 | 相关规范清单 | | status | 查看验证状态 | 上次检查时间等 |

使用示例

// 1. 获取所有标签
await specs({ action: "tags" });

// 2. 按标签搜索(支持多标签 OR 查询)
await specs({
  action: "query",
  params: { tags: ["language:java", "layer:service"] }
});

// 3. 获取规范正文
await specs({
  action: "get",
  params: { numbers: [1, 6, 12] }
});

// 4. 修改代码后验证合规性
await validate({
  action: "check",
  params: { currentFile: "src/UserService.java" }
});

工作流程

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│ specs.tags  │ ──▶ │ specs.query  │ ──▶ │ specs.get   │
│ (~500 tok)  │     │ (索引检索)    │     │ (按需拉取)   │
└─────────────┘     └──────────────┘     └─────────────┘
                                                │
                                                ▼
┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│   完成任务   │ ◀── │ 修复违规代码  │ ◀── │ 编写/修改代码 │
└─────────────┘     └──────────────┘     └─────────────┘
       ▲                   ▲                    │
       │                   │                    ▼
       │            ┌──────────────┐     ┌─────────────┐
       └────────────│  存在违规?   │ ◀── │validate.check│
           (否)     └──────────────┘     └─────────────┘
                           │(是)
                           ▼
                    ┌──────────────┐
                    │ specs.get    │
                    │ (查看违规规范) │
                    └──────────────┘

数据存储

  • 数据库:SQLite
  • 默认路径~/.context-ex/specifications.db
  • 自定义路径:设置环境变量 CONTEXT_EX_DB_PATH
  • 只读模式:设置环境变量 CONTEXT_EX_READONLY=1

本地开发

git clone https://github.com/kohlarnhin/context-ex.git
cd context-ex
npm install
npm run build
npm start

技术栈

  • 运行时:Node.js >= 18
  • 协议:MCP (Model Context Protocol)
  • 数据库:SQLite (better-sqlite3)
  • 类型系统:TypeScript + Zod

许可证

MIT