# mcp_client

> MCP Client

This repository provides two MCP client implementations that connect to an MCP server and send queries to Google Gemini AI. It enables Gemini to call external tools and maintains conversation

## Overview

- **Category:** AI
- **Language:** Python
- **Stars:** 115
- **Forks:** 0
- **Owner:** theailanguage
- **GitHub:** https://github.com/theailanguage/mcp_client
- **Homepage:** https://youtu.be/hccNm88bk6w
- **Created:** 2025-03-15T14:44:00+00:00
- **Updated:** 2025-03-27T06:25:22+00:00
- **Source:** https://model-context-protocol.com/clients/mcp-client-gemini-langgraph-python

## Setup

## Setup

**1â£ Install the required dependencies using `uv` (Universal Virtualenv):**
```bash
uv add mcp python-dotenv google-genai
```

**2â£ Clone this repository:**
```bash
git clone https://github.com/your-username/mcp-client-gemini.git
cd mcp-client-gemini
```

**3â£ Set up the project and virtual environment:**
```bash
uv init mcp-client
cd mcp-client
uv venv
```

**4â£ Activate the virtual environment:**
```bash
# On Windows:
.venv\Scripts\activate

# On MacOS/Linux:
source .venv/bin/activate
```

---

## ð **Setting Up the API Key**

To use **Google Gemini AI**, you need an **API key**.

**1â£ Create a `.env` file:**
```bash
touch .env
```

**2â£ Add your API key inside `.env`:**
```
GEMINI_API_KEY=your_api_key_here
```

**3â£ Make sure `.env` is ignored in Git:**
```bash
echo ".env" >> .gitignore
```

*Note:* If you're using the new LangChain client, you can also name the key `GOOGLE_API_KEY`.

## Tools

## Available Tools

1.  Connects to an MCP server (Python or Node.js) (Connects to either Python or Node.js MCP servers).
2.  Sends queries to Google Gemini AI (Sends user queries to Google's Gemini AI).
3.  Lets Gemini call external tools from the MCP server (Enables Gemini to utilize external tools available on the MCP server).
4.  Executes MCP tool commands and returns the results (Executes commands from MCP tools and provides the output).
5.  Maintains conversation history (Gemini remembers past queries for context-aware interactions).
