Skip to content

leebrouse/GoMcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ GoMcp - Intelligent LLM Tool Service Platform

Go Version License Docker

A multi-agent system based on MCP (Model Context Protocol) architecture, supporting registration and invocation of multiple AI tools with high scalability and observability.

Infrastructure Architecture

πŸ“‹ Table of Contents

🎯 Project Overview

GoMcp is an intelligent LLM tool service platform built on the MCP protocol, designed to provide unified multi-agent tool management and invocation services. The project is developed in Go and supports integration of various AI tools including LLM Q&A, document parsing, code review, vector search, and more.

Key Advantages

  • πŸ”Œ Plugin Architecture: Supports dynamic tool registration and extension
  • πŸš€ High Performance: Built with Go, response time ≀ 1s
  • πŸ” Observability: Integrated OpenTelemetry for distributed tracing
  • 🐳 Containerized Deployment: Supports Docker and Kubernetes deployment
  • πŸ“Š Vector Database: Integrated TiDB for document embedding and similarity search

✨ Core Features

πŸ€– AI Tool Services

  • LLM Q&A: Support for Gemini, OpenAI, and other models
  • Code Review: Automatic code quality analysis and suggestions
  • Document Summarization: Intelligent document content summarization
  • RAG Enhancement: Retrieval-Augmented Generation based on documents

🏭 Tool Management

  • Factory Pattern: Unified tool registration and management mechanism
  • Auto Discovery: Automatic tool registration and loading
  • Configuration Management: Flexible configuration system based on Viper

πŸ—„οΈ Data Storage

  • Vector Database: TiDB integration for document embedding
  • Similarity Search: Efficient vector similarity computation
  • Resource Management: Support for multiple document format parsing

πŸ”§ DevOps

  • Distributed Tracing: OpenTelemetry integration
  • Containerization: Docker support
  • CI/CD: Jenkins + ArgoCD + Kubernetes
  • Monitoring & Alerting: Complete observability solution

πŸ—οΈ Technical Architecture

Core Components

  • MCP Server: Protocol communication layer, handling client requests
  • Tool Factory: Tool registration factory, managing all available tools
  • LLM Service: Large language model service, supporting multiple AI models
  • File Service: File processing service, supporting document parsing
  • Vector Service: Vector database service, supporting similarity search
  • Config Service: Configuration management service, based on Viper

πŸš€ Quick Start

Prerequisites

  • Go 1.24.4+
  • Docker & Docker Compose
  • MySQL/TiDB (optional, for vector database)

Installing Go Environment

Method 1: Official Installer (Recommended)

  1. Download Go 1.24.4+

    • Visit Go Official Download Page
    • Choose the version suitable for your system:
      • Linux: go1.24.4.linux-amd64.tar.gz
      • macOS: go1.24.4.darwin-amd64.tar.gz
      • Windows: go1.24.4.windows-amd64.msi
  2. Linux/macOS Installation

# Download and extract
wget https://go.dev/dl/go1.24.4.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.24.4.linux-amd64.tar.gz

# Configure environment variables
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc

# Verify installation
go version
  1. Windows Installation
    • Download the .msi installer
    • Double-click to run the installer
    • Follow the wizard to complete installation
    • Open Command Prompt to verify: go version

Method 2: Package Manager Installation

Ubuntu/Debian:

sudo apt update
sudo apt install golang-go

CentOS/RHEL:

sudo yum install golang
# Or use dnf (newer versions)
sudo dnf install golang

macOS (using Homebrew):

brew install go

Method 3: Using g (Go Version Manager)

# Install g
curl -sSL https://git.io/g-install | sh -s

# Install specific Go version
g install 1.24.4

# Use specific version
g use 1.24.4

Verify Installation

# Check Go version
go version

# Check Go environment
go env

# Set GOPROXY (recommended for Chinese users)
go env -w GOPROXY=https://goproxy.cn,direct

Installation Steps

  1. Clone the Repository
git clone https://github.com/leebrouse/GoMcp.git
cd GoMcp
  1. Install Dependencies
# install dependence
go mod download

# install mcphost
go install github.com/mark3labs/mcphost@latest

# add your Gemini api key
export GOOGLE_API_KEY='your-api-key'
  1. Configure Environment
cp internal/common/config/mcp.json.example internal/common/config/mcp.json
# Edit configuration file, set API keys, etc.
  1. Start Service
# Using Makefile
make mcphost

# Or run directly
mcphost --config ./internal/common/config/mcp.json -m google:gemini-2.5-flash

Run_Example

Docker Deployment (Not complete yet)

