MCP Server with Gemini AI Integration
LocalAbout MCP Server with Gemini AI Integration
This project combines Gemini AI with an MCP server offering math, string-processing, and Keynote tools. It is intended for users who want to perform calculations and simple presentation tasks through natural-language requests; its companion client can start the server and select tools automatically.
Key features
- 01Perform basic and advanced math operations
- 02Convert strings to ASCII values
- 03Draw rectangles and add text in Keynote
- 04Interpret natural-language tasks with Gemini AI
- 05Client can start and connect to the server
Use cases
- 01Calculate factorials or trigonometric values in natural language
- 02Inspect ASCII values for a string
- 03Create a labeled rectangle in Keynote
- 04Break down and execute tasks using Gemini AI
MCP support
The MCP server exposes math, string-processing, and Keynote tools to clients. Its companion Python client uses Gemini AI to interpret natural-language requests and select tools, and can start the server automatically.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Server with Gemini AI Integration
This project implements a Multi-Component Platform (MCP) server with Gemini AI integration, allowing users to perform various mathematical operations and complex tasks through natural language commands.
Features
-
Mathematical Operations
- Basic arithmetic (add, subtract, multiply, divide)
- Advanced math (power, square root, cube root)
- Special functions (factorial, log, trigonometric functions)
- List operations (sum of list, exponential sum)
-
String Processing
- Convert strings to ASCII values
- Process character arrays
-
Keynote Integration
- Open Keynote application
- Draw rectangles with custom dimensions
- Add text to shapes
-
AI-Powered Task Execution
- Natural language processing using Gemini AI
- Iterative problem solving
- Automatic tool selection based on user queries
Prerequisites
- Python 3.8 or higher
- Google Gemini API key
- macOS (for Keynote integration)
Installation
- Clone the repository:
git clone <repository-url>
cd <repository-name>
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.envfile in the project root and add your Gemini API key:
GEMINI_API_KEY=your_api_key_here
Project Structure
mcp_server.py: Contains the MCP server implementation and tool definitionstalk2mcp.py: Client application that interfaces with the MCP server and Gemini AI.env: Configuration file for API keysrequirements.txt: Project dependencies
Usage
You can start the application in two ways:
Option 1: Start Server and Client Separately
- Start the MCP server in one terminal:
python mcp_server.py
- In another terminal, run the client application:
python talk2mcp.py
Option 2: Start Client Only (Recommended)
The client application can automatically start the server if it's not already running. Simply run:
python talk2mcp.py
The client will:
- Check if the server is running
- Start the server if needed
- Establish connection automatically
- Prompt for your query
Using the Application
-
Enter your query when prompted. Examples:
- "Add 5 and 3"
- "Find the ASCII values of characters in INDIA"
- "Start keynote app and draw a rectangle of size 300x400"
- "Calculate the factorial of 5"
-
Type 'exit' to quit the application.
Note: When using Option 2, the server will automatically shut down when you exit the client application.
Available Tools
The system provides the following tools:
-
Mathematical Tools
add(a: int, b: int): Add two numberssubtract(a: int, b: int): Subtract two numbersmultiply(a: int, b: int): Multiply two numbersdivide(a: int, b: int): Divide two numberspower(a: int, b: int): Calculate powersqrt(a: int): Calculate square rootcbrt(a: int): Calculate cube rootfactorial(a: int): Calculate factoriallog(a: int): Calculate logarithmsin(a: int),cos(a: int),tan(a: int): Trigonometric functions
-
String Processing Tools
strings_to_chars_to_int(string: str): Convert string to ASCII valuesint_list_to_exponential_sum(int_list: list): Calculate sum of exponentials
-
Keynote Tools
open_keynote(): Open Keynote applicationdraw_rectangle_in_keynote(shapeWidth: int, shapeHeight: int): Draw rectangleadd_text_to_keynote_shape(text: str): Add text to shape
Demo
Watch a demo of the MCP Server with Gemini AI integration in action:
Click the image above to watch the demo video on YouTube.
Error Handling
The system includes comprehensive error handling:
- Timeout handling for AI responses
- Type conversion validation
- Tool availability checking
- Parameter validation
Debugging
Debug information is printed to the console, including:
- Tool execution details
- Parameter processing
- Result formatting
- Error messages and stack traces
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Google Gemini AI for natural language processing capabilities
- MCP framework for tool management
- Python community for various libraries used in this project
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.
