MCP Chat Bot (Golang Version)

by jiasyuanchu

MCP Client
  • other

A simple chat bot using MCP (Model Context Protocol)

About

What is MCP Chat Bot (Golang Version)?

MCP Chat Bot (Golang Version) is a chat bot application implemented in Go using the Gin framework. It integrates various AI models through the Model Context Protocol (MCP) and provides a simple web chat interface.

How to use MCP Chat Bot (Golang Version)?

Clone the repository, run go mod download to install dependencies, create a .env file with your MCP_API_KEY and PORT (default 8080), then build and start the server with go build -o mcp-chat-bot && ./mcp-chat-bot. Open http://localhost:8080 in your browser to start chatting.

Key features of MCP Chat Bot (Golang Version)

- Simple web chat interface
- Communication with various AI models via MCP protocol
- Conversation history tracking
- Efficient server implementation in Golang and Gin

Use cases of MCP Chat Bot (Golang Version)

- Building a lightweight chat interface connected to MCP-compatible AI models
- Experimenting with different AI models by modifying a single configuration parameter
- Deploying a self-hosted chat bot with conversation history persistence

FAQ from MCP Chat Bot (Golang Version)

How do I set up the MCP Chat Bot (Golang Version)?

Clone the repository, install dependencies, create a .env file with MCP_API_KEY and PORT, then build and run the server. Open the provided localhost URL in a browser.

Can I change the AI model used by the chat bot?

Yes. Modify the Model parameter in main.go (e.g., from "gpt-4" to another supported model).

What port does the server run on?

The default port is 8080, but you can set a custom port via the PORT environment variable in the .env file.

Does the chat bot have a graphical interface?

Yes. It serves a web-based chat interface located at public/index.html, accessible in a browser after starting the server.

What are the dependencies required?

The project uses Go modules (listed in go.mod) and the Gin framework. Run go mod download to automatically fetch them.

Details

Author
jiasyuanchu
Category
other
Repository
jiasyuanchu/mcp-chat-bot

MCP Chat Bot (Golang Version)

This is a chat bot project implemented using Golang and the Gin framework, integrating various AI models through the Model Context Protocol (MCP).

Features

- Simple web chat interface
- Communication with various AI models using the MCP protocol
- Conversation history tracking
- Efficient server implementation using Golang and Gin framework

Installation Steps

1. Clone this repository

   git clone https://github.com/yourusername/mcp-chat-bot.git
cd mcp-chat-bot

2. Install dependencies

   go mod download

3. Create a .env file and set your MCP API key

   MCP_API_KEY=your_api_key_here
PORT=8080

4. Compile and start the server

   go build -o mcp-chat-bot
./mcp-chat-bot

5. Open http://localhost:8080 in your browser to start chatting

Project Structure

- main.go - Gin server and MCP integration
- public/index.html - Chat interface
- go.mod - Go module dependencies

Customization

You can modify the Model parameter in the main.go file to use different AI models:

mcpReq := MCPRequest{
    Model:     "gpt-4", // Change to your preferred model
    Messages:  context,
    MaxTokens: 1000,
}