เซิร์ฟเวอร์ MCP AiToSql | PlugMCP
ข้ามไปยังเนื้อหา ไดเรกทอรี ผลิตภัณฑ์ แหล่งข้อมูล Pricing จากผู้เผยแพร่
เอกสารประกอบ PromptToSql - MCP Server
Description
MCP Server (Model Context Protocol) is a Spring Boot 3+ application that implements a standardized protocol for LLM agents to interact with database systems via JDBC. This server acts as a bridge, transforming static AI knowledge into a dynamic agent capable of retrieving current information and performing actions.
MCP Server - Database Introspection Tool for LLMs (JSON-RPC 2.0)
เสียบเครื่องมือใดก็ได้เข้ากับเอเจนต์ใดก็ได้ ไดเรกทอรี MCP สำหรับคนที่ไม่เขียนเซิร์ฟเวอร์
ผลิตภัณฑ์
ไดเรกทอรี
นักพัฒนา
บริษัท
Key Features
Database Agnostic : Supports Oracle, MySQL, PostgreSQL, and MSSQL
🎯 Automatic Driver Detection : Smart JDBC driver resolution from URL patterns
JSON-RPC 2.0 Transport : Standard communication protocol for MCP
Schema Introspection : Complete database metadata discovery
Secure Querying : SQL injection prevention with READ-ONLY enforcement
Trigger Discovery : Database trigger introspection
Caching : Performance optimization for metadata operations
Performance Metrics : Detailed tokenization and performance tracking
Cost Estimation : Automatic LLM API cost calculation
Technologies
Java 21
Spring Boot 3.2.1
Spring JDBC (JdbcTemplate - NO JPA)
JSON-RPC 2.0
Maven
Architecture com.magacho.aiToSql
├── AiToSqlApplication.java # Main application
├── config/
│ ├── CachingConfig.java # Cache configuration
│ └── McpServerConfig.java # MCP server settings
├── controller/
│ └── McpController.java # JSON-RPC 2.0 endpoint
├── service/
│ ├── SchemaIntrospectionService.java
│ ├── TableDetailsService.java
│ ├── TriggerService.java
│ └── SecureQueryService.java
├── tools/
│ └── McpToolsRegistry.java # MCP tools registry
├── jsonrpc/
│ ├── JsonRpcRequest.java
│ ├── JsonRpcResponse.java
│ └── JsonRpcError.java
└── dto/
├── SchemaStructure.java
├── TableDetails.java
├── TriggerList.java
└── QueryResult.java
🚀 Quick Start
Option 1: Docker (Recommended) 🐳 The easiest way to run the MCP Server is using Docker:
# Pull the image from Docker Hub
docker pull flaviomagacho/aitosql:latest
# Run with PostgreSQL
docker run -d \
--name aitosql-mcp \
-e DB_URL="jdbc:postgresql://your-host:5432/your_db" \
-e DB_USERNAME="readonly_user" \
-e DB_PASSWORD="your_password" \
-p 8080:8080 \
flaviomagacho/aitosql:latest
# Test the server
curl http://localhost:8080/actuator/health
curl http://localhost:8080/mcp/tools/list
Or use Docker Compose for local development :
# Clone the repository
git clone https://github.com/magacho/aiToSql.git
cd aiToSql
# Start with PostgreSQL (or mysql, sqlserver)
docker-compose -f docker-compose-postgres.yml up -d
# View logs
docker-compose -f docker-compose-postgres.yml logs -f mcp-server
# Stop
docker-compose -f docker-compose-postgres.yml down
Option 2: Build from Source
Prerequisites
Java 21+ installed
Maven 3.6+ installed
Database with READ-ONLY user configured
Configuration
1. Add JDBC Driver Edit pom.xml and uncomment the appropriate driver:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
2. Configure Database Connection Edit src/main/resources/application.properties:
# PostgreSQL Example
spring.datasource.url=jdbc:postgresql://localhost:5432/production_db
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.username=mcp_readonly_user
spring.datasource.password=secure_password
CRITICAL SECURITY : The database user MUST have READ-ONLY permissions (SELECT only). This is the primary defense against SQL injection.
Build and Run # Compile
mvn clean install
# Run
mvn spring-boot:run
The server will start at http://localhost:8080
MCP Tools The server exposes 4 tools via JSON-RPC 2.0:
1. getSchemaStructure Get complete database schema with tables and columns.
databaseName (optional): Database name
Returns: Complete schema structure
2. getTableDetails Get detailed information about a specific table.
tableName (required): Table name
Returns: Table details including indexes, foreign keys, and constraints
3. listTriggers List all triggers for a specific table.
tableName (required): Table name
Returns: List of triggers with their definitions
4. secureDatabaseQuery Execute a secure SELECT query.
queryDescription (required): SQL SELECT query
maxRows (optional): Maximum rows to return
Returns: Query results with metadata
Security: Only SELECT statements allowed. Automatically validates and prevents dangerous operations.
JSON-RPC 2.0 Examples
Initialize Session curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "initialize",
"params": {},
"id": 1
}'
List Available Tools curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"params": {},
"id": 2
}'
Get Schema Structure curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "getSchemaStructure",
"arguments": {
"databaseName": "mydb"
}
},
"id": 3
}'
Execute Query curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "secureDatabaseQuery",
"arguments": {
"queryDescription": "SELECT * FROM customers WHERE age > 50",
"maxRows": 100
}
},
"id": 4
}'
Security Features
✅ READ-ONLY database user (primary defense)
✅ SELECT-only validation (rejects INSERT/UPDATE/DELETE/DROP)
✅ Dangerous keyword filtering
✅ Query result limits (prevents resource exhaustion)
✅ Comprehensive logging for audit trails
Benefits of MCP Implementation
Dynamic Agent : LLM goes beyond static knowledge to access real-time data
Standardization : Common protocol for LLM-database interaction
Hallucination Reduction : Access to trusted external data sources
Scalability : Can be deployed to Cloud Run, GKE, or other platforms
Multi-Database : Single interface for Oracle, MySQL, PostgreSQL, MSSQL
Deployment
Docker (Optional) FROM eclipse-temurin:21-jre
COPY target/aiToSql-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
Cloud Run / GKE The server is stateless and can be easily deployed to managed platforms like Google Cloud Run or GKE, connecting to Cloud SQL instances.
📊 Testing & Coverage This project maintains comprehensive test coverage with no mandatory minimum . We focus on tracking coverage evolution across releases:
Run Tests Locally # Run all tests
mvn clean test
# Generate coverage report
mvn jacoco:report
# View report
firefox target/site/jacoco/index.html
CI/CD
✅ Automated tests on every commit
✅ Coverage reports generated automatically
✅ Release workflow with coverage history
✅ No blocking on coverage percentage
Philosophy : Track, don't block. Continuous improvement. 📈
📈 Performance & Metrics The MCP Server includes comprehensive performance tracking and tokenization metrics:
Metrics Endpoints # Get all metrics
curl http://localhost:8080/mcp/metrics
# Reset metrics
curl -X POST http://localhost:8080/mcp/metrics/reset
What is Measured
Execution Time : How long each tool takes to process
Token Estimation : Approximate token count (1 token ≈ 4 chars)
Cost Estimation : Estimated LLM API costs (GPT-4 pricing)
Cache Performance : Cache hit rate for each tool
Response Size : Characters and estimated tokens per response
Documentation
Example Metrics Response {
"tools": {
"getSchemaStructure": {
"totalCalls": 150,
"avgExecutionTimeMs": 45,
"avgTokens": 3125,
"totalCostUSD": 0.001875,
"cacheHitRate": 80.0
}
},
"summary": {
"totalCalls": 1880,
"totalCostUSD": 0.3483,
"averageCostPerCall": 0.00019
}
}
Note : Actual tokenization happens in the LLM Host (Claude, GPT-4, etc.), not in the MCP Server. The server provides estimates for analysis and optimization.
License
Group ID / Artifact ID
Group ID : com.magacho
Artifact ID : aiToSql
คะแนนในไดเรกทอรี 4/100 อยู่ในรายการ 10 จาก 10
อยู่ใน MCP Registry ทางการ 0 จาก 18
ผู้ดูแลอ้างสิทธิ์แล้ว 0 จาก 8
ตอบกลับพร้อมรายการเครื่องมือ 0 จาก 12
ดาวบน GitHub 2 จาก 16
ยอดดาวน์โหลดรายสัปดาห์ 0 จาก 10
Graphify Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, e Private Gpt Complete API layer for private AI applications on local models: RAG, skills, tools, MCP, text-to-sql, and more. Works with any OpenAI-compatible inference server. Scientific Agent Skills Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biolog Open Code Review Secure, fast, efficient, battle-tested at Alibaba's scale. Hybrid architecture code review tool: deterministic pipelines + LLM Agent, precise line-level comments, built-in multi-language ruleset (NPE, Codebase Memory Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection. Orm The Prisma ORM: write your application in TypeScript with human-readable queries instead of SQL. Host your database on Prisma Postgres and your app on Prisma Compute. OpenViking Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills. Context Mode Free, local plugin that keeps tool output out of your coding agent's context window. Sandbox and SQLite FTS5 search, 99% fewer bytes in context. Works with Claude Code, Codex, Pi, OMP, OpenCode, Gemin Dbx 25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Dock Xerj AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory a Wasp The batteries-included full-stack framework for the AI era. Develop JS/TS web apps (React, Node.js, and Prisma) using declarative code that abstracts away complex full-stack features like auth, backgr WrenAI GenBI (Generative BI) for AI agents, an open-source, governed text-to-SQL through an open context layer that turns natural-language questions into trusted dashboards, charts, and SQL across 20+ data s เซิร์ฟเวอร์ MCP หมวด Databases เซิร์ฟเวอร์ MCP ที่ดีที่สุดในหมวด Databases
ยังไม่มีรายการเครื่องมือ เซิร์ฟเวอร์แบบรีโมตจะได้รายการหลังการตรวจสอบสถานะครั้งแรก
ติดตั้ง AiToSql อย่างไร? คัดลอกคอนฟิก stdio สำหรับ Cursor, Claude Desktop, Claude Code หรือ VS Code ได้ในหน้านี้ คอนฟิกนี้ใช้การติดตั้งของผู้เผยแพร่ ไม่ใช่พร็อกซีของ PlugMCP
AiToSql ต้องใช้ API key ไหม? ระเบียนนี้ไม่ได้ระบุตัวแปรสภาพแวดล้อมที่จำเป็น
AiToSql ใช้ทรานสปอร์ตแบบใด? AiToSql ทำงานแบบโลคัลผ่าน stdio
AiToSql ถูกตรวจสอบล่าสุดเมื่อใด? ตรวจสอบล่าสุดเมื่อ 2026-10-28 MCP Server - Database Introspection Tool for LLMs (JSON-RPC 2.0)
เครื่องมือมีคำอธิบาย 0 จาก 6