metadata
title: MCP Server
emoji: 🤖
colorFrom: blue
colorTo: purple
sdk: docker
app_file: app.py
pinned: false
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)
- Clone the repository:
git clone <repository_url> cd mcp-all - Create a virtual environment and activate it:
python -m venv venv ./venv/Scripts/activate # On Windows source venv/bin/activate # On macOS/Linux - Install dependencies:
pip install -r requirements.txt - Set up Gemini API Key:
Obtain a Gemini API key from Google AI Studio.
Set it as an environment variable named
GEMINI_API_KEY. On Windows:On macOS/Linux:set GEMINI_API_KEY=YOUR_API_KEYexport GEMINI_API_KEY=YOUR_API_KEY - Run the server:
The server will run onpython app.pyhttp://0.0.0.0:7860. Open your browser and go tohttp://localhost:7860to interact with the UI.
How to use (Docker)
- Build the Docker image:
docker build -t mcp-server . - Run the Docker container:
Replacedocker run -d -p 7860:7860 --env GEMINI_API_KEY=YOUR_API_KEY mcp-serverYOUR_API_KEYwith your actual Gemini API key. The server will be accessible athttp://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')"