MCP Web Search Assistant
Provides a web search tool that uses DuckDuckGo to retrieve live search results for user queries.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Web Search AssistantWhat are the latest developments in quantum computing?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Web Search Assistant with Gemini
A simple MCP-based web search assistant that uses Google Gemini as the Large Language Model (LLM) and a local MCP server to perform web searches through DuckDuckGo.
This project demonstrates how an LLM can interact with external tools using a client-server architecture.
Features
Uses Google Gemini for natural-language understanding and responses.
Uses an MCP-style client/server architecture for tool integration.
Performs web searches using DuckDuckGo.
Uses a local Flask server to handle tool requests.
Runs the MCP server and client separately.
Uses an environment variable to securely provide the Gemini API key.
Related MCP server: web-mcp-server
Architecture
User
|
v
+----------------+
| ask_claude.py |
| Client App |
+----------------+
|
v
+-------------------+
| ClaudeClient |
| Gemini Integration |
+-------------------+
|
v
Gemini API
|
| Tool Call
v
+----------------+
| MCP Server |
| mcp_server.py |
+----------------+
|
v
+----------------+
| DuckDuckGo |
| Web Search |
+----------------+
|
v
Search Results
|
v
Gemini
|
v
Final ResponseRequest Flow
The user enters a question through the client application.
The client sends the question to Google Gemini.
Gemini determines whether external web information is required.
If a web search is required, Gemini requests the
fetch_web_contenttool.The client sends the tool request to the local MCP server.
The MCP server performs the search using DuckDuckGo.
Search results are returned to the client.
Gemini uses the retrieved information to generate the final response.
Project Structure
MCP/
│
├── mcp_integration.py
├── mcp_server.py
├── claude_mcp_client.py
├── ask_claude.py
├── requirements.txt
├── .gitignore
└── README.mdFile Description
File | Description |
| Handles Gemini integration, MCP tool definitions, and web-search functionality. |
| Runs the local Flask-based MCP server and exposes the tool endpoint. |
| Client responsible for communicating with Gemini and the MCP server. |
| Command-line interface used to interact with the assistant. |
| Contains the required Python dependencies. |
| Prevents sensitive and unnecessary files from being committed. |
| Project documentation and setup instructions. |
Note: Some filenames and class names retain the original Claude-based naming from the tutorial, although the project now uses Google Gemini.
Requirements
Before running the project, make sure you have:
Python 3.10 or higher
pip
A Google Gemini API key
An active internet connection
Installation
1. Clone the Repository
git clone <YOUR_GITHUB_REPOSITORY_URL>
cd MCP2. Install Dependencies
pip install -r requirements.txtIf the Google GenAI SDK is not installed:
pip install google-genaiGemini API Key Setup
This project requires a Google Gemini API key.
Set the API key as an environment variable in PowerShell:
$env:GEMINI_API_KEY="YOUR_GEMINI_API_KEY"Verify that the key is available without displaying the actual key:
python -c "import os; print('Gemini key found:', bool(os.environ.get('GEMINI_API_KEY')))"Expected output:
Gemini key found: TrueSecurity: Never add your actual Gemini API key to the source code, README, or GitHub repository.
Running the Project
The application uses two PowerShell terminals.
Terminal 1 — Start the MCP Server
Open the first PowerShell terminal and navigate to the project directory:
cd D:\Projects\MCPSet the Gemini API key:
$env:GEMINI_API_KEY="YOUR_GEMINI_API_KEY"Verify the key:
python -c "import os; print('Gemini key found:', bool(os.environ.get('GEMINI_API_KEY')))"Start the MCP server:
python mcp_server.pyThe server will run on:
http://localhost:5001Keep Terminal 1 running.
Terminal 2 — Start the Client
Open a second PowerShell terminal.
Navigate to the project:
cd D:\Projects\MCPSet the Gemini API key:
$env:GEMINI_API_KEY="YOUR_GEMINI_API_KEY"Verify the key:
python -c "import os; print('Gemini key found:', bool(os.environ.get('GEMINI_API_KEY')))"Start the client:
python ask_claude.pyYou can now enter questions for the assistant.
Example
What is the latest information about Python?Example Workflow
User Question
|
v
ask_claude.py
|
v
ClaudeClient
|
v
Gemini API
|
| Tool required
v
MCP Server
|
v
DuckDuckGo
|
v
Search Results
|
v
Gemini
|
v
Final AnswerMCP Server Endpoints
The MCP server runs locally on port 5001.
Health Check
GET /healthUsed to verify that the MCP server is running.
Tool Call
POST /tool_callUsed by the client to request the web-search tool.
Example request:
{
"name": "fetch_web_content",
"parameters": {
"query": "Python programming language"
}
}Technologies Used
Python — Core programming language
Google Gemini — Large Language Model
Google GenAI SDK — Gemini API integration
Flask — Local MCP server
DuckDuckGo — Web search
Requests — HTTP communication
MCP-style Client/Server Architecture — Tool integration
Security
The Gemini API key is provided through an environment variable rather than being stored directly in the source code.
Recommended .gitignore:
__pycache__/
*.pyc
.env
.venv/
venv/Never commit API keys, passwords, tokens, or other credentials to GitHub.
Troubleshooting
Gemini API Key Not Found
Run:
python -c "import os; print(bool(os.environ.get('GEMINI_API_KEY')))"Expected:
TrueIf it returns False, set the key again:
$env:GEMINI_API_KEY="YOUR_GEMINI_API_KEY"PowerShell environment variables set using
$env:apply only to the current terminal session. If you open a second terminal, set the variable there as well.
MCP Server Not Responding
Make sure the MCP server is running in Terminal 1:
python mcp_server.pyThe server should be available at:
http://localhost:5001Port Already in Use
If port 5001 is already being used, stop the existing server process or configure the application to use another available port.
Future Improvements
Rename the remaining Claude-based filenames and classes to Gemini-based names.
Add additional MCP tools.
Improve conversation history management.
Add more robust error handling and retry mechanisms.
Support additional search providers.
Add a web-based user interface.
Output

License
This project is licensed under the MIT License.
You are free to use, modify, distribute, and reuse this project, subject to the terms of the license.
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE 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 NONINFRINGEMENT. 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.
This server cannot be deployed
Maintenance
Related MCP Connectors
Scrape, crawl and search the web for AI agents via MCP.
Serper MCP — wraps the Serper Google Search API (serper.dev)
Docs: https://docs.keenable.ai/mcp-server Keenable is a free, remote MCP server that gives agents access to the web index. Search the web with ranked results and date/site filters, then fetch any indexed page as clean markdown. Works out of the box with no account or API key.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA lightweight MCP server that enables LLMs to search the web via DuckDuckGo, search GitHub code repositories, and extract clean content from web pages in LLM-friendly formats.8-
- FlicenseNot gradedqualityDmaintenanceMCP server that exposes web_search and web_fetch tools, allowing LLM applications to search the web via DuckDuckGo and fetch page content as cleaned markdown.-
- FlicenseNot gradedqualityDmaintenanceEnables tool-calling LLMs to search the internet, capture website images, extract webpage text, and more via a local MCP server.15-
- FlicenseNot gradedqualityDmaintenanceCustom MCP server exposing an internet_search tool that fetches DuckDuckGo results, enabling AI agents to perform web searches and retrieve structured information.1-