Support for Gemini CLI (setup instructions) - WIP
This commit is contained in:
86
README.md
86
README.md
@@ -3,12 +3,12 @@
|
||||
[zen_web.webm](https://github.com/user-attachments/assets/851e3911-7f06-47c0-a4ab-a2601236697c)
|
||||
|
||||
<div align="center">
|
||||
<b>🤖 Claude + [Gemini / OpenAI / Grok / OpenRouter / DIAL / Ollama / Any Model] = Your Ultimate AI Development Team</b>
|
||||
<b>🤖 [Claude](https://www.anthropic.com/claude-code) OR [Gemini CLI](https://github.com/google-gemini/gemini-cli) + [Gemini / OpenAI / Grok / OpenRouter / DIAL / Ollama / Any Model] = Your Ultimate AI Development Team</b>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
The ultimate development partners for Claude - a Model Context Protocol server that gives Claude access to multiple AI
|
||||
The ultimate development partners for your favorite Coding Agent ([Claude](https://www.anthropic.com/claude-code) OR [Gemini CLI](https://github.com/google-gemini/gemini-cli)) - a Model Context Protocol server that gives you access to multiple AI
|
||||
models for enhanced code analysis, problem-solving, and collaborative development.
|
||||
|
||||
**Features true AI orchestration with conversations that continue across workflows** - Give Claude a complex
|
||||
@@ -73,7 +73,7 @@ Because these AI models [clearly aren't when they get chatty →](docs/ai_banter
|
||||
- [Complete Advanced Guide](docs/advanced-usage.md) - Model configuration, thinking modes, workflows, tool parameters
|
||||
|
||||
- **Setup & Support**
|
||||
- [WSL Setup Guide](#21-wsl-windows-subsystem-for-linux-setup-guide) - Windows Subsystem for Linux configuration
|
||||
- [WSL Setup Guide](docs/wsl-setup.md) - Windows Subsystem for Linux configuration
|
||||
- [Troubleshooting Guide](docs/troubleshooting.md) - Common issues and debugging steps
|
||||
- [License](#license) - Apache 2.0
|
||||
|
||||
@@ -181,85 +181,13 @@ cd zen-mcp-server
|
||||
- **Sets up everything automatically** - Python environment, dependencies, configuration
|
||||
- **Configures Claude integrations** - Adds to Claude Code CLI and guides Desktop setup
|
||||
- **Ready to use immediately** - No manual configuration needed
|
||||
- **Also works with Gemini CLI** - See [Gemini CLI Setup](docs/gemini-setup.md) for configuration
|
||||
|
||||
**After updates:** Always run `./run-server.sh` again after `git pull` to ensure everything stays current.
|
||||
|
||||
**Windows users:** Using WSL? See the [WSL Setup Guide](docs/wsl-setup.md) for detailed instructions.
|
||||
|
||||
### 2.1. WSL (Windows Subsystem for Linux) Setup Guide
|
||||
|
||||
If you're running on Windows with WSL, follow these additional steps to ensure proper configuration:
|
||||
|
||||
#### Prerequisites for WSL
|
||||
```bash
|
||||
# Update WSL and ensure you have a recent Ubuntu distribution
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
|
||||
# Install required system dependencies
|
||||
sudo apt install -y python3-venv python3-pip curl git
|
||||
|
||||
# Install Node.js and npm (required for Claude Code CLI)
|
||||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
||||
sudo apt install -y nodejs
|
||||
|
||||
# Install Claude Code CLI globally
|
||||
npm install -g @anthropic-ai/claude-code
|
||||
```
|
||||
|
||||
#### WSL-Specific Installation Steps
|
||||
|
||||
1. **Clone the repository in your WSL environment** (not in Windows filesystem):
|
||||
```bash
|
||||
# Navigate to your home directory or preferred location in WSL
|
||||
cd ~
|
||||
|
||||
# Clone the repository
|
||||
git clone https://github.com/BeehiveInnovations/zen-mcp-server.git
|
||||
cd zen-mcp-server
|
||||
```
|
||||
|
||||
2. **Run the setup script**:
|
||||
```bash
|
||||
# Make the script executable and run it
|
||||
chmod +x run-server.sh
|
||||
./run-server.sh
|
||||
```
|
||||
|
||||
3. **Verify Claude Code can find the MCP server**:
|
||||
```bash
|
||||
# List configured MCP servers
|
||||
claude mcp list
|
||||
|
||||
# You should see 'zen' listed in the output
|
||||
# If not, the setup script will provide the correct configuration
|
||||
```
|
||||
|
||||
#### Troubleshooting WSL Issues
|
||||
|
||||
**Python Environment Issues:**
|
||||
```bash
|
||||
# If you encounter Python virtual environment issues
|
||||
sudo apt install -y python3.12-venv python3.12-dev
|
||||
|
||||
# Ensure pip is up to date
|
||||
python3 -m pip install --upgrade pip
|
||||
```
|
||||
|
||||
**Path Issues:**
|
||||
- Always use the full WSL path for MCP configuration (e.g., `/home/YourName/zen-mcp-server/`)
|
||||
- The setup script automatically detects WSL and configures the correct paths
|
||||
|
||||
**Claude Code Connection Issues:**
|
||||
```bash
|
||||
# If Claude Code can't connect to the MCP server, check the configuration
|
||||
cat ~/.claude.json | grep -A 10 "zen"
|
||||
|
||||
# The configuration should show the correct WSL path to the Python executable
|
||||
# Example: "/home/YourName/zen-mcp-server/.zen_venv/bin/python"
|
||||
```
|
||||
|
||||
**Performance Tip:** For best performance, keep your zen-mcp-server directory in the WSL filesystem (e.g., `~/zen-mcp-server`) rather than in the Windows filesystem (`/mnt/c/...`).
|
||||
|
||||
### 4. Add Your API Keys
|
||||
### 3. Add Your API Keys
|
||||
|
||||
```bash
|
||||
# Edit .env to add your API keys (if not already set in environment)
|
||||
@@ -297,7 +225,7 @@ If you were already running a `claude` code session, please exit and start a new
|
||||
2. **Copy the configuration** shown by `./run-server.sh -c` into your `claude_desktop_config.json`
|
||||
3. **Restart Claude Desktop** for changes to take effect
|
||||
|
||||
### 5. Start Using It!
|
||||
### 4. Start Using It!
|
||||
|
||||
Just ask Claude naturally:
|
||||
- "Think deeper about this architecture design with zen" → Claude picks best model + `thinkdeep`
|
||||
|
||||
43
docs/gemini-setup.md
Normal file
43
docs/gemini-setup.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Gemini CLI Setup
|
||||
|
||||
> **Note**: While Zen MCP Server connects successfully to Gemini CLI, tool invocation is not working
|
||||
> correctly yet. We'll update this guide once the integration is fully functional.
|
||||
|
||||
This guide explains how to configure Zen MCP Server to work with [Gemini CLI](https://github.com/google-gemini/gemini-cli).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Zen MCP Server installed and configured
|
||||
- Gemini CLI installed
|
||||
- At least one API key configured in your `.env` file
|
||||
|
||||
## Configuration
|
||||
|
||||
1. Edit `~/.gemini/settings.json` and add:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"zen": {
|
||||
"command": "/path/to/zen-mcp-server/zen-mcp-server"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. Replace `/path/to/zen-mcp-server` with your actual Zen installation path.
|
||||
|
||||
3. If the `zen-mcp-server` wrapper script doesn't exist, create it:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$DIR"
|
||||
exec .zen_venv/bin/python server.py "$@"
|
||||
```
|
||||
|
||||
Then make it executable: `chmod +x zen-mcp-server`
|
||||
|
||||
4. Restart Gemini CLI.
|
||||
|
||||
All 15 Zen tools are now available in your Gemini CLI session.
|
||||
79
docs/wsl-setup.md
Normal file
79
docs/wsl-setup.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# WSL (Windows Subsystem for Linux) Setup Guide
|
||||
|
||||
This guide provides detailed instructions for setting up Zen MCP Server on Windows using WSL.
|
||||
|
||||
## Prerequisites for WSL
|
||||
|
||||
```bash
|
||||
# Update WSL and ensure you have a recent Ubuntu distribution
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
|
||||
# Install required system dependencies
|
||||
sudo apt install -y python3-venv python3-pip curl git
|
||||
|
||||
# Install Node.js and npm (required for Claude Code CLI)
|
||||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
||||
sudo apt install -y nodejs
|
||||
|
||||
# Install Claude Code CLI globally
|
||||
npm install -g @anthropic-ai/claude-code
|
||||
```
|
||||
|
||||
## WSL-Specific Installation Steps
|
||||
|
||||
1. **Clone the repository in your WSL environment** (not in Windows filesystem):
|
||||
```bash
|
||||
# Navigate to your home directory or preferred location in WSL
|
||||
cd ~
|
||||
|
||||
# Clone the repository
|
||||
git clone https://github.com/BeehiveInnovations/zen-mcp-server.git
|
||||
cd zen-mcp-server
|
||||
```
|
||||
|
||||
2. **Run the setup script**:
|
||||
```bash
|
||||
# Make the script executable and run it
|
||||
chmod +x run-server.sh
|
||||
./run-server.sh
|
||||
```
|
||||
|
||||
3. **Verify Claude Code can find the MCP server**:
|
||||
```bash
|
||||
# List configured MCP servers
|
||||
claude mcp list
|
||||
|
||||
# You should see 'zen' listed in the output
|
||||
# If not, the setup script will provide the correct configuration
|
||||
```
|
||||
|
||||
## Troubleshooting WSL Issues
|
||||
|
||||
### Python Environment Issues
|
||||
|
||||
```bash
|
||||
# If you encounter Python virtual environment issues
|
||||
sudo apt install -y python3.12-venv python3.12-dev
|
||||
|
||||
# Ensure pip is up to date
|
||||
python3 -m pip install --upgrade pip
|
||||
```
|
||||
|
||||
### Path Issues
|
||||
|
||||
- Always use the full WSL path for MCP configuration (e.g., `/home/YourName/zen-mcp-server/`)
|
||||
- The setup script automatically detects WSL and configures the correct paths
|
||||
|
||||
### Claude Code Connection Issues
|
||||
|
||||
```bash
|
||||
# If Claude Code can't connect to the MCP server, check the configuration
|
||||
cat ~/.claude.json | grep -A 10 "zen"
|
||||
|
||||
# The configuration should show the correct WSL path to the Python executable
|
||||
# Example: "/home/YourName/zen-mcp-server/.zen_venv/bin/python"
|
||||
```
|
||||
|
||||
### Performance Tip
|
||||
|
||||
For best performance, keep your zen-mcp-server directory in the WSL filesystem (e.g., `~/zen-mcp-server`) rather than in the Windows filesystem (`/mnt/c/...`).
|
||||
118
run-server.sh
118
run-server.sh
@@ -1298,11 +1298,108 @@ EOF
|
||||
fi
|
||||
}
|
||||
|
||||
# Check and update Gemini CLI configuration
|
||||
check_gemini_cli_integration() {
|
||||
local script_dir="$1"
|
||||
local zen_wrapper="$script_dir/zen-mcp-server"
|
||||
|
||||
# Check if Gemini settings file exists
|
||||
local gemini_config="$HOME/.gemini/settings.json"
|
||||
if [[ ! -f "$gemini_config" ]]; then
|
||||
# Gemini CLI not installed or not configured
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check if zen is already configured
|
||||
if grep -q '"zen"' "$gemini_config" 2>/dev/null; then
|
||||
# Already configured
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Ask user if they want to add Zen to Gemini CLI
|
||||
echo ""
|
||||
read -p "Configure Zen for Gemini CLI? (Y/n): " -n 1 -r
|
||||
echo ""
|
||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
print_info "Skipping Gemini CLI integration"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Ensure wrapper script exists
|
||||
if [[ ! -f "$zen_wrapper" ]]; then
|
||||
print_info "Creating wrapper script for Gemini CLI..."
|
||||
cat > "$zen_wrapper" << 'EOF'
|
||||
#!/bin/bash
|
||||
# Wrapper script for Gemini CLI compatibility
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$DIR"
|
||||
exec .zen_venv/bin/python server.py "$@"
|
||||
EOF
|
||||
chmod +x "$zen_wrapper"
|
||||
print_success "Created zen-mcp-server wrapper script"
|
||||
fi
|
||||
|
||||
# Update Gemini settings
|
||||
print_info "Updating Gemini CLI configuration..."
|
||||
|
||||
# Create backup
|
||||
cp "$gemini_config" "${gemini_config}.backup_$(date +%Y%m%d_%H%M%S)"
|
||||
|
||||
# Add zen configuration using Python for proper JSON handling
|
||||
local temp_file=$(mktemp)
|
||||
python3 -c "
|
||||
import json
|
||||
import sys
|
||||
|
||||
try:
|
||||
with open('$gemini_config', 'r') as f:
|
||||
config = json.load(f)
|
||||
|
||||
# Ensure mcpServers exists
|
||||
if 'mcpServers' not in config:
|
||||
config['mcpServers'] = {}
|
||||
|
||||
# Add zen server
|
||||
config['mcpServers']['zen'] = {
|
||||
'command': '$zen_wrapper'
|
||||
}
|
||||
|
||||
with open('$temp_file', 'w') as f:
|
||||
json.dump(config, f, indent=2)
|
||||
|
||||
except Exception as e:
|
||||
print(f'Error processing config: {e}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
" && mv "$temp_file" "$gemini_config"
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
print_success "Successfully configured Gemini CLI"
|
||||
echo " Config: $gemini_config"
|
||||
echo " Restart Gemini CLI to use Zen MCP Server"
|
||||
else
|
||||
print_error "Failed to update Gemini CLI config"
|
||||
echo "Manual config location: $gemini_config"
|
||||
echo "Add this configuration:"
|
||||
cat << EOF
|
||||
{
|
||||
"mcpServers": {
|
||||
"zen": {
|
||||
"command": "$zen_wrapper"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
# Display configuration instructions
|
||||
display_config_instructions() {
|
||||
local python_cmd="$1"
|
||||
local server_path="$2"
|
||||
|
||||
# Get script directory for Gemini CLI config
|
||||
local script_dir=$(dirname "$server_path")
|
||||
|
||||
echo ""
|
||||
local config_header="ZEN MCP SERVER CONFIGURATION"
|
||||
echo "===== $config_header ====="
|
||||
@@ -1340,6 +1437,20 @@ EOF
|
||||
echo ""
|
||||
print_info "3. Restart Claude Desktop after updating the config file"
|
||||
echo ""
|
||||
|
||||
print_info "For Gemini CLI:"
|
||||
echo " Add this configuration to ~/.gemini/settings.json:"
|
||||
echo ""
|
||||
cat << EOF
|
||||
{
|
||||
"mcpServers": {
|
||||
"zen": {
|
||||
"command": "$script_dir/zen-mcp-server"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Display setup instructions
|
||||
@@ -1509,7 +1620,10 @@ main() {
|
||||
check_claude_cli_integration "$python_cmd" "$server_path"
|
||||
check_claude_desktop_integration "$python_cmd" "$server_path"
|
||||
|
||||
# Step 10: Display log information
|
||||
# Step 10: Check Gemini CLI integration
|
||||
check_gemini_cli_integration "$script_dir"
|
||||
|
||||
# Step 11: Display log information
|
||||
echo ""
|
||||
echo "Logs will be written to: $script_dir/$LOG_DIR/$LOG_FILE"
|
||||
echo ""
|
||||
@@ -1522,7 +1636,7 @@ main() {
|
||||
echo "To show config: ./run-server.sh -c"
|
||||
echo "To update: git pull, then run ./run-server.sh again"
|
||||
echo ""
|
||||
echo "Happy Clauding! 🎉"
|
||||
echo "Happy coding! 🎉"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,16 @@ class ListModelsTool(BaseTool):
|
||||
|
||||
def get_input_schema(self) -> dict[str, Any]:
|
||||
"""Return the JSON schema for the tool's input"""
|
||||
return {"type": "object", "properties": {}, "required": []}
|
||||
return {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "Model to use (ignored by listmodels tool)"
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
}
|
||||
|
||||
def get_system_prompt(self) -> str:
|
||||
"""No AI model needed for this tool"""
|
||||
|
||||
@@ -147,7 +147,16 @@ class VersionTool(BaseTool):
|
||||
|
||||
def get_input_schema(self) -> dict[str, Any]:
|
||||
"""Return the JSON schema for the tool's input"""
|
||||
return {"type": "object", "properties": {}, "required": []}
|
||||
return {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "Model to use (ignored by version tool)"
|
||||
}
|
||||
},
|
||||
"required": []
|
||||
}
|
||||
|
||||
def get_system_prompt(self) -> str:
|
||||
"""No AI model needed for this tool"""
|
||||
|
||||
11
zen-mcp-server
Executable file
11
zen-mcp-server
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Wrapper script for Gemini CLI compatibility
|
||||
|
||||
# Get the directory of this script
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Change to the zen-mcp-server directory
|
||||
cd "$DIR"
|
||||
|
||||
# Execute the Python server with all arguments passed through
|
||||
exec .zen_venv/bin/python server.py "$@"
|
||||
Reference in New Issue
Block a user