MCP Chat

MCP Chat

Enables interactive chat with a local LLM using MCP architecture for document management, including tools to read, edit, and format documents.

Category
Visit Server

README

MCP Chat

Note: This project is an extension of the MCP certification project originally sourced from the Anthropic Claude MCP course. It has been extended to support local LLMs instead of the Anthropic API, along with additional tooling and improvements.

A command-line interface application that enables interactive chat with a local LLM (via Ollama or any OpenAI-compatible server) using the MCP (Model Context Protocol) architecture for document management.


Prerequisites

  • Python 3.9+
  • Ollama or any OpenAI-compatible local LLM server

Setup

Step 1: Configure environment variables

Create a .env file in the project root:

LOCAL_LLM_MODEL=llama3.2
LOCAL_LLM_BASE_URL=http://localhost:11434/v1
USE_UV=1   # Set to 0 if not using uv

Step 2: Install dependencies

Option 1: With uv (Recommended)

uv is a fast Python package installer and resolver.

pip install uv
uv venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
uv pip install -e .

Option 2: Without uv

python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install openai python-dotenv prompt-toolkit "mcp[cli]==1.8.0"

Step 3: Start your local LLM

# Ollama example
ollama serve
ollama pull llama3.2

Step 4: Run the project

# With uv
uv run main.py

# With additional MCP servers
uv run main.py extra_server.py another_server.py

Usage

Basic Chat

Type your message and press Enter:

> What is the state of the condenser tower?

Document Retrieval

Use @ followed by a document ID to include its contents in your query:

> Tell me about @deposition.md
> Summarize @financials.docx

Demo

MCP Chat CLI demo MCP Chat running with llama3.2 via Ollama on Windows

Commands

Use / prefix to execute MCP prompts. Press Tab to autocomplete:

> /format deposition.md
> /summarize report.pdf

Available Documents

Document Description
deposition.md Testimony of Angela Smith, P.E.
report.pdf State of a 20m condenser tower
financials.docx Project budget and expenditures
outlook.pdf Projected future performance
plan.md Project implementation steps
spec.txt Technical equipment requirements

Architecture

main.py
  ├── MCPClient          # Manages stdio communication with MCP server(s)
  ├── mcp_server.py      # FastMCP server — tools, resources, prompts
  ├── core/claude.py     # Local LLM integration (OpenAI-compatible)
  ├── core/cli_chat.py   # Chat logic with @ and / command handling
  └── core/cli.py        # Terminal UI with Tab autocomplete

MCP Server Features

Feature Name Description
Tool read_doc_contents Read the contents of a document by ID
Tool edit_document Replace text within a document
Resource docs://documents List all available document IDs
Resource docs://documents/{doc_id} Fetch contents of a specific document
Prompt /format Rewrite a document in Markdown format

Development

Adding New Documents

Edit the docs dictionary in mcp_server.py:

docs = {
    "your_doc.md": "Your document content here",
}

Adding New MCP Servers

Pass additional server scripts as arguments when running:

uv run main.py your_custom_server.py

Adding New Tools / Prompts / Resources

Use the FastMCP decorators in mcp_server.py:

@mcp.tool(name="my_tool", description="Does something useful")
def my_tool(input: str) -> str:
    return f"Processed: {input}"

Known Limitations

  • Document edits are in-memory only and lost on server restart
  • No persistent storage backend
  • No authentication or multi-user support (stdio only — single client per server instance)

Troubleshooting

OneDrive hardlink error on Windows:

$env:UV_LINK_MODE = "copy"; uv pip install -e .

Local LLM not responding:

  • Ensure Ollama is running: ollama serve
  • Confirm the model is pulled: ollama pull llama3.2
  • Check LOCAL_LLM_BASE_URL in .env matches your server

Module not found errors:

uv add openai python-dotenv mcp

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured