Ollama MCP Database Assistant

v1.0.0Databasesstable

An interactive chat interface that combines Ollama's LLM capabilities with PostgreSQL database access through the Model Context Protocol (MCP). Ask questions about your data in natural language and get AI-powered responses backed by real SQL queries.

ollama-mcp-database-assistantmcpai-integration
Share:
62
Stars
0
Downloads
0
Weekly
0/5

What is Ollama MCP Database Assistant?

Ollama MCP Database Assistant is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to interactive chat interface that combines ollama's llm capabilities with postgresql database access through the model context protocol (mcp). ask questions about your data in natural language and get a...

An interactive chat interface that combines Ollama's LLM capabilities with PostgreSQL database access through the Model Context Protocol (MCP). Ask questions about your data in natural language and get AI-powered responses backed by real SQL queries.

This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • An interactive chat interface that combines Ollama's LLM cap

Use Cases

Ask natural language questions about PostgreSQL databases.
Get AI-powered responses backed by real SQL queries.
Combine local LLM capabilities with database access.
robdodson

Maintainer

LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedApr 10, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx ollama-mcp-database-assistant

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Ollama MCP Database Assistant

The Ollama MCP Database Assistant is an interactive chat interface that combines a locally-running Ollama language model with PostgreSQL database access through the Model Context Protocol, enabling users to ask natural language questions about their data and receive AI-generated answers backed by real SQL queries. Unlike cloud-based database AI tools, all LLM processing happens locally via Ollama (defaulting to the qwen2.5-coder:7b-instruct model), keeping sensitive database contents private. It is designed for developers and data analysts who want a conversational interface to their PostgreSQL databases without sending data to external AI providers.

Prerequisites

  • Node.js 16+ and npm installed
  • Ollama installed and running locally (https://ollama.com)
  • The qwen2.5-coder:7b-instruct model pulled in Ollama (or another code-capable model)
  • A PostgreSQL database with a valid connection string
  • Git to clone the repository (no npm package available)
1

Install Ollama and pull the required model

Download and install Ollama from https://ollama.com, then pull the default model used by this assistant. The model will be used for all SQL generation and response interpretation.

# Pull the default model:
ollama pull qwen2.5-coder:7b-instruct

# Verify Ollama is running:
ollama list
2

Clone the repository

Clone the ollama-mcp-db repository to your local machine since it is not published to npm.

git clone https://github.com/robdodson/ollama-mcp-db.git
cd ollama-mcp-db
3

Install Node.js dependencies

Install all required npm packages for the TypeScript project.

npm install
4

Configure your PostgreSQL connection

Create a .env file in the project root with your PostgreSQL connection string and optionally a custom Ollama model identifier.

# Create .env file:
DATABASE_URL=postgresql://user:password@localhost:5432/your_database
OLLAMA_MODEL=qwen2.5-coder:7b-instruct
5

Start the assistant

Launch the interactive database assistant. It will connect to your PostgreSQL database and start the MCP server with Ollama integration.

npm start
6

Ask natural language questions about your data

Type natural language questions in the chat interface. The assistant generates SELECT queries, executes them against your database, and returns AI-interpreted results. All operations are read-only.

Ollama MCP Database Assistant Examples

Client configuration

Environment configuration for the Ollama MCP Database Assistant with PostgreSQL connection details.

{
  "mcpServers": {
    "ollama-db-assistant": {
      "command": "node",
      "args": ["/path/to/ollama-mcp-db/dist/index.js"],
      "env": {
        "DATABASE_URL": "postgresql://user:password@localhost:5432/mydb",
        "OLLAMA_MODEL": "qwen2.5-coder:7b-instruct"
      }
    }
  }
}

Prompts to try

Natural language database questions the Ollama MCP Database Assistant can answer.

- "How many users signed up in the last 30 days?"
- "Show me the top 10 best-selling products by revenue this quarter"
- "What is the average order value by country?"
- "List all customers who have not placed an order in over 6 months"
- "What tables are in this database and what are their schemas?"

Troubleshooting Ollama MCP Database Assistant

Ollama model not found or slow to respond

Ensure Ollama is running (`ollama serve`) and the model is downloaded (`ollama list`). If qwen2.5-coder:7b-instruct is not listed, run `ollama pull qwen2.5-coder:7b-instruct`. You can switch to a smaller/faster model by changing OLLAMA_MODEL in your .env file.

PostgreSQL connection fails

Verify your DATABASE_URL is correct by testing with psql: `psql postgresql://user:password@localhost:5432/dbname`. Ensure the database user has SELECT permissions on the tables you want to query, and that PostgreSQL is accepting connections on the specified host and port.

SQL queries return unexpected results or errors

The assistant only executes SELECT statements for safety. If the model generates an invalid query, try rephrasing your question to be more specific about the tables or columns involved. You can ask the assistant to 'show the database schema' first to help it generate more accurate queries.

Frequently Asked Questions about Ollama MCP Database Assistant

What is Ollama MCP Database Assistant?

Ollama MCP Database Assistant is a Model Context Protocol (MCP) server that interactive chat interface that combines ollama's llm capabilities with postgresql database access through the model context protocol (mcp). ask questions about your data in natural language and get ai-powered responses backed by real sql queries. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Ollama MCP Database Assistant?

Follow the installation instructions on the Ollama MCP Database Assistant GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Ollama MCP Database Assistant?

Ollama MCP Database Assistant works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Ollama MCP Database Assistant free to use?

Yes, Ollama MCP Database Assistant is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Databases MCP Servers

Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "ollama-mcp-database-assistant": { "command": "npx", "args": ["-y", "ollama-mcp-database-assistant"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Ollama MCP Database Assistant?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides