This script provides a base for connecting to a FastMCP server and leveraging the Google Gemini API to automate actions on connected applications. It allows sending commands, reading real-time status, and managing application modules.
The project is structured to be compatible with GitHub Copilot and code suggestion tools like Roo Code.
- Python 3.7+
- pip (Python package installer)
- A Google Gemini API Key
- Access to a FastMCP server (with its URL and any necessary authentication tokens)
- Go to Google AI Studio (or the relevant Google Cloud Console page for Gemini API).
- Sign in with your Google account.
- Create a new API key.
- Important: Copy this key and keep it secure. You will need it for the
.envfile.
-
Clone the repository (if applicable) or download the files:
# If it's a git repository git clone <repository-url> cd <repository-directory> # If you downloaded files, navigate to the main project directory (e.g., fastmcp_controller) cd fastmcp_controller
-
Create a virtual environment (recommended):
python -m venv venv
Activate it:
- Windows:
.\venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
-
Set up the environment file:
- Rename
.env.exampleto.env.# In the fastmcp_controller directory cp .env.example .env - Open the
.envfile and fill in your details:GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE" FASTMCP_SERVER_URL="YOUR_FASTMCP_SERVER_URL_HERE" # e.g., ws://localhost:8080 or http://localhost:8080/api FASTMCP_AUTH_TOKEN="YOUR_FASTMCP_AUTH_TOKEN_HERE" # Optional, if your server requires it
- Rename
- Ensure your virtual environment is activated and your
.envfile is correctly configured. - Navigate to the
fastmcp_controllerdirectory if you are not already there. - Run the main script:
python main.py
- Follow the on-screen prompts or interact with the application as designed.
main.py: Main script to initialize connections and orchestrate operations.gemini_client.py: Module for interacting with the Google Gemini API.app_controller.py: Module for managing and interacting with applications via FastMCP.requirements.txt: Lists Python dependencies..env.example: Template for environment variables.README.md: This file.
This project is designed with GitHub Copilot and Roo Code compatibility in mind, featuring:
- Clear, commented code.
- Modular structure.
- Type hinting (to be added progressively).
This is a base script. You will need to implement the specific API calls and logic for your FastMCP server.