Terminal-based Chat Client with MCP Server Integration

by alan-meigs

224 downloads Not rated yet
GitHub

About

A terminal-based chat client that connects to an MCP server and integrates with OpenAI's API, including a weather service as an example of MCP functionality. It demonstrates how to build an extensible chat interface with tool execution.

Explore

- Real-time chat interface with OpenAI integration
- MCP server integration for extensible functionality
- Weather service with alerts and forecasts
- Asynchronous operation for better performance
- Proper error handling and resource cleanup
- Environment variable configuration for API keys

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Terminal-based Chat Client with MCP Server Integration
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Python 3.8 or higher
- UV package manager (a fast, reliable Python package installer and resolver)

UV is a modern Python package manager that offers significant performance improvements over traditional tools like pip. It's written in Rust and provides:
- Faster package installation
- Reliable dependency resolution
- Built-in virtual environment management
- Compatible with existing Python tooling

To install UV, run:

curl -LsSf https://astral.sh/uv/install.sh | sh

1. Initialize a new project:

uv init

2. Create and activate a virtual environment:

uv venv
source .venv/bin/activate # On Unix/macOS

You can also configure the MCP server for your project by creating a .cursor/mcp.json file:

1. Create the .cursor directory in your project root:

bash
mkdir .cursor

2. Create mcp.json with the following content:
json
{
"mcpServers": {
"weather": {
"command": "python",
"args": [
"/full/path/to/your/weather.py"
]
}
}
}
```

1. Open Cursor's Composer (Agent mode)
2. The Agent will automatically detect when weather information is needed
3. Example queries:
- "What's the current weather in San Francisco?"
- "Are there any weather alerts in California?"
- "Get me the forecast for New York City"

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "terminal-based chat client with mcp server integration": {
            "MCP_EXP": {
                "command": "uv",
                "args": [
                    "init"
                ]
            }
        }
    }
}

McpServers

{
    "MCP_EXP": {
        "command": "uv",
        "args": [
            "init"
        ]
    }
}

This project demonstrates how to build a terminal-based chat client interface that connects to an MCP server and integrates with OpenAI's API. It includes a simple weather service as an example of MCP functionality.

Prerequisites

- Python 3.8 or higher
- UV package manager (a fast, reliable Python package installer and resolver)

Installation

1. Install UV

UV is a modern Python package manager that offers significant performance improvements over traditional tools like pip. It's written in Rust and provides:
- Faster package installation
- Reliable dependency resolution
- Built-in virtual environment management
- Compatible with existing Python tooling

To install UV, run:

curl -LsSf https://astral.sh/uv/install.sh | sh

2. Project Setup

1. Initialize a new project:

uv init

2. Create and activate a virtual environment:
```bash
uv venv
source .venv/bin/activate # On Unix/macOS

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.