gemini-cli-mcp-async

gemini-cli-mcp-async

Enables asynchronous and parallel execution of Gemini CLI tasks within Claude Code, allowing background task management and multi-instance parallelism.

Category
Visit Server

README

Gemini CLI MCP Async Server

Asynchronous MCP wrapper for Gemini CLI

Enable Claude Code to spawn child Gemini CLI sessions for parallel task execution.

Features

  • โœ… Async execution - Start tasks in background, continue working
  • โœ… Multi-instance parallelism - Run multiple Gemini CLI sessions simultaneously
  • โœ… Automatic cleanup - No zombie processes
  • โœ… Zero config - Works out of the box

Quick Start

๐Ÿš€ Install with UVX

Zero configuration - just run:

uvx gemini-cli-mcp-async

Configure Claude Code or other MCP Client

Add to your ~/.claude/settings.json:

{
  "mcpServers": {
    "gemini-cli-mcp": {
      "command": "uvx",
      "args": ["gemini-cli-mcp-async"],
      "env": {}
    }
  }
}

Restart Claude Code

Reload or restart Claude Code to load the MCP server.

Usage Examples

๐Ÿš€ Async Execution (Game Changer!)

Start a long task and continue working immediately:

You:

Please analyze the entire project code and generate a comprehensive technical report

Claude: I'll analyze your entire project and generate a technical report. This is a large task, so I'll start it asynchronously...

โœ… Task Started (Task ID: abc12345) You can continue working on other things while it runs in the background!

You: (Continue working immediately)

While the report is generating, help me write some unit tests

Claude: Sure! Let me write those unit tests for you...

You: (A few minutes later)

Can you check if the report task is finished?

Claude: โœ… Report Complete!

[View Detailed Technical Report]

  • Project structure analysis
  • Code quality assessment
  • Performance optimization recommendations
  • Security audit results

โšก Parallel Execution

Run multiple tasks simultaneously:

You:

I need to do three things at once:

  1. Generate unit tests for utils.py
  2. Refactor database.py to use async/await
  3. Add type hints to all functions in api.py

Claude: I'll start all three tasks in parallel!

๐Ÿ”„ Task 1 Started (Task ID: task1) - Generating unit tests ๐Ÿ”„ Task 2 Started (Task ID: task2) - Refactoring database code ๐Ÿ”„ Task 3 Started (Task ID: task3) - Adding type hints

All tasks are running in parallel...

You: (Later)

Are all three tasks finished?

Claude: โœ… All Complete!

  • โœ… Task 1: Unit tests for utils.py generated
  • โœ… Task 2: database.py refactored to async mode
  • โœ… Task 3: Type hints added to api.py functions

๐ŸŽฏ Quick Sync Tasks

For simple immediate tasks:

You:

Write a Python function to validate email addresses

Claude:

import re

def validate_email(email):
    pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
    return re.match(pattern, email) is not None

# Usage examples
print(validate_email("user@example.com"))  # True
print(validate_email("invalid-email"))    # False

โœ… Task Complete!

Why Async?

Problem: Gemini CLI blocks the parent session while running.

Solution: This MCP server spawns child Gemini CLI processes that run in the background.

Benefits:

  • ๐Ÿš€ Start a task and continue working immediately
  • โšก Run multiple tasks in parallel
  • ๐ŸŽฏ No blocking, no waiting
  • ๐Ÿงน Automatic process cleanup

API Reference

gemini_cli_execute(query, working_dir, sandbox, yolo, approval_mode, experimental_acp, allowed_mcp_server_names, allowed_tools, extensions, include_directories, output_format, screen_reader, debug, additional_args, timeout)

Execute Gemini CLI synchronously and return result immediately.

gemini_cli_execute_async(query, working_dir, sandbox, yolo, approval_mode, experimental_acp, allowed_mcp_server_names, allowed_tools, extensions, include_directories, output_format, screen_reader, debug, additional_args)

Start Gemini CLI task in background and return task_id.

gemini_cli_check_result(task_id)

Check status of async task and return result if completed.

Configuration

All Gemini CLI parameters are supported. Key options:

  • sandbox - Enable sandbox mode
  • yolo - Auto-confirm prompts
  • approval_mode - Set approval mode ('default', 'auto_edit', 'yolo')
  • output_format - Output format ('text', 'json', 'stream-json')
  • timeout - Timeout for sync execution (seconds)
  • debug - Enable debug logging

Troubleshooting

Server not showing up?

  • Use absolute path in config
  • Run: chmod +x gemini_cli_mcp_async_server.py
  • Restart Claude Code

Task stuck in "running"?

  • Wait a moment, large tasks take time
  • Check: ls -la /tmp/gemini_cli_tasks/
  • View logs: tail -f /tmp/gemini_cli_mcp_debug.log

No output from long tasks:

  • Use output_format="stream-json" for better output capture
  • Check disk space in /tmp

Requirements

  • Python 3.8+
  • uvx
  • Gemini CLI installed

License

MIT License


Questions? Open an issue on GitHub.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured