MCP Gemini CLI Base

MCP Gemini CLI Base

A base setup for creating MCP servers that integrate with Google's Gemini CLI, including example implementations for weather data retrieval from OpenWeatherMap and basic resource/tool definitions using FastMCP.

Category
Visit Server

README

MCP Project Setup

This document outlines the steps to set up the mcp project environment.

1. Create Conda Environment

Create a new conda environment named mcp with Python 3.12:

conda create -n mcp python=3.12 -y

2. Install uv

Install the uv package manager using the following command:

curl -LsSf https://astral.sh/uv/install.sh | sh

3. Install fastmcp

Install the fastmcp package using uv in the mcp environment:

conda run -n mcp uv pip install fastmcp

4. Verify Installation

Confirm the fastmcp installation by running the following command:

conda run -n mcp fastmcp version

5. Running the Hello World Server

mcp_hello.py is a "hello world" type mcp server. You can run the MCP inspector for it using the following command:

conda run -n mcp fastmcp dev mcp_hello.py:mcp

6. Connecting with Proxy Session Token

Copy the provided session token from CLI, click on the provided link, paste in Configuration -> Proxy Session Token, click connect.

7. Inspect hello_world tool

Click on Tools in the top menu bar. "hello_world" should be listed with a parameter "name". Input your name and click "Run Tool". The tool should succeed and return a greeting.

8. Running Resource Tests

mcp_resources.py defines MCP resources. You can run tests for these resources using the --test argument:

uv run mcp_resources.py --test

9. Weather Server

mcp_weather.py exposes a tool to get current weather data from OpenWeatherMap.

Before running: Ensure you have set your OPENWEATHER_API_KEY in the .env file:

OPENWEATHER_API_KEY=YOUR_API_KEY_HERE

To run the weather server manually:

conda run -n mcp fastmcp dev mcp_weather.py:mcp

To run tests for the weather tool:

uv run mcp_weather.py --test

10. Integrating with Gemini CLI

To allow the Gemini CLI to automatically start and connect to your mcp_weather server, you need to configure its settings.json file.

  1. Locate settings.json: The settings.json file is typically located at:

    • Linux/macOS: ~/.gemini/settings.json
    • Windows: %APPDATA%\gemini\settings.json

    If the file or directory does not exist, create them.

  2. Add mcpServers entry: Add the following entry to the mcpServers section in your settings.json file. Replace /mnt/d/Projects/_sandbox/mcp/ with the absolute path to your mcp project directory.

    {
      "mcpServers": {
        "weather_server": {
          "command": "uv",
          "args": [
            "run",
            "/mnt/d/Projects/_sandbox/mcp/mcp_weather.py"
          ],
          "cwd": "/mnt/d/Projects/_sandbox/mcp",
          "timeout": 10000
        }
      }
    }
    

    Once configured, when you run gemini, the CLI will automatically start your mcp_weather.py server and make its get_current_weather tool available to the Gemini model.

References

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
Qdrant Server

Qdrant Server

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

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
E2B

E2B

Using MCP to run code via e2b.

Official
Featured