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 🙏

© 2025 – Pkg Stats / Ryan Hefner

sqg-mcp-server

v1.0.7

Published

SQG MCP Server - Spring Boot project initialization tools

Downloads

22

Readme

SQG MCP Server

这是一个 Model Context Protocol (MCP) 服务器,专门提供 Spring Boot 项目初始化相关的工具。

安装

通过 npm 安装(推荐)

npm install -g sqg-mcp-server

从源码安装

git clone https://github.com/sqg/sqg-mcp-server.git
cd sqg-mcp-server
npm install
npm run build

功能特性

  1. get-init-project-metadata - 获取 Spring Boot 项目初始化的可配置参数和依赖信息
  2. init-project - 初始化 Spring Boot 项目
  3. generate-db-code - 根据数据库表结构生成 Java 实体类、Mapper 接口、XML 映射文件和 Service 层代码

使用方法

在 Claude Desktop 中使用

  1. 找到 Claude Desktop 的配置文件:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  2. 添加服务器配置(推荐使用 npx 方式):

方式一:使用 npx(推荐,无需安装)

{
  "mcpServers": {
    "sqg-mcp-server": {
      "command": "npx",
      "args": ["-y", "sqg-mcp-server"],
      "env": {}
    }
  }
}

方式二:全局安装后使用

{
  "mcpServers": {
    "sqg-mcp-server": {
      "command": "sqg-mcp-server",
      "env": {}
    }
  }
}

方式三:从源码安装

{
  "mcpServers": {
    "sqg-mcp-server": {
      "command": "node",
      "args": ["你的项目路径/dist/index.js"],
      "env": {}
    }
  }
}
  1. 重启 Claude Desktop

使用方式对比

| 方式 | 优点 | 缺点 | 适用场景 | |------|------|------|----------| | npx | 无需安装,自动获取最新版本 | 首次启动稍慢 | 推荐给普通用户 | | 全局安装 | 启动快速,离线可用 | 需要手动更新版本 | 频繁使用者 | | 源码安装 | 可自定义修改 | 需要手动构建和维护 | 开发者 |

命令行使用

如果全局安装,可以直接运行:

sqg-mcp-server

手动测试

你可以使用我们提供的测试脚本:

npm test

或者手动与服务器交互。服务器通过标准输入输出进行 JSON-RPC 通信。

工具使用示例

get-init-project-metadata 工具

获取所有可用的配置参数和依赖信息:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get-init-project-metadata",
    "arguments": {}
  }
}

获取特定 Spring Boot 版本的配置参数:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "get-init-project-metadata",
    "arguments": {
      "bootVersion": "2.7.0"
    }
  }
}

init-project 工具

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "init-project",
    "arguments": {
      "artifactId": "my-spring-app",
      "name": "My Spring Application",
      "groupId": "com.example",
      "packageName": "com.example.myapp",
      "targetDirectory": "./my-project"
    }
  }
}

更多使用示例请参考:

安装和运行

# 安装依赖
npm install

# 构建项目
npm run build

# 启动服务器
npm start

# 运行测试
npm test

或者使用开发模式(自动构建并运行):

npm run dev

项目结构

mcp-server-demo/
├── src/
│   └── index.ts          # 主要的 MCP server 代码
├── dist/                 # 编译后的 JavaScript 文件
├── package.json          # 项目配置和依赖
├── tsconfig.json         # TypeScript 配置
└── README.md            # 项目说明

代码说明

主要组件

  1. Server 实例: 使用 @modelcontextprotocol/sdk 创建的 MCP server
  2. 工具定义: 定义了 init-project 工具及其输入模式
  3. 请求处理器:
    • ListToolsRequestSchema - 处理工具列表请求
    • CallToolRequestSchema - 处理工具调用请求
  4. 传输层: 使用 StdioServerTransport 进行标准输入输出通信

工具示例

Init-Project 工具

{
  name: "init-project",
  description: "初始化 Spring Boot 项目",
  inputSchema: {
    type: "object",
    properties: {
      language: { type: "string", description: "编程语言", default: "java" },
      datasource: { type: "string", description: "数据源类型", default: "double" },
      bootVersion: { type: "string", description: "Spring Boot 版本", default: "2.6.6" },
      groupId: { type: "string", description: "Maven Group ID", default: "com.sqg" },
      artifactId: { type: "string", description: "Maven Artifact ID", default: "example" },
      // ... 更多参数
    },
    required: []
  }
}

Generate-DB-Code 工具

{
  name: "generate-db-code",
  description: "根据数据库表结构生成 Java 实体类、Mapper 接口、XML 映射文件和 Service 层代码",
  inputSchema: {
    type: "object",
    properties: {
      configFile: { type: "string", description: "配置文件路径", default: "" },
      tables: { type: "string", description: "要生成的表名,多个表名用逗号分隔", default: "" },
      outputDir: { type: "string", description: "输出目录路径", default: "./generated" },
      dbUrl: { type: "string", description: "数据库连接URL", default: "" },
      username: { type: "string", description: "数据库用户名", default: "" },
      password: { type: "string", description: "数据库密码", default: "" }
    },
    required: []
  }
}

依赖说明

  • @modelcontextprotocol/sdk: MCP 官方 TypeScript SDK
  • typescript: TypeScript 编译器
  • @types/node: Node.js 类型定义

许可证

MIT