mcp-go-gemini

Tai-DT/mcp-go-gemini

3.2

If you are the rightful owner of mcp-go-gemini and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Go Gemini Server is a robust Model Context Protocol server built using Go, integrating with Google Gemini API to deliver advanced AI features.

Tools
5
Resources
0
Prompts
0

MCP Go Gemini Server

🚀 Một MCP (Model Context Protocol) server được xây dựng bằng Go, tích hợp với Google Gemini API để cung cấp các tính năng AI tiên tiến.

Go Version MCP Compatible

✨ Tính năng

  • 🤖 Text Generation: Tạo văn bản thông minh với Gemini
  • 🔍 Code Analysis: Phân tích, giải thích và review mã nguồn
  • ✍️ Text Improvement: Cải thiện văn bản và nâng cao chất lượng
  • 🌐 Translation: Dịch thuật đa ngôn ngữ chính xác
  • ❓ Question Answering: Trả lời câu hỏi với độ chính xác cao
  • ⚡ Code Generation: Tạo mã nguồn từ mô tả tự nhiên
  • 📄 Document Summarization: Tóm tắt tài liệu thông minh

🚀 Cài đặt nhanh

Yêu cầu hệ thống

Cài đặt

# Clone repository
git clone <repository-url>
cd mcp-go-gemini

# Cài đặt dependencies
go mod tidy

# Thiết lập API key
export GEMINI_API_KEY="your-api-key-here"

# Build và chạy
go build -o mcp-go-gemini .
./mcp-go-gemini

Hoặc sử dụng script nhanh:

./start.sh

🛠 Sử dụng với MCP Clients

Claude Desktop

Thêm cấu hình vào claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-go-gemini": {
      "command": "/path/to/mcp-go-gemini",
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}

VS Code + Cline Extension

  1. Cài đặt Cline extension
  2. Cấu hình MCP server trong settings
  3. Sử dụng trực tiếp trong VS Code

📚 API Documentation

Các công cụ có sẵn

Công cụMô tảTham số
generate_textTạo văn bảnprompt, temperature, max_tokens
analyze_codePhân tích mã nguồncode, language, task
improve_textCải thiện văn bảntext, task
translate_textDịch thuậttext, source_language, target_language
answer_questionTrả lời câu hỏiquestion, context
generate_codeTạo mã nguồndescription, language, framework
summarize_documentTóm tắt tài liệucontent, length

Ví dụ sử dụng

Tạo văn bản
{
  "name": "generate_text",
  "arguments": {
    "prompt": "Viết một bài thơ về ngôn ngữ lập trình Go",
    "temperature": 0.8
  }
}
Phân tích mã nguồn
{
  "name": "analyze_code", 
  "arguments": {
    "code": "func main() { fmt.Println(\"Hello, World!\") }",
    "language": "go",
    "task": "explain"
  }
}
Dịch thuật
{
  "name": "translate_text",
  "arguments": {
    "text": "Hello, world!",
    "source_language": "English", 
    "target_language": "Vietnamese"
  }
}

Xem thêm tại

📁 Cấu trúc dự án

mcp-go-gemini/
├── main.go                 # Entry point
├── internal/
│   ├── gemini/            # Gemini API integration
│   │   └── client.go
│   ├── handlers/          # Tool handlers
│   │   └── handlers.go
│   └── config/            # Configuration
│       └── config.go
├── examples/              # Usage examples
├── docs/                  # Documentation
├── Dockerfile            # Docker configuration
├── docker-compose.yml    # Docker Compose
├── Makefile              # Build automation
└── README.md

🧪 Testing

Chạy test để kiểm tra functionality:

# Unit tests
go test ./...

# Integration test với API thật
go run test_client.go

# Build test
make test

🐳 Docker Support

# Build image
docker build -t mcp-go-gemini .

# Run với docker-compose
docker-compose up -d

🔧 Development

Build commands

make build      # Build binary
make run        # Build và chạy
make clean      # Clean artifacts
make test       # Run tests
make lint       # Code linting

Code structure

  • internal/gemini/: Gemini API client và wrapper
  • internal/handlers/: MCP tool handlers
  • internal/config/: Configuration management
  • main.go: Server initialization và tool registration

🚦 Performance

  • Response time: ~1-3 giây cho most operations
  • Concurrency: Thread-safe, hỗ trợ multiple clients
  • Memory: ~10-50MB runtime usage
  • Rate limiting: Tuân thủ Gemini API limits

🔐 Security

  • ✅ API key qua environment variables
  • ✅ Input validation và sanitization
  • ✅ Error handling secure
  • ✅ No sensitive data logging
  • ✅ HTTPS cho tất cả API calls

📋 Troubleshooting

Lỗi thường gặp

  1. "GEMINI_API_KEY not set"

    • Đảm bảo đã set environment variable
    • Kiểm tra API key hợp lệ
  2. "Failed to create client"

    • Kiểm tra internet connection
    • Verify API key tại Google AI Studio
  3. Build errors

    • Đảm bảo Go 1.21+
    • Chạy go mod tidy

Xem thêm tại

🤝 Contributing

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

📄 License

Distributed under the MIT License. See LICENSE for more information.

🙏 Acknowledgments

📞 Support

  • 📧 Email: [your-email]
  • 🐛 Issues: [GitHub Issues]
  • 💬 Discussions: [GitHub Discussions]
  • 📖 Docs: [Full Documentation]

Made with ❤️ and GoPowered by Gemini AIMCP Compatible