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 integration- Example:
export GEMINI_API_KEY="your-api-key-here"
- Example:
Optional
SCAN_DIRECTORY
: Directory path to scan for tools during startup- Example:
export SCAN_DIRECTORY="/path/to/your/tools"
- Example:
Installation
- Install Poetry (if not already installed):
- Install dependencies:
- Set environment variables:
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 directory - Can 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.