mcpField
O
Ollama MCP Client

Ollama MCP Client

github.com/georgi-terziyskiCoding Agents3Updated 84w ago

About Ollama MCP Client

Ollama MCP Client lets users query a Database MCP Server in natural language using language models served through Ollama. It supports streaming responses and several models, with command-line and configuration-file settings.

Key features

  1. 01Use Qwen, Llama 3, Mistral, or Gemini
  2. 02Stream model responses
  3. 03Query databases in natural language
  4. 04Configure model and server endpoints
  5. 05Send database queries and schema requests

Use cases

  1. 01List database tables with a natural-language request
  2. 02Inspect a table's schema
  3. 03Retrieve records using a question
  4. 04Create a database table from a description

MCP support

The client connects to a Database MCP server specified by its server URL and uses an Ollama-served model to interpret natural-language requests.

Details

From the project README

Ollama MCP Client

A Model Context Protocol (MCP) client for language models served through Ollama.

Features

  • Multiple Model Support: Works with Qwen, Llama 3, Mistral, and Gemini models served via Ollama
  • Streaming Responses: Real-time streaming of LLM responses
  • Database Operations: Seamless integration with the Database MCP Server
  • Natural Language Interface: Interact with databases using natural language

Installation

# Clone the repository
git clone <repository-url>

# Install the package
pip install -e .

Quick Start

# Basic usage
mcp-ollama --model llama3 --server http://localhost:8000 "List all tables in my database"

# Specify a different Ollama server
mcp-ollama --model qwen --ollama-api http://localhost:11434 --server http://localhost:8000 "Show me the schema for the users table"

Configuration

The client can be configured using command line arguments or a configuration file:

Command Line Arguments
  • --model: The Ollama model to use (e.g., llama3, qwen, mistral, gemini)
  • --server: URL of the Database MCP server
  • --ollama-api: URL of the Ollama API server (default: http://localhost:11434)
  • --stream: Enable/disable streaming responses (default: true)
  • --config: Path to configuration file
Configuration File

Create a config.json file in your home directory:

{
  "model": "llama3",
  "server": "http://localhost:8000",
  "ollama_api": "http://localhost:11434",
  "stream": true
}

Example Usage

Natural Language Database Queries
# List tables
mcp-ollama "What tables do I have in my database?"

# Query data
mcp-ollama "Show me all users who registered in the last month"

# Create a table
mcp-ollama "Create a new table called products with columns for id, name, price, and description"

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.