Spaces:
Configuration error
Configuration error
| # MCP Server | |
| This is a Multi-tool Chatbot Platform (MCP) server built with FastAPI, designed to be deployed on Hugging Face Spaces. | |
| ## Features | |
| - **Calculator:** Perform basic arithmetic operations (sum, multiply, subtract, divide). | |
| - **Email Drafter:** Draft emails based on your prompts using Google Gemini LLM. | |
| - **PDF Q&A:** Upload a PDF and ask questions about its content, powered by Google Gemini LLM and Qdrant vector store. | |
| - **Code Inspector:** Check Python code for syntax, logical errors, and best practices using Google Gemini LLM. | |
| ## How to use (Local) | |
| 1. **Clone the repository:** | |
| ```bash | |
| git clone <repository_url> | |
| cd mcp-all | |
| ``` | |
| 2. **Create a virtual environment and activate it:** | |
| ```bash | |
| python -m venv venv | |
| ./venv/Scripts/activate # On Windows | |
| source venv/bin/activate # On macOS/Linux | |
| ``` | |
| 3. **Install dependencies:** | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| 4. **Set up Gemini API Key:** | |
| Obtain a Gemini API key from [Google AI Studio](https://aistudio.google.com/app/apikey). | |
| Set it as an environment variable named `GEMINI_API_KEY`. | |
| On Windows: | |
| ```bash | |
| set GEMINI_API_KEY=YOUR_API_KEY | |
| ``` | |
| On macOS/Linux: | |
| ```bash | |
| export GEMINI_API_KEY=YOUR_API_KEY | |
| ``` | |
| 5. **Run the server:** | |
| ```bash | |
| python app.py | |
| ``` | |
| The server will run on `http://0.0.0.0:7860`. Open your browser and go to `http://localhost:7860` to interact with the UI. | |
| ## How to use (Docker) | |
| 1. **Build the Docker image:** | |
| ```bash | |
| docker build -t mcp-server . | |
| ``` | |
| 2. **Run the Docker container:** | |
| ```bash | |
| docker run -d -p 7860:7860 --env GEMINI_API_KEY=YOUR_API_KEY mcp-server | |
| ``` | |
| Replace `YOUR_API_KEY` with your actual Gemini API key. The server will be accessible at `http://localhost:7860`. | |
| ## How to use (Hugging Face Spaces) | |
| This project is configured for direct deployment on Hugging Face Spaces. Simply create a new Space, select "Docker" as the SDK, and link this repository. Ensure you add your `GEMINI_API_KEY` as a Space Secret in Hugging Face. | |
| Once deployed, you can interact with the MCP server directly from your Hugging Face Space URL. | |
| ## Tool Usage Examples | |
| - **Calculator:** "sum 10 and 5", "multiply 4 by 6", "subtract 20 from 8", "divide 100 by 10" | |
| - **Email Drafter:** "draft an email to John about meeting next week regarding project X." | |
| - **PDF Q&A:** Upload a PDF file and then type your question in the prompt. | |
| - **Code Inspector:** "check code: print('Hello')\n print('World')" | |