Sponsored by Deepsite.site

mcp-server-Sql

Created By
cherry-SC8 months ago
这是一个基于Spring Boot的SQL服务应用,用于执行SQL查询并将结果写入文件。该服务作为Spring AI MCP(Model, Chat, Prompt)框架的一部分,提供了SQL查询和更新操作的功能。
Content

mcp-server-Sql

项目介绍

这是一个基于Spring Boot的SQL服务应用,用于执行SQL查询并将结果写入文件。该服务作为Spring AI MCP(Model, Chat, Prompt)框架的一部分,提供了SQL查询和更新操作的功能。

功能特性

  • 执行SQL查询并将结果写入CSV文件
  • 执行SQL更新操作(INSERT, UPDATE, DELETE)并返回影响的行数
  • 支持自定义数据库连接配置
  • 集成Spring AI MCP框架,可作为AI工具使用

技术栈

  • Java 17
  • Spring Boot 3.4.3
  • Spring AI 1.0.0-M6
  • MySQL 8.0
  • HikariCP 连接池
  • Lombok

快速开始

配置数据库

application.yml文件中配置您的数据库连接信息:

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/your_database?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
    username: your_username
    password: your_password

构建项目

mvn clean package

运行应用

java -jar target/mcp-server-Sql-1.0-SNAPSHOT.jar

使用示例

执行SQL查询

{
  "sql": "SELECT * FROM users",
  "outputPath": "./output/users.csv"
}

执行SQL更新操作

{
  "sql": "UPDATE users SET name='John' WHERE id=1",
  "outputPath": "./output/update_result.txt"
}

注意事项

  • 确保输出目录存在或有权限创建
  • SQL查询结果将以CSV格式保存
  • 更新操作结果将包含影响的行数和执行时间
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Playwright McpPlaywright MCP server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
WindsurfThe new purpose-built IDE to harness magic
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
ChatWiseThe second fastest AI chatbot™
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs