MCPInstall
mcp-ollama-streamlit-agent logo

mcp-ollama-streamlit-agent

by jesusfl93 3 stars jesusfl93/mcp-ollama-streamlit-agent

This repository contains a fully functional multi-agent chatbot powered by the Model Context Protocol (MCP), Ollama with the qwen3:1.7b model, and a Streamlit-based frontend. The chatbot supports tool calling and integrates domain-specific utilities like weather APIs, math evaluation, and CSV dataset analysis.

READMEmain

🧠 MCP + Ollama Streamlit Chatbot

This repository contains a fully functional multi-agent chatbot powered by the Model Context Protocol (MCP), Ollama with the qwen3:1.7b model, and a Streamlit-based frontend. The chatbot supports tool calling and integrates domain-specific utilities like weather APIs, math evaluation, and CSV dataset analysis.


📁 Project Structure

.
├── app.py             # Streamlit frontend interface
├── client.py          # Async MCP client with Ollama integration and tool handling
├── server.py          # MCP-compatible server with weather, math, and dataset tools
├── data/
│   └── dataset.csv    # Sample CSV file for dataset analysis
├── .env               # Environment variables (MCP_SSE_URL, etc.)

🧰 Features & Tools

The assistant supports the following built-in tools via MCP server:

  • 🌤️ Weather Tools – Fetch alerts and forecasts using the National Weather Service API
  • ➗ Math Evaluator – Safe evaluation of arithmetic expressions
  • 📊 Dataset Inspector – Summary statistics, shape, and NLP-powered queries on a local dataset.csv file

flowchart TD
    subgraph Streamlit_UI
        A1[User Prompt]
        A2[Display Chat History]
        A3[Streamlit App - app_py]
    end

    subgraph MCP_Client
        B1[Connect to SSE Server]
        B2[Process Query]
        B3[Call Ollama API]
        B4[Handle Tool Calls]
    end

    subgraph MCP_Server
        C1[Weather Alerts Tool]
        C2[Forecast Tool]
        C3[Math Evaluation Tool]
        C4[Dataset Analysis Tool]
        C5[Dataset Query Tool]
    end

    subgraph Ollama_Model
        D1[qwen3 1_7b Model]
    end

    A1 --> A3
    A3 --> B2
    A2 --> A3
    B2 --> B3
    B3 --> D1
    D1 --> B4
    B4 -->|Tool Call| C1
    B4 -->|Tool Call| C2
    B4 -->|Tool Call| C3
    B4 -->|Tool Call| C4
    B4 -->|Tool Call| C5
    C1 --> B2
    C2 --> B2
    C3 --> B2
    C4 --> B2
    C5 --> B2

🔧 Requirements

Ensure you have the following installed:

  • Python 3.9+
  • Ollama with the qwen3:1.7b model available locally
  • MCP library (see installation below)
  • Streamlit
  • Uvicorn for ASGI server
  • A .env file with MCP server URL defined:
    MCP_SSE_URL=http://localhost:8080/sse
    

Python Packages

You can install all required packages via:

pip install -r requirements.txt

If you don't have a requirements.txt, use:

pip install streamlit uvicorn httpx python-dotenv pandas scikit-learn mcp

▶️ How to Run

1. Launch the MCP Server (Tool Provider)

Run the server to expose SSE-compatible endpoints:

python server.py --host 0.0.0.0 --port 8080

This will start a FastAPI-compatible MCP server exposing tools on:

http://localhost:8080/sse

2. Start the Streamlit Frontend

In another terminal:

streamlit run app.py

This will open the chat interface in your browser at:

http://localhost:8501

📦 Ollama Model Setup

Install and run Ollama:

ollama pull qwen3:1.7b
ollama run qwen3:1.7b

Ensure the model is loaded and responding at:

http://localhost:11434/api/chat

🧪 Supported Use Cases

Here are some queries you can try:

Weather

  • What’s the weather in San Francisco?
  • Are there any alerts in NY?

Math

  • What is 2 + 3 * 4?
  • Calculate the square root of 81

Dataset Analysis

  • What are the columns in the dataset?
  • How many records are in the file?
  • Do any descriptions mention "cloud" or "AI"?

🧼 Resetting State

You can reset the chat history using the sidebar button in the Streamlit UI.


📁 Notes

  • Make sure data/dataset.csv exists if using dataset tools.
  • Ensure MCP_SSE_URL in .env matches your server setup.
  • This system uses asyncio.run_coroutine_threadsafe() to allow asynchronous tool execution within Streamlit's synchronous model.

More AI Chatbot MCP servers

Similar servers from the same category.

Jentic

jentic

Enables AI assistants to discover and execute external APIs and workflows through a Python SDK that leverages the Open Agentic Knowledge repository for standardized API access and execution.

AI Chatbot

Provides a bridge to the Flyworks AI lipsync service, enabling creation of digital avatar videos synchronized with audio inputs through a simple API.

git

Official JavaScript implementation that integrates with MiniMax's multimodal capabilities for image generation, video creation, text-to-speech, and voice cloning across multiple transport modes.

APIVideo+7

Provides a bridge to Mureka.ai's music generation capabilities, enabling on-demand creation of lyrics, complete songs, and instrumental tracks without requiring specialized music production knowledge.

AI Chatbot