MCP server that converts SQL field definitions into Java entity code

MCP server that converts SQL field definitions into Java entity code

sqltocode•bymays-jl

A Spring Boot service using Spring AI MCP Server that exposes a SQL-to-Java code conversion tool callable by MCP-compatible clients over SSE or stdio.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Converts a simplified CREATE TABLE field list into a Java class annotated with @Data.
  • •Maps common SQL types such as BIGINT, INT, VARCHAR, DECIMAL and DATETIME to Java types.
  • •Enables tool, resource, prompt and completion MCP capabilities, connecting via SSE or stdio.
  • •Registers additional tools through MethodToolCallbackProvider and allows extending type mapping.

BEST FOR

  • •Generating Java entity classes from database table field definitions.
  • •Invoking SQL-to-Java conversion from MCP-compatible clients such as Claude, Cursor or VS Code extensions.

ABOUT SQLTOCODE

MCP server that converts SQL field definitions into Java entity code is cataloged as an MCP server attributed to mays-jl. A Spring Boot service using Spring AI MCP Server that exposes a SQL-to-Java code conversion tool callable by MCP-compatible clients over SSE or stdio. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server that converts SQL field definitions into Java entity code are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How can MCP clients connect to this server?

Clients can connect over SSE at the /mcp/messages endpoint, or via stdio by disabling the web application type in application.yml.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 0756638dee95 · 采集于 2026-11-13 12:44:24 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

SqlToCode MCP Server

项目简介

SqlToCode 是一个基于 Spring Boot 3.4 与 Spring AI MCP Server Starter 构建的示例服务,提供 SQL 字段定义 → Java 实体代码 的自动化转换能力。项目通过 @Tool 注解将 SqlToCodeService 暴露为 MCP 工具,可以被兼容 MCP 协议的客户端(如 Claude、Cursor、vscode 扩展等)直接调用。

功能特性

  • SQL→Java 自动转换:将简化后的 CREATE TABLE 字段列表转换为带 @Data 注解的 Java 类。
  • 类型映射内置:支持 BIGINT / INT / VARCHAR / DECIMAL / DATETIME 等常见 SQL 类型自动映射至 Java 类型。
  • 标准 MCP 能力:已开启 tool / resource / prompt / completion 能力,可通过 SSE 或 stdio 模式对接。
  • 日志与配置:默认将运行日志输出到 data/log/SqlToCode.log,方便排查。

技术栈

  • Java 17
  • Spring Boot 3.4.3
  • Spring AI MCP Server & WebFlux Starter
  • Lombok
  • Maven

目录结构

├─src/main/java/cn/maysjl/ai
│ ├─Application.java         // Spring Boot 启动类
│ ├─config/ToolConfig.java   // 注册 MCP ToolCallbackProvider
│ ├─model/                   // 请求/响应模型
│ └─service/SqlToCodeService // 核心 SQL→Code 逻辑
├─src/main/resources/application.yml
├─data/log/SqlToCode.log
└─pom.xml

环境要求

  • JDK 17+
  • Maven 3.9+

快速开始

  1. 克隆与编译

    git clone <repo-url>
    cd SqlToCode
    mvn clean package -DskipTests
    
  2. 运行服务

    mvn spring-boot:run
    

    默认监听 http://localhost:8701,同时暴露 MCP SSE 端点 /mcp/messages。

  3. MCP 客户端接入

    • SSE:配置客户端指向 http://localhost:8701/mcp/messages。
    • stdio:可在 application.yml 中取消注释 spring.main.web-application-type: none 并按需调整。

工具入参示例

{
  "codeType": "java",
  "sqlTableName": "Product",
  "sql": [
    { "name": "id", "type": "BIGINT" },
    { "name": "name", "type": "VARCHAR(100)" },
    { "name": "price", "type": "INT" }
  ]
}

工具返回示例

{
  "codeType": "java",
  "resCode": "import lombok.Data;\n\n@Data\npublic class Product {\n\n    private Long id;\n    private String name;\n    private Integer price;\n}"
}

配置说明

  • server.port: 默认 8701,可自行修改。
  • spring.ai.mcp.server.*: MCP 服务器的名称、版本、能力与 SSE 端点。按需调整 instructions 以向客户端描述工具用途。
  • logging.file.name: 日志文件位置,默认落盘到 data/log/SqlToCode.log。

开发与调试

  • 修改 SqlToCodeService.sqlToJavaType 可扩展类型映射。
  • 通过 MethodToolCallbackProvider 可以继续注册更多工具。
  • 如需添加资源/提示词等 MCP 能力,可在 application.yml 中开启对应配置并实现相关组件。

后续规划

  • 支持更多编程语言(如 Kotlin、TypeScript DTO)。
  • 根据完整 CREATE TABLE 语句自动解析字段列表,减少手工输入。
  • 增加单元测试覆盖核心类型映射逻辑。

欢迎根据业务需要进行二次开发,如有问题可直接提 issue 或与作者联系。

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server that converts SQL field definitions into Java entity code from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/sqltocode)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools