Ollama MCP DB
An interactive chat interface that combines Ollama's LLM capabilities with PostgreSQL database access through the Model Context Protocol (MCP
Overview
Ollama MCP Database Assistant
Overview
The Ollama MCP Database Assistant is an innovative tool that combines the power of Ollama's large language model (LLM) capabilities with seamless access to your PostgreSQL database through the Model Context Protocol (MCP). This interactive chat interface allows you to ask questions about your data in natural language and receive AI-powered responses backed by real SQL queries.
Key Features
- Natural Language Interface: Easily query your database using plain language, without the need for complex SQL syntax.
- Automatic SQL Generation: The system automatically generates appropriate SQL queries based on your questions and the database schema.
- Schema-Aware Responses: The assistant understands your database schema and provides relevant, informative responses.
- Secure, Read-Only Access: All database access is read-only, ensuring the security of your data.
Target Audience and Use Cases
The Ollama MCP Database Assistant is designed for a wide range of users, from data analysts and business stakeholders to developers and researchers. It's particularly useful for quickly exploring and understanding data, generating insights, and sharing information with non-technical team members.
Uniqueness and Noteworthy Aspects
What sets this tool apart is its seamless integration of LLM-powered natural language processing and direct database access through the MCP protocol. This allows users to interact with their data in a more intuitive and efficient manner, without the need for specialized SQL knowledge.
Configuration
{
"mcpServers": {
"ollama-mcp-db": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"DATABASE_URL": "postgresql://user:password@localhost:5432/dbname",
"OLLAMA_MODEL": "qwen2.5-coder:7b-instruct"
}
}
}
}
Technical Implementation
Requirements
- Node.js 16+
- PostgreSQL database
- Ollama installation
- qwen2.5-coder:7b-instruct model
Installation
npm install
npm start
Platform Support
| Feature | Details | |---------|----------| | Runtime | Node.js, TypeScript | | Database | PostgreSQL | | Security | Read-only access | | Model | qwen2.5-coder:7b-instruct |
The server enables natural language database interactions while maintaining security through read-only access and restricted SQL operations.