← Back to Projects
StellarMIND — Chat-to-SQL with RAG
View Repository ↗Problem
Business users need to query databases without knowing SQL. Existing tools lack context-aware query generation and safety guarantees.
Why It Matters
Data democratization requires non-technical users to access insights without engineering bottlenecks. Raw LLM-to-SQL is unreliable. RAG with schema context fixes this.
System Approach
- Spring Boot MCP server with Tool interface for executeDataQuery
- pgvector for storing schema knowledge chunks and embeddings
- Spring AI for LLM integration (provider-agnostic — works with OpenAI, Anthropic, etc.)
- Chain-of-Thought (CoT) web interface for query debugging and transparency
- Read-only SQL enforcement via query parsing (only SELECT, WITH allowed)
Key Decisions & Trade-offs
- Read-only restriction limits use cases but ensures database safety
- pgvector requires PostgreSQL — not database-agnostic, but worth the trade-off
- MCP transport (stdio) over HTTP for better AI assistant integration
- Separate stellarmind-server and stellarmind-client for modularity
Current Status
Core query flow working. CoT UI functional. Newman test suite passing.
Roadmap
- Add support for streaming responses
- Implement query history and favorites
- Add schema auto-discovery
What I'd Improve Next
- Could add query result visualization
- Consider supporting multiple database connections