RAGmonsters-mcp-pg
1
This project provides a custom MCP server to integrate Large Language Models with a domain-specific API, based on the RAGmonsters dataset. It uses FastMCP to efficiently handle interactions and improve security compared to generic SQL access.
Custom PostgreSQL MCP Server for RAGmonsters
Overview
This project demonstrates a custom MCP server that integrates Large Language Models with databases through a domain-specific API, improving over generic MCP methods. It uses FastMCP for higher efficiency and reliability, and works with the RAGmonsters dataset, an open-source fictional dataset for testing Retrieval-Augmented Generation systems.
The Problem with Generic MCP Database Access
- Cognitive Load: LLMs need to understand full database schemas
- Inefficiency: Requires many queries for simple tasks
- Security Concerns: Potential for SQL injection attacks
- Performance: Complex queries are inefficient without index knowledge
- Domain Knowledge Gap: LLMs lack business rules understanding
Our Solution: Domain-Specific MCP API
- Abstract Database Complexity: Hide SQL and schema details
- Provide Domain-Specific Operations: Functions for business concepts
- Optimize for Common Queries: Efficient patterns for frequent questions
- Enforce Business Rules: Embed domain-specific logic
- Improve Security: Remove raw SQL access
Web Interface
- Explorer Interface: Filter and browse the dataset
- Chat Interface: Ask questions in natural language
Features
- High-performance domain-specific API with FastMCP
- Optimized queries, business logic layer, structured JSON responses
- LangChain.js integration, Explorer and chat interfaces
- Deployment-ready for platforms like Clever Cloud
Benefits
- Improved Performance, Better User Experience, Reduced Token Usage, Enhanced Security, Maintainability, Scalability
Getting Started
- Install: Clone repository, install dependencies, configure environment
- Tools: getMonsters, getMonsterById, add
- Integrate with LangChain for modern LLM interactions
Prerequisites
- Node.js 23+, PostgreSQL, LLM API access, FastMCP package
Deploying to Clever Cloud
- Use Clever Cloud CLI or console for deployment setup
License
MIT License.