MCP Chat is a command-line interface application that enables interactive chat capabilities with AI models through the Anthropic API. The application supports document retrieval, command-based prompts, and extensible tool integrations via the MCP (Model Control Protocol) architecture.
- Python 3.9+
- Anthropic API Key
- Create or edit the
.envfile in the project root and verify that the following variables are set correctly:
ANTHROPIC_API_KEY="" # Enter your Anthropic API secret key
uv is a fast Python package installer and resolver.
- Install uv, if not already installed:
pip install uv- Create and activate a virtual environment:
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
uv syncThis installs runtime dependencies and the dev group (pytest, pytest-asyncio).
- Run the project
uv run main.py- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
pip install anthropic python-dotenv prompt-toolkit "mcp[cli]==1.8.0"
pip install pytest pytest-asyncio # optional, for running tests- Run the project
python main.pySimply type your message and press Enter to chat with the model.
Use the @ symbol followed by a document ID to include document content in your query:
> Tell me about @deposition.md
Use the / prefix to execute commands defined in the MCP server:
> /summarize deposition.md
Commands will auto-complete when you press Tab.
The bundled mcp_server.py exposes the in-memory docs dictionary to MCP clients via:
- Tools
read_doc_contents(doc_id)— return the contents of a document.edit_document(doc_id, old_str, new_str)— replaceold_strwithnew_strin a document.
- Resources
docs://documents— JSON list of all document IDs.docs://documents/{doc_id}— contents of a single document.
- Prompts
format(doc_id)— rewrite a document in markdown format.summarize(doc_id)— produce a concise summary of a document.
Edit the mcp_server.py file to add new documents to the docs dictionary.
Tests live in tests/ and use pytest with pytest-asyncio (auto mode).
tests/test_mcp_server.pyexercises the server in-process against theFastMCPinstance.tests/test_mcp_client.pyspawns the server as a subprocess and exercisesMCPClientend-to-end.
Run the suite with:
uv run pytestThere are no lint or type checks implemented.