Skip to main content
Glama
rohitt08-l

Ollama MCP Server Demo

by rohitt08-l

Ollama MCP Server Demo

A beginner-friendly project that demonstrates how to build a simple Model Context Protocol (MCP) server using Python and connect it to a local Ollama model.

Overview

This project shows:

  • How to interact with a local Ollama model using the REST API

  • The difference between Ollama's Generate API and Chat API

  • How to expose an Ollama model as an MCP tool

  • How to configure and run an MCP server in VS Code

Related MCP server: mcp-ollama-code-analyzer

Project Structure

.
├── chat.py
├── generate.py
├── ollama_mcp_server.py
├── test_ollama.py
└── .vscode
    ├── mcp.json
    └── session.py

Architecture

MCP Client (VS Code)
        │
        ▼
Python MCP Server
        │
        ▼
Ollama API
        │
        ▼
gpt-oss:20b-cloud

Prerequisites

  • Python 3.10+

  • Ollama installed and running

  • A downloaded Ollama model (e.g. gpt-oss:20b-cloud)

Installation

Clone the repository:

git clone <your-repository-url>
cd ollama-mcp-server-demo

Install dependencies:

pip install -r requirements.txt

Running Ollama

Start Ollama:

ollama serve

Verify available models:

ollama list

Testing Ollama

Run:

python test_ollama.py

If everything is working, the model will generate a response in the terminal.

Running the MCP Server

Start the MCP server:

python ollama_mcp_server.py

The server exposes the following MCP tool:

ask_ollama(prompt: str)

Example:

Prompt: Explain MCP

Response: Model Context Protocol (MCP) is...

Learning Objectives

This project helped me understand:

  • MCP fundamentals

  • MCP tools and servers

  • Ollama APIs

  • Local LLM integration

  • VS Code MCP configuration

  • Python-based AI tooling

Future Improvements

  • Add multiple MCP tools

  • Support chat history

  • Add document search (RAG)

  • Connect to SharePoint or Microsoft Graph

  • Add logging and error handling

Author

Rohit Patil

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • MCP server for AI dialogue using various LLM models via AceDataCloud

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rohitt08-l/ollama-mcp-server-demo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server