# Build image
make docker-build

# Start service
docker-compose up -d

πŸ“¦ Feature Modules

1. LLM Tool Services (internal/llm/)

Provides various AI tool services:

  • ChatBox: General conversation service
  • CodeReview: Code review service
  • Summarize: Document summarization service

2. File Processing Services (internal/file/)

Supports multiple file format processing:

  • PDF Parsing: Document content extraction
  • Text Processing: Text cleaning and preprocessing
  • Format Conversion: Support for multiple format conversions

3. Common Components (internal/common/)

  • Configuration Management: Configuration system based on Viper
  • Data Models: Unified data structure definitions
  • Design Patterns: Implementation of common design patterns
  • OpenTelemetry: Observability integration

4. Tool Factory (internal/llm/factory/)

Implements dynamic tool registration and management:

// Tool registration example
func init() {
    factory.RegisterTool("chatbox", &ChatBoxTool{})
    factory.RegisterTool("codeReview", &CodeReviewTool{})
}

πŸ“š API Documentation

MCP Protocol Interfaces

The project provides the following interfaces based on MCP protocol:

1. Tool List (listTools)

Get list of all available tools:

{
  "tools": [
    {
      "name": "chatbox",
      "description": "General conversation service",
      "inputSchema": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "description": "User input question"
          }
        }
      }
    }
  ]
}

2. Tool Invocation (callTool)

Invoke specified tool:

{
  "name": "chatbox",
  "arguments": {
    "prompt": "Hello, please introduce the GoMcp project"
  }
}

3. Resource Management (listResources)

Manage document resources:

{
  "resources": [
    {
      "uri": "file:///path/to/document.pdf",
      "name": "Project Documentation",
      "description": "GoMcp project documentation"
    }
  ]
}

Configuration Example

mcpServer:
  llm:
    serverName: "llm-server"
    serverVersion: "v1.0.0"
    models:
      - name: "gemini-2.5-flash"
        provider: "google"
        apiKey: "${GEMINI_API_KEY}"
      - name: "gpt-4"
        provider: "openai"
        apiKey: "${OPENAI_API_KEY}"
  
  vector:
    database:
      type: "tidb"
      host: "localhost"
      port: 4000
      database: "vector_db"

🐳 Deployment Guide (Not complete yet)

Kubernetes Deployment

  1. Create Namespace
kubectl create namespace mcp-system
  1. Deploy Application
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
  1. Configure ConfigMap
kubectl apply -f k8s/configmap.yaml

CI/CD Pipeline

The project supports complete CI/CD pipeline:

  1. Code Commit β†’ GitHub/GitLab
  2. Automated Testing β†’ Jenkins
  3. Build Image β†’ Docker
  4. Push Image β†’ Docker Registry
  5. Auto Deploy β†’ ArgoCD + Kubernetes

πŸ› οΈ Development Guide

Project Structure

GoMcp/
β”œβ”€β”€ cmd/                    # Main program entry
β”œβ”€β”€ internal/              # Internal packages
β”‚   β”œβ”€β”€ common/           # Common components
β”‚   β”‚   β”œβ”€β”€ config/       # Configuration management
β”‚   β”‚   β”œβ”€β”€ model/        # Data models
β”‚   β”‚   └── opentelemetry/ # Observability
β”‚   β”œβ”€β”€ llm/              # LLM services
β”‚   β”‚   β”œβ”€β”€ domain/       # Domain models
β”‚   β”‚   β”œβ”€β”€ service/      # Business services
β”‚   β”‚   β”œβ”€β”€ handler/      # Request handlers
β”‚   β”‚   └── factory/      # Tool factory
β”‚   └── file/             # File services
β”œβ”€β”€ example/              # Example code
β”œβ”€β”€ test/                 # Test cases
β”œβ”€β”€ Requirement/          # Requirement documents
└── images/              # Documentation images

Adding New Tools

  1. Implement Tool Interface
type Tool interface {
    Name() string
    Description() string
    Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
}
  1. Register Tool
func init() {
    factory.RegisterTool("myTool", &MyTool{})
}
  1. Write Tests
func TestMyTool(t *testing.T) {
    // Test code
}

Running Tests

# Run all tests
make test

# Run MCP integration tests
make test-mcp

# Run specific tests
go test -v ./test/llm_function_test/

🀝 Contributing

We welcome all forms of contributions!

Contribution Process

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Standards

  • Follow Go language coding standards
  • Add necessary test cases
  • Update relevant documentation
  • Ensure CI/CD pipeline passes

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Contact Us


⭐ If this project helps you, please give us a star!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published