MCP Chat
by hockeydave
README.md
# MCP Chat
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.
https://anthropic.skilljar.com/claude-with-the-anthropic-api/
Tools: Model-controlled: Claude decides when to call these. Results are used by Claude. Used for:
* giving additional funcationality to Claude
Resources: App-controlled: Our app decides when to call thse. Results are primarily used by our app. Used for
* Getting data into our app
* Adding context to messages
Prompts: User-controlled: The user decides when to use these. Used for:
* Predefined workflows to run based on user input, like slash command, button click, or menu option.
## Prerequisites
- Python 3.9+
- Anthropic API Key
## Setup
### Step 1: Configure the environment variables
1. Create or edit the `.env` file in the project root and verify that the following variables are set correctly:
```
ANTHROPIC_API_KEY="" # Enter your Anthropic API secret key
```
### Step 2: Install dependencies
#### Option 1: Setup with uv (Recommended)
[uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver.
1. Install uv, if not already installed:
```bash
pip install uv
```
2. Create and activate a virtual environment:
```bash
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```
3. Install dependencies:
```bash
uv pip install -e .
```
4. Run the project
```bash
uv run main.py
```
#### Option 2: Setup without uv
1. Create and activate a virtual environment:
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```
2. Install dependencies:
```bash
pip install anthropic python-dotenv prompt-toolkit "mcp[cli]==1.8.0"
```
3. Run the project
```bash
uv run main.py
```
OR
```bash
python main.py
```
Prompt: What is the contents of the report.pdf document?
Here's what happens behind the scenes:
Your application uses the client to get available tools
1. These tools are sent to Claude along with your question
1. Claude decides to use the read_doc_contents tool
1. Your application uses the client to execute that tool
1. The result is returned to Claude, who then responds to you
1. The client acts as the bridge between your application logic and the MCP server's functionality, making it easy to integrate powerful tools into your AI workflows.
To see the MCP Web inspector to debug your mcp_server.py changes run:
```bash
uv run mcp dev mcp_server.py
```
## Usage
### Basic Interaction
Simply type your message and press Enter to chat with the model.
### Document Retrieval
Use the @ symbol followed by a document ID to include document content in your query:
```
> Tell me about @deposition.md
```
### Commands
Use the / prefix to execute commands defined in the MCP server:
```
> /summarize deposition.md
```
Commands will auto-complete when you press Tab.
## Development
### Adding New Documents
Edit the `mcp_server.py` file to add new documents to the `docs` dictionary.
### Implementing MCP Features
To fully implement the MCP features:
1. Complete the TODOs in `mcp_server.py`
2. Implement the missing functionality in `mcp_client.py`. You can run the client:
```bash
uv run mcp_client.py
```
This will connect to your MCP server and print out the available tools. You should see output showing your tool definitions, including descriptions and input schemas.
### Linting and Typing Check
There are no lint or type checks implemented.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues