Content
# mcp-server-Sql
## Project Introduction
This is a SQL service application based on Spring Boot, designed to execute SQL queries and write the results to files. The service is part of the Spring AI MCP (Model, Chat, Prompt) framework, providing functionalities for SQL query and update operations.
## Features
- Execute SQL queries and write results to CSV files
- Perform SQL update operations (INSERT, UPDATE, DELETE) and return the number of affected rows
- Support for custom database connection configurations
- Integrated with the Spring AI MCP framework, can be used as an AI tool
## Tech Stack
- Java 17
- Spring Boot 3.4.3
- Spring AI 1.0.0-M6
- MySQL 8.0
- HikariCP connection pool
- Lombok
## Quick Start
### Configure Database
Configure your database connection information in the `application.yml` file:
```yaml
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
```
### Build the Project
```bash
mvn clean package
```
### Run the Application
```bash
java -jar target/mcp-server-Sql-1.0-SNAPSHOT.jar
```
## Usage Examples
### Execute SQL Query
```json
{
"sql": "SELECT * FROM users",
"outputPath": "./output/users.csv"
}
```
### Execute SQL Update Operation
```json
{
"sql": "UPDATE users SET name='John' WHERE id=1",
"outputPath": "./output/update_result.txt"
}
```
## Notes
- Ensure the output directory exists or has permission to create
- SQL query results will be saved in CSV format
- Update operation results will include the number of affected rows and execution time
Connection Info
You Might Also Like
X Video Transcript
X / Twitter 视频文案提取 MCP Server — 专注解析 X 平台公开视频链接(x.com / twitter.com status...
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
worldmonitor
Real-time global intelligence dashboard. AI-powered news aggregation,...
OmniRoute
Never stop coding. The free AI gateway — one endpoint, 160+ providers, zero...
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.