A SerpApi-powered MCP server for web search capabilities using FastMCP
Project description
🔍 Gemini LLM-powered MCP Client integrated with Web Search Remote MCP Server
A local web search system that combines Google's Gemini LLM with a FastMCP tool-calling interface and a Streamlit UI. Uses SerpApi for live, real-time search results via a custom MCP server to show Remote MCP Server capabilities with Gemini LLM.
Features
- ✅ Google's Gemini API integration with Remote FastMCP Server
- ✅ Tool calling using FastMCP based Remote MCP Server
- ✅ Custom MCP Server with live web search via SerpApi
MCP Official Doc
Installation
-
Clone the repository:
git clone https://github.com/genieincodebottle/generative-ai.git cd genai-usecases\mcp\web_search_mcp
-
Open the Project in VS Code or any code editor.
-
Create a virtual environment:
pip install uv #if uv not installed uv venv .venv\Scripts\activate # On Linux -> source venv/bin/activate
-
Create a requirements.txt file and add the following libraries:
asyncio>=3.4.3 aiohttp>=3.12.13 python-dotenv>=1.1.0 google-search-results>=2.4.2 fastmcp>=2.8.1 mcp>=1.9.4 streamlit>=1.45.1 requests>=2.32.4 google-genai>=1.20.0 anthropic>=0.54.0 openai>=1.88.0
-
Install dependencies:
uv pip install -r requirements.txt
-
Set up environment variables
- Rename .env.example to .env
- Update the file with your API keys:
GOOGLE_API_KEY=your_key_here # Using the free-tier API SERPAPI_API_KEY=your_serpapi_key # Using free-tier
-
🔑 Get your API keys:
For GOOGLE_API_KEY follow this -> https://aistudio.google.com/app/apikey
For SERPAPI_API_KEY follow this -> https://serpapi.com/manage-api-key
-
Run the MCP Server at one terminal
cd genai-usecases\mcp\web_search_mcp .venv\Scripts\activate python web_search_mcp_server.py --host localhost --port 8000
-
Run the Streamlit Client App in another terminal (Split VSCode terminal or Open window's terminal)
cd genai-usecases\mcp\web_search_mcp .venv\Scripts\activate streamlit run gemini_mcp_client.py
-
Once started, go to:
Use the sidebar to view Gemini API status, adjust model/temperature, and run queries with real-time web search using SerpApi.
⚙️ How It Works
- The Remote MCP server exposes tools (like web_search) via FastMCP over Streamable HTTP.
- The Streamlit app uses Gemini's function calling to request results from the Remote Web Saerch MCP server.
- Gemini combines LLM reasoning with live data via SerpApi using tool calling.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iflow_mcp_genieincodebottle_web_search_mcp-2025.2.7.0.tar.gz.
File metadata
- Download URL: iflow_mcp_genieincodebottle_web_search_mcp-2025.2.7.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afa4f08a8649feeb7280a079dcd4903990fe0789a6b45b6ce85bc6196295ad28
|
|
| MD5 |
6d9a437a78498d06c951b08fc8e76d33
|
|
| BLAKE2b-256 |
e64a822734a9f8d681fe30254de9e8462c63361ef330d12297a8d81cf8dfcdd7
|
File details
Details for the file iflow_mcp_genieincodebottle_web_search_mcp-2025.2.7.0-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_genieincodebottle_web_search_mcp-2025.2.7.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecbcb57a394805ac0266381afb31b7f15faec68a9f3a7315b448121562bd044b
|
|
| MD5 |
754bbeb2d70ea64bb024d39c41f97cde
|
|
| BLAKE2b-256 |
f142e6e9b519cc4da24d2bedbe9332075b30422b6d864d434d62a8b77c16ac4e
|