vaibhavdwivedi27/mcp-server
If you are the rightful owner of mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server built with FastMCP that provides Google search functionality using Google Gemini API.
MCP Server
A Model Context Protocol (MCP) server built with FastMCP that provides Google search functionality using Google Gemini API.
Features
- 🔍 Google Search: Perform Google searches using Google Gemini API
- 🏥 Health Check: Monitor server health status
Installation
- Clone the repository:
git clone https://github.com/vaibhavdwivedi2710/mcp-server.git
cd mcp-server
- Install dependencies:
pip install -r requirements.txt
Configuration
Before running the server, you need to configure your Google API key:
- Create a
.envfile in the root directory of the project - Add your Google API key to the
.envfile:
GOOGLE_API_KEY=your-google-api-key-here
Note: Make sure to add .env to your .gitignore file to keep your API key secure and never commit it to version control.
Usage
Start the MCP server:
python server.py
The server will start on http://0.0.0.0:8000 with the following endpoints:
- SSE Endpoint:
/mcp-server/sse - Message Endpoint:
/mcp-server/message - Health Check:
/health
Available Tools
Google Search
Perform a Google search query using Gemini API.
Tool: google_search(query: str)
This tool uses the Google Gemini API to perform web searches and returns relevant search results based on your query.
Project Structure
mcp-server/
├── server.py # Main MCP server file
├── requirements.txt # Python dependencies
├── .env # Environment variables (create this file)
├── tools/
│ ├── __init__.py
│ └── google_search_tool.py # Google search implementation
└── README.md
Dependencies
mcp>=1.6.0- Model Context Protocol frameworkfastapi- Web frameworkuvicorn- ASGI servergoogle-genai- Google Gemini API clientpython-dotenv- Environment variable management
API Endpoints
Health Check
GET /health
Returns:
{
"status": "MCP Server is Healthy"
}
Development
The server uses FastMCP for building MCP-compatible tools and endpoints. All tools are defined using the @mcp.tool() decorator, and custom routes can be added using @mcp.custom_route().
License
See file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.