mcp-db
A Spring AI-based MCP capable of executing any SQL query. 一个基于 Spring AI 的MCP服务,可执行任意 SQL。
claude mcp add --transport stdio jamessmith888-mcp-db-server bash -lc ./mvnw spring-boot:run \ --env JAVA_HOME="path to JDK 21+"
How to use
MCP-DB is a Spring AI-based MCP server that can execute arbitrary SQL across multiple databases. It exposes an SSE-based transport, allowing multiple clients to connect and issue SQL commands through the MCP protocol. To use it, start the server, then configure your MCP client to point to the SSE endpoint at the server’s URL (by default http://localhost:6789/sse). You can connect with the mcp-db-server configuration in your client, enabling you to run queries against one or more configured data sources. The server supports multiple databases, with a data source configuration file enabling distinct connections, and it provides Groovy script extension capabilities for custom functionality. It also enforces SQL safety controls to prevent dangerous operations from being executed by AI models.
In practice, you’ll typically start the server, configure your AI client’s MCP section with the server URL, and define your DataSource in src/main/resources/datasource.yml. When connected, you can select the target data source and execute SQL via the MCP interface, benefiting from multi-database support, source-level security checks, and optional Groovy script-based extensions for advanced capabilities.
How to install
Prerequisites:
- Java Development Kit (JDK) 21 or newer
- Git
- Maven wrapper (mvnw) or Maven installed
Install steps:
-
Clone the repository git clone https://github.com/JamesSmith888/mcp-db-server.git cd mcp-db-server
-
Ensure executable permissions (if needed) chmod +x mvnw
-
Start the server (development mode) ./mvnw spring-boot:run
-
Verify the server is running
- Check console output for a message indicating the server is listening (often on port 6789 for SSE)
-
Optional: configure your environment for SSE client access
- Prepare your client configuration to point to http://localhost:6789/sse
-
If you prefer Docker/native packaging later, build or pull the corresponding image as needed
Additional notes
Notes and tips:
- The server supports multiple databases via the datasource.yml configuration file. Ensure you define your data sources and set a default source if needed.
- SSE mode allows multiple clients to connect concurrently; if you need to ensure compatibility with certain clients, verify they support SSE and the server’s authentication (if configured).
- You can extend functionality via Groovy scripts as documented in EXTENSIONS.md; this enables custom operators, data handling, or pre/post SQL processing.
- Ensure Java 21+ is available in your environment (JDK 21+ is required for this project).
- If you encounter connection issues, verify that the host/port (default 6789) is reachable and that any firewall rules allow SSE traffic.
- Data source configuration is stored in src/main/resources/datasource.yml; review and edit to add your own databases and credentials.
Related MCP Servers
ai-code-helper
2025 年 AI 编程助手实战项目(作者:程序员鱼皮),基于 Spring Boot 3.5 + Java 21 + LangChain4j + AI 构建智能编程学习与求职辅导机器人,覆盖 AI 大模型接入、LangChain4j 核心特性、流式对话、Prompt 工程、RAG 检索增强、向量数据库、Tool Calling 工具调用、MCP 模型上下文协议、Web 爬虫、安全防护、Vue.js 前端开发、SSE 服务端推送等企业级 AI 应用开发技术。帮助开发者掌握 AI 时代必备技能,熟悉 LangChain 框架,提升编程学习效率和求职竞争力,成为企业需要的 AI 全栈开发人才。
sonarqube
SonarQube MCP Server
api2mcp4j
This is a revolutionary AI MCP plugin with excellent pluggable and encapsulated features. With just a few lines of configuration, it can easily integrate into your Spring boot web program and give it MCP capabilities,inheriting the powerful engineering capabilities of the Spring series framework
WigAI
Bitwig Controller Extension that provides an MCP Server for AI Agent control
jolokia
Let LLMs manage your Java application via JMX/Jolokia 🌶️
auto -client
基于Spring AI 封装了 mcp-client 服务,目的使web网页智能体也能通过 stdio 和 HTTP SSE(Server-Sent Events) 与 MCP Server 进行交互。项目实现了自动化的连接管理机制,包括自动初始化连接、健康检查、超时关闭以及链接复用等功能