Skip to main content
Glama
mahsamb
by mahsamb

Ollama MCP Assistant

Ask questions about a local document using Ollama on your machine. The project exposes document Q&A through an MCP server (FastMCP) and two optional UIs: a lightweight browser page and a Streamlit app.

Includes a synthetic Persian demo document (context.txt) about a public library — safe to run immediately after clone.

Why this project

  • Local-first — no cloud API keys; runs against Ollama on localhost:11434

  • MCP toolask_ollama reads .txt or .pdf, sends context + question to Ollama, returns a Persian answer

  • Persian output — system prompt enforces Farsi answers grounded in the provided context

  • Two UIs — stdlib browser UI (ui.py) or Streamlit app (app.py)

  • CLI clientMCP_Client.py demonstrates calling the MCP server via stdio

Related MCP server: DocAgent-MCP

Stack

Python · Ollama · FastMCP · Streamlit · pdfplumber · requests

Project layout

File

Description

MCP_Server.py

FastMCP server with ask_ollama tool and shared chat helper

MCP_Client.py

Async stdio client example (Persian terminal output)

ui.py

Minimal RTL browser UI (stdlib + requests only)

app.py

Streamlit document Q&A app with file upload

check_progress.py

Quick helper to monitor Ollama model pull progress

context.txt

Synthetic Persian demo document (public library sections)

Quick start

1. Install Ollama

Install Ollama and pull a model, for example:

ollama pull llama3.2:1b

2. Install Python dependencies

python -m venv .venv
.venv\Scripts\activate        # Windows
# source .venv/bin/activate   # macOS / Linux
pip install -r requirements.txt

3. Run (pick one)

MCP server (stdio):

python MCP_Server.py

Browser UI:

python ui.py

Opens http://127.0.0.1:8765 with RTL Persian layout.

Streamlit app:

streamlit run app.py

MCP client demo:

python MCP_Client.py

Check model download progress:

python check_progress.py

MCP tool: ask_ollama

Parameter

Description

file_path

Path to a .txt or .pdf document

question

User question (answer will be in Persian)

model_name

Ollama model tag, e.g. llama3.2:1b

The server extracts text from the file, sends it with the question to Ollama's chat API, and returns the model response.

Demo document

context.txt is an original synthetic Persian text describing sections of a fictional central city library. It is included only for testing the Q&A pipeline — replace it with your own .txt or .pdf files.

Disclaimer

  • Unofficial project — independent work by Marzieh Babaali. Not affiliated with Ollama, FastMCP, or any document provider.

  • Local models — quality and language behavior depend on the Ollama model you choose.

  • Your documents — only upload or point to files you have the right to use.

  • Code in this repository is original MIT-licensed work (LICENSE).

Author

Marzieh Babaali — PhD Researcher · NLP & Generative AI

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to search and query PDF documents through a local RAG system with vector embeddings. Provides semantic document search capabilities while keeping all data stored locally without external dependencies.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables local document question-answering and retrieval via MCP, supporting multi-turn conversation, intent recognition, and tools for document search, Q&A, and summarization.
    5
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to interact with local documents (PDF, Markdown, TXT) through tools for discovery, reading, extraction, summarization, comparison, keyword extraction, search, and analysis, ensuring privacy and offline capability.
    -