Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit90b42ea

Browse files
committed
Initial Commit
1 parent222fef7 commit90b42ea

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

‎LICENSE‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This project is licensed under the GNU General Public License v3.0.
2+
3+
You can find the full text of the license at: https://www.gnu.org/licenses/gpl-3.0.html
4+
5+
ADDITIONAL DISCLAIMER:
6+
7+
THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8+
9+
BY USING THIS SOFTWARE, YOU AGREE THAT YOU ASSUME ALL RISKS ASSOCIATED WITH ITS USE. YOU ALSO AGREE THAT UNDER NO CIRCUMSTANCES WILL YOU ATTEMPT TO HOLD THE AUTHORS LIABLE FOR ANY OUTCOME RELATED TO THE USE OF THIS SOFTWARE.

‎README.md‎

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#🚀 MCP Client with Gemini AI
2+
3+
[![Tutorial video](https://img.youtube.com/vi/GAPncIfnDwg/maxresdefault.jpg)](https://youtu.be/GAPncIfnDwg)
4+
5+
[📢 Subscribe to The AI Language!](https://youtube.com/@theailanguage?sub_confirmation=1)
6+
7+
Before we begin, if you enjoy learning about AI, coding, and automation, please**like this video and subscribe** to the channel. It really helps us bring more tutorials your way! Now, let’s get started!
8+
9+
---
10+
11+
##📌**Features**
12+
✅ Connects to an MCP server (Python or Node.js)
13+
✅ Sends queries to**Google Gemini AI**
14+
✅ Lets**Gemini call external tools** from the MCP server
15+
✅ Executes MCP tool commands and**returns the results**
16+
**Maintains conversation history**, so Gemini**remembers past queries**
17+
18+
---
19+
20+
##📦**Installation**
21+
**1️⃣ Install the required dependencies using`uv` (Universal Virtualenv):**
22+
```bash
23+
uv add mcp python-dotenv google-genai
24+
```
25+
26+
**2️⃣ Clone this repository:**
27+
```bash
28+
git clone https://github.com/your-username/mcp-client-gemini.git
29+
cd mcp-client-gemini
30+
```
31+
32+
**3️⃣ Set up the project and virtual environment:**
33+
```bash
34+
uv init mcp-client
35+
cd mcp-client
36+
uv venv
37+
```
38+
39+
**4️⃣ Activate the virtual environment:**
40+
```bash
41+
# On Windows:
42+
.venv\Scripts\activate
43+
44+
# On MacOS/Linux:
45+
source .venv/bin/activate
46+
```
47+
48+
---
49+
50+
##🔑**Setting Up the API Key**
51+
To use**Google Gemini AI**, you need an**API key**.
52+
53+
**1️⃣ Create a`.env` file:**
54+
```bash
55+
touch .env
56+
```
57+
58+
**2️⃣ Add your API key inside`.env`:**
59+
```
60+
GEMINI_API_KEY=your_api_key_here
61+
```
62+
63+
**3️⃣ Make sure`.env` is ignored in Git:**
64+
```bash
65+
echo".env">> .gitignore
66+
```
67+
68+
---
69+
70+
##🚀**Running the MCP Client**
71+
**Start the MCP client and connect it to an MCP server:**
72+
```bash
73+
uv run client.py path/to/server.py# Use a Python server
74+
uv run client.py path/to/server.js# Use a Node.js server
75+
```
76+
77+
Example (if using a**weather server**):
78+
```bash
79+
uv run client.py ./server/weather.py
80+
```
81+
82+
---
83+
84+
##🔧**How It Works**
85+
1️⃣ The user enters a query (e.g.,`"Create a file named test.txt"`).
86+
2️⃣ The MCP client sends the query to**Gemini AI**.
87+
3️⃣**Gemini AI checks available MCP tools** and calls the correct one.
88+
4️⃣ The MCP client**executes the command** and returns the result.
89+
5️⃣ Gemini**remembers past interactions** and adjusts responses accordingly.
90+
91+
---
92+
93+
##📁**Project Structure**
94+
```
95+
mcp-client-gemini/
96+
│── client.py # MCP Client (Main script)
97+
│── .env # Stores API Key (ignored in Git)
98+
│── README.md # Documentation
99+
│── requirements.txt # Dependencies (optional)
100+
│── server/ # Folder for MCP server scripts (e.g., weather.py)
101+
│── .gitignore # Ignores sensitive files
102+
│── LICENSE # License file
103+
```
104+
105+
---
106+
107+
##🎯**Contributing**
108+
Feel free to submit issues or contribute improvements via pull requests.
109+
110+
---
111+
112+
##📄**License**
113+
This project is licensed under the**MIT License**.
114+
115+
---

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp