LLaMa-MCP-Streamlit

MCP.Pizza Chef: Nikunj2003

LLaMa-MCP-Streamlit is an interactive AI assistant client built using Streamlit, NVIDIA NIM's LLaMa 3.3:70B, Ollama, and the Model Control Protocol (MCP). It offers a chat-based interface enabling users to interact with large language models, execute external tools in real-time, retrieve data, and perform actions seamlessly. The client supports custom model selection, API configuration for multiple backends, and integrates MCP tools to enhance usability and dynamic data processing within a user-friendly environment.

Use This MCP client To

Interact with LLMs via a chat interface for real-time responses Execute external tools dynamically through MCP integration Configure and switch between NVIDIA NIM and Ollama LLM backends Retrieve and process real-time data within conversations Build custom AI assistants with Streamlit UI and MCP tool orchestration

README

Llama MCP Streamlit

This project is an interactive AI assistant built with Streamlit, NVIDIA NIM's API (LLaMa 3.3:70b)/Ollama, and Model Control Protocol (MCP). It provides a conversational interface where you can interact with an LLM to execute real-time external tools via MCP, retrieve data, and perform actions seamlessly.

The assistant supports:

  • Custom model selection (NVIDIA NIM / Ollama)
  • API configuration for different backends
  • Tool integration via MCP to enhance usability and real-time data processing
  • A user-friendly chat-based experience with Streamlit

πŸ“Έ Screenshots

Homepage Screenshot

Tools Screenshot

Chat Screenshot

Chat (What can you do?) Screenshot

πŸ“ Project Structure

llama_mcp_streamlit/
│── ui/
β”‚   β”œβ”€β”€ sidebar.py       # UI components for Streamlit sidebar
β”‚   β”œβ”€β”€ chat_ui.py       # Chat interface components
│── utils/
β”‚   β”œβ”€β”€ agent.py         # Handles interaction with LLM and tools
β”‚   β”œβ”€β”€ mcp_client.py    # MCP client for connecting to external tools
β”‚   β”œβ”€β”€ mcp_server.py    # Configuration for MCP server selection
│── config.py            # Configuration settings
│── main.py              # Entry point for the Streamlit app
.env                      # Environment variables
Dockerfile                # Docker configuration
pyproject.toml            # Poetry dependency management

πŸ”§ Environment Variables

Before running the project, configure the .env file with your API keys:

# Endpoint for the NVIDIA Integrate API
API_ENDPOINT=https://integrate.api.nvidia.com/v1
API_KEY=your_api_key_here

# Endpoint for the Ollama API
API_ENDPOINT=http://localhost:11434/v1/
API_KEY=ollama

πŸš€ Running the Project

Using Poetry

  1. Install dependencies:
    poetry install
  2. Run the Streamlit app:
    poetry run streamlit run llama_mcp_streamlit/main.py

Using Docker

  1. Build the Docker image:
    docker build -t llama-mcp-assistant .
  2. Run the container:
    docker compose up

πŸ”„ Changing MCP Server Configuration

To modify which MCP server to use, update the utils/mcp_server.py file. You can use either NPX or Docker as the MCP server:

NPX Server

server_params = StdioServerParameters(
    command="npx",
    args=[
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Desktop",
        "/path/to/other/allowed/dir"
    ],
    env=None,
)

Docker Server

server_params = StdioServerParameters(
    command="docker",
    args=[
        "run",
        "-i",
        "--rm",
        "--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
        "--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
        "--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
        "mcp/filesystem",
        "/projects"
    ],
    env=None,
)

Modify the server_params configuration as needed to fit your setup.


πŸ“Œ Features

  • Real-time tool execution via MCP
  • LLM-powered chat interface
  • Streamlit UI with interactive chat elements
  • Support for multiple LLM backends (NVIDIA NIM & Ollama)
  • Docker support for easy deployment

πŸ›  Dependencies

  • Python 3.11+
  • Streamlit
  • OpenAI API (for NVIDIA NIM integration)
  • MCP (Model Control Protocol)
  • Poetry (for dependency management)
  • Docker (optional, for containerized deployment)

πŸ“œ License

This project is licensed under the MIT License.


🀝 Contributing

Feel free to submit pull requests or report issues!


πŸ“¬ Contact

For any questions, reach out via GitHub Issues.


LLaMa-MCP-Streamlit FAQ

How do I configure different LLM backends in LLaMa-MCP-Streamlit?
You can configure API settings for NVIDIA NIM and Ollama models directly within the client interface to switch between them seamlessly.
Can I integrate custom tools with this client?
Yes, LLaMa-MCP-Streamlit supports tool integration via MCP, allowing you to add and execute external tools in real-time.
What is the role of Streamlit in this project?
Streamlit provides the user-friendly chat-based interface for interacting with the LLM and managing tool executions.
Does this client support multiple LLM providers?
Yes, it supports NVIDIA NIM's LLaMa and Ollama, and can be extended to other MCP-compatible LLM providers like OpenAI, Claude, and Gemini.
How does MCP enhance the functionality of this client?
MCP enables the client to orchestrate real-time context, tool calling, and API interactions, making conversations dynamic and actionable.
Is it possible to customize the UI?
Since the UI is built with Streamlit, you can customize the interface components to fit your specific needs.
What programming languages and frameworks are used?
The client is built primarily with Python using Streamlit for the UI and integrates MCP for model and tool orchestration.