# 🚀 TryAII MCP Server

**15+ AI models with comparison, cost tracking, and collective intelligence through the Model Context Protocol (MCP)**

[![npm version](https://badge.fury.io/js/tryaii-mcp-server.svg)](https://badge.fury.io/js/tryaii-mcp-server)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## 🌟 Features

- **🤖 15+ AI Models**: OpenAI, Anthropic, Google, DeepSeek, xAI, Mistral, and more
- **🔍 Real-time Comparisons**: Side-by-side model analysis
- **📊 Cost Tracking**: Monitor API usage and costs
- **🧠 Collective Intelligence**: Multi-model consensus queries
- **🔐 Smart API Keys**: 3-tier fallback system (user → server → graceful)
- **🌐 Production Ready**: MongoDB integration, authentication, monitoring

## 🚀 Quick Start

### 1. Install

```bash
npm install -g tryaii-mcp-server
```

### 2. Configure Claude Desktop

Add to your Claude Desktop configuration file:

**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`  
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`  
**Linux**: `~/.config/Claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "tryaii": {
      "command": "tryaii-mcp",
      "env": {
        "TRYAII_API_KEY": "your-tryaii-api-key-here"
      }
    }
  }
}
```

### 3. Get Your TryAII API Key

Visit [TryAII.com](https://tryaii.com) to get your API key, or use the server without an API key (limited usage with fallback keys).

### 4. Restart Claude Desktop

Restart Claude Desktop to load the MCP server.

## 🤖 Available Tools

### Core AI Tools
- **`get_available_models`** - List all 15+ AI models with capabilities and pricing
- **`chat_with_model`** - Chat with any specific AI model
- **`compare_models`** - Compare responses from multiple models side-by-side
- **`brains`** - Get responses from top models (GPT-4o, Claude 3.5 Sonnet, Gemini 2.0) simultaneously
- **`get_model_info`** - Get detailed information about any model

### Supported AI Providers
- **OpenAI**: GPT-4, GPT-4 Turbo, GPT-3.5 Turbo, GPT-4o, GPT-4o Mini
- **Anthropic**: Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku
- **Google**: Gemini Pro, Gemini 1.5 Pro, Gemini 2.0 Flash
- **DeepSeek**: DeepSeek Chat, DeepSeek Coder
- **xAI**: Grok Beta
- **Mistral**: Mistral Large, Mistral Medium, Mistral Small

## 🔧 Configuration Options

### With TryAII API Key (Recommended)
```json
{
  "mcpServers": {
    "tryaii": {
      "command": "tryaii-mcp",
      "env": {
        "TRYAII_API_KEY": "tai_your_api_key_here"
      }
    }
  }
}
```

### With Your Own API Keys
```json
{
  "mcpServers": {
    "tryaii": {
      "command": "tryaii-mcp",
      "env": {
        "USER_OPENAI_API_KEY": "sk-proj-your-openai-key",
        "USER_ANTHROPIC_API_KEY": "sk-ant-your-anthropic-key",
        "USER_GOOGLE_API_KEY": "your-google-api-key",
        "BRAVE_API_KEY": "your-brave-search-key"
      }
    }
  }
}
```

### Custom Server URL
```json
{
  "mcpServers": {
    "tryaii": {
      "command": "tryaii-mcp",
      "env": {
        "TRYAII_API_KEY": "your-api-key",
        "TRYAII_BASE_URL": "https://your-custom-server.com"
      }
    }
  }
}
```

## 💡 Example Usage

Once configured, you can use these tools directly in Claude:

### Compare Multiple Models
```
Compare the responses from GPT-4, Claude 3.5 Sonnet, and Gemini Pro for: "Explain quantum computing in simple terms"
```

### Get Model Information
```
What are the capabilities and pricing for GPT-4o?
```

### Use the Brains Feature
```
Use the brains tool to get collective intelligence on: "What are the best practices for AI safety?"
```

### Chat with Specific Model
```
Chat with DeepSeek Coder about implementing a binary search algorithm in Python
```

## 🔍 Architecture

This MCP server acts as a bridge to the hosted TryAII service:

```
Claude Desktop ↔ tryaii-mcp (npm package) ↔ tryaii-mcp.onrender.com ↔ AI Providers
```

### Key Features:
- **Smart Fallback**: Uses your API keys first, then server fallback keys
- **Cost Tracking**: Real-time cost analysis across all providers
- **Web Search**: Enhanced responses with Brave Search integration
- **Comparison Tools**: Side-by-side model comparisons
- **Collective Intelligence**: Multi-model consensus responses

## 🛠️ Troubleshooting

### Server Not Responding
1. Check server status: https://tryaii-mcp.onrender.com/health
2. Verify your API key is correct
3. Try restarting Claude Desktop

### API Key Issues
- TryAII API keys start with `tai_`
- Get your key from https://tryaii.com/settings
- Verify the key is set in your environment configuration

### Tool Not Available
- Ensure you've restarted Claude Desktop after configuration
- Check the Claude Desktop logs for connection errors
- Verify the MCP server is listed in Claude's settings

## 🔗 Links

- **TryAII Website**: https://tryaii.com
- **Server Status**: https://tryaii-mcp.onrender.com/health
- **GitHub**: https://github.com/your-username/tryaii-mcp-server
- **Support**: https://github.com/your-username/tryaii-mcp-server/issues

## 📝 License

MIT License - see LICENSE file for details.

## 🆘 Support

- **Issues**: [GitHub Issues](https://github.com/your-username/tryaii-mcp-server/issues)
- **Community**: r/mcp on Reddit
- **Documentation**: https://tryaii-mcp.onrender.com/docs

---

**Made with ❤️ for the MCP community** 