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

baigod-context

v1.0.1

Published

MCP Server for dynamic context injection - supports tiny-boot and other frameworks documentation

Readme

baigod-context

npm version License: MIT

MCP Server for Dynamic Context Injection - 为Cursor AI提供框架文档的智能上下文注入

支持tiny-boot等框架的文档查询和代码生成辅助,让AI能够基于真实的框架文档生成准确的代码。

🎯 核心功能

  • 智能识别: 自动从用户提示词中提取框架名称和技术分类
  • 动态注入: 实时从后端服务获取最新框架文档
  • 精准生成: AI基于真实文档生成可用代码,避免虚构API
  • 多框架支持: 支持tiny-boot、Spring Boot等多个框架
  • 易于扩展: 通过后端服务轻松添加新框架文档

📦 安装

方式1: 全局安装 (推荐)

最稳定的方式,避免npx缓存问题:

npm install -g baigod-context

Cursor配置:

{
  "mcpServers": {
    "baigod-context": {
      "command": "baigod-context",
      "env": {
        "JAVA_SERVICE_URL": "http://localhost:8080"
      }
    }
  }
}

方式2: 使用npx

无需安装,直接使用(可能遇到缓存问题):

{
  "mcpServers": {
    "baigod-context": {
      "command": "npx",
      "args": ["-y", "baigod-context"],
      "env": {
        "JAVA_SERVICE_URL": "http://localhost:8080"
      }
    }
  }
}

如果遇到npx缓存问题:

rm -rf ~/.npm/_npx
npm cache clean --force

方式3: 本地开发

用于本地测试和开发:

git clone https://github.com/baigod/baigod-context
cd baigod-context
npm install
npm link

Cursor配置同方式1。

🚀 快速开始

1. 启动后端文档服务

baigod-context需要配合后端服务使用。你可以:

选项A: 使用我们提供的示例服务

git clone https://github.com/baigod/baigod-context-backend
cd baigod-context-backend
./mvnw spring-boot:run

选项B: 自己实现后端服务

后端服务需要提供以下REST API:

  • POST /api/documents/search - 搜索文档
  • GET /api/documents/frameworks - 获取框架列表
  • GET /api/documents/categories - 获取分类列表

详见后端API规范

2. 配置Cursor

编辑 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "baigod-context": {
      "command": "npx",
      "args": ["-y", "baigod-context"],
      "env": {
        "JAVA_SERVICE_URL": "http://localhost:8080"
      }
    }
  }
}

3. 重启Cursor

完全退出并重新打开Cursor。

4. 测试

在Cursor中输入:

请帮我使用tiny-boot框架实现使用redis缓存设备信息

AI会自动调用MCP工具获取tiny-boot的Redis文档,并生成准确的代码!

🎓 使用示例

示例1: 查询框架文档

提示词:

请帮我使用tiny-boot框架实现使用redis缓存设备信息

效果: AI自动获取tiny-boot的IRedisOperation接口文档,生成包含真实API的代码

示例2: 查询特定功能

提示词:

tiny-boot的Redis消息队列怎么用?

效果: 返回Pub/Sub和ZSet延时队列的文档和示例

示例3: 对比框架

提示词:

比较一下tiny-boot和Spring Boot的Redis使用有什么区别

效果: 同时查询两个框架的文档并进行对比

🛠️ MCP工具

baigod-context提供3个MCP工具:

1. search_framework_docs

搜索框架文档和使用示例。

参数:

  • query (必填): 搜索关键词
  • framework (可选): 框架名称 (如: tiny-boot, spring-boot)
  • category (可选): 文档分类 (如: redis, database, security)

2. get_supported_frameworks

获取系统支持的所有框架列表。

参数: 无

3. smart_context_injection

智能上下文注入工具,自动识别用户意图并注入相关文档。

参数:

  • user_intent (必填): 用户的完整编码意图

🔧 配置选项

环境变量

  • JAVA_SERVICE_URL: 后端文档服务地址 (默认: http://localhost:8080)

Cursor配置示例

{
  "mcpServers": {
    "baigod-context": {
      "command": "npx",
      "args": ["-y", "baigod-context"],
      "env": {
        "JAVA_SERVICE_URL": "http://your-backend-service:8080"
      }
    }
  }
}

📡 后端API规范

POST /api/documents/search

搜索文档接口。

请求:

{
  "query": "redis缓存",
  "framework": "tiny-boot",
  "category": "redis"
}

响应:

{
  "documents": [
    {
      "title": "文档标题",
      "content": "文档内容...",
      "category": "redis",
      "framework": "tiny-boot",
      "relevance": 1.0
    }
  ],
  "totalCount": 1
}

GET /api/documents/frameworks

获取支持的框架列表。

响应:

["tiny-boot", "spring-boot"]

GET /api/documents/categories

获取文档分类列表。

响应:

["redis", "database", "security", "api", "configuration"]

📚 支持的框架

当前内置支持:

  • tiny-boot: 完整的Redis操作文档 (基于IRedisOperation接口)
  • Spring Boot: 标准Redis配置

可以通过后端服务轻松扩展支持更多框架。

🤝 贡献

欢迎提交Issue和Pull Request!

开发

git clone https://github.com/baigod/baigod-context.git
cd baigod-context
npm install
npm run dev

📄 许可证

MIT License

🔗 相关链接

💡 提示

  • MCP Server会在Cursor启动时自动运行
  • 确保后端服务在运行 (默认端口8080)
  • 使用明确的提示词,包含框架名称效果更好
  • 查看后端服务日志可以帮助调试问题

🙏 致谢


作者: BaiGod
版本: 1.0.0
更新: 2025-10-27