Uses Google Gemini AI to provide intelligent tool discovery and recommendation capabilities, analyzing user queries to suggest the most relevant Python tools from scanned directories
IBHack MCP Server
A Model Context Protocol (MCP) server that provides intelligent tool discovery and recommendation capabilities using Google Gemini AI. The server can scan Python directories for tool classes and recommend the most relevant tools based on user queries.
Features
Tool Discovery: Automatically scans Python directories to discover tool classes
AI-Powered Recommendations: Uses Google Gemini to recommend the most relevant tools based on user queries
HTTP Transport: Runs as an HTTP server for easy integration
Complete Code Generation: Returns full Python code for recommended tools
Environment Variables
The following environment variables need to be set to run the MCP server:
Required
GEMINI_API_KEY
: Your Google AI API key for Gemini integrationExample:
export GEMINI_API_KEY="your-api-key-here"
Optional
SCAN_DIRECTORY
: Directory path to scan for tools during startupExample:
export SCAN_DIRECTORY="/path/to/your/tools"
Installation
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 -Install dependencies:
poetry installSet environment variables:
export GEMINI_API_KEY="your-api-key-here" export SCAN_DIRECTORY="/path/to/your/tools" # Optional
Running the Server
Method 1: Direct Python execution
Method 2: Using Poetry
Method 3: Using the Poetry script
The server will start on http://127.0.0.1:8000/mcp
by default.
Configuration
Server Configuration
The server runs with the following default settings:
Host:
127.0.0.1
Port:
8000
Path:
/mcp
Transport: HTTP
To modify these settings, edit the mcp.run()
call in server.py
:
Tool Discovery
The server looks for Python classes that:
Have methods:
get_name()
,get_description()
, andexecute()
Are located in
.py
files within the specified directoryCan optionally have
get_input_schema()
andget_output_schema()
methods
Available Tools
recommend_tools
Finds the most relevant tools for a given description using Gemini AI.
Parameters:
query_description
(string): Description of what the user wants to dotop_k
(integer, optional): Number of top tools to return (default: 2)
Returns:
Dictionary containing recommended tools with complete Python code
Success status and error information
Tool metadata (name, description, file path, class name)
Example Usage
Using the Client
Direct HTTP Request
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables intelligent discovery and recommendation of Python tools using Google Gemini AI. Automatically scans directories for tool classes and recommends the most relevant tools based on user queries with complete code generation.