Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: MCP Server
|
| 3 |
+
emoji: 🤖
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# MCP Server
|
| 12 |
+
|
| 13 |
+
This is a Multi-tool Chatbot Platform (MCP) server built with FastAPI, designed to be deployed on Hugging Face Spaces.
|
| 14 |
+
|
| 15 |
+
## Features
|
| 16 |
+
|
| 17 |
+
- **Calculator:** Perform basic arithmetic operations (sum, multiply, subtract, divide).
|
| 18 |
+
- **Email Drafter:** Draft emails based on your prompts using Google Gemini LLM.
|
| 19 |
+
- **PDF Q&A:** Upload a PDF and ask questions about its content, powered by Google Gemini LLM and Qdrant vector store.
|
| 20 |
+
- **Code Inspector:** Check Python code for syntax, logical errors, and best practices using Google Gemini LLM.
|
| 21 |
+
|
| 22 |
+
## How to use (Local)
|
| 23 |
+
|
| 24 |
+
1. **Clone the repository:**
|
| 25 |
+
```bash
|
| 26 |
+
git clone <repository_url>
|
| 27 |
+
cd mcp-all
|
| 28 |
+
```
|
| 29 |
+
2. **Create a virtual environment and activate it:**
|
| 30 |
+
```bash
|
| 31 |
+
python -m venv venv
|
| 32 |
+
./venv/Scripts/activate # On Windows
|
| 33 |
+
source venv/bin/activate # On macOS/Linux
|
| 34 |
+
```
|
| 35 |
+
3. **Install dependencies:**
|
| 36 |
+
```bash
|
| 37 |
+
pip install -r requirements.txt
|
| 38 |
+
```
|
| 39 |
+
4. **Set up Gemini API Key:**
|
| 40 |
+
Obtain a Gemini API key from [Google AI Studio](https://aistudio.google.com/app/apikey).
|
| 41 |
+
Set it as an environment variable named `GEMINI_API_KEY`.
|
| 42 |
+
On Windows:
|
| 43 |
+
```bash
|
| 44 |
+
set GEMINI_API_KEY=YOUR_API_KEY
|
| 45 |
+
```
|
| 46 |
+
On macOS/Linux:
|
| 47 |
+
```bash
|
| 48 |
+
export GEMINI_API_KEY=YOUR_API_KEY
|
| 49 |
+
```
|
| 50 |
+
5. **Run the server:**
|
| 51 |
+
```bash
|
| 52 |
+
python app.py
|
| 53 |
+
```
|
| 54 |
+
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.
|
| 55 |
+
|
| 56 |
+
## How to use (Docker)
|
| 57 |
+
|
| 58 |
+
1. **Build the Docker image:**
|
| 59 |
+
```bash
|
| 60 |
+
docker build -t mcp-server .
|
| 61 |
+
```
|
| 62 |
+
2. **Run the Docker container:**
|
| 63 |
+
```bash
|
| 64 |
+
docker run -d -p 7860:7860 --env GEMINI_API_KEY=YOUR_API_KEY mcp-server
|
| 65 |
+
```
|
| 66 |
+
Replace `YOUR_API_KEY` with your actual Gemini API key. The server will be accessible at `http://localhost:7860`.
|
| 67 |
+
|
| 68 |
+
## How to use (Hugging Face Spaces)
|
| 69 |
+
|
| 70 |
+
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.
|
| 71 |
+
|
| 72 |
+
Once deployed, you can interact with the MCP server directly from your Hugging Face Space URL.
|
| 73 |
+
|
| 74 |
+
## Tool Usage Examples
|
| 75 |
+
|
| 76 |
+
- **Calculator:** "sum 10 and 5", "multiply 4 by 6", "subtract 20 from 8", "divide 100 by 10"
|
| 77 |
+
- **Email Drafter:** "draft an email to John about meeting next week regarding project X."
|
| 78 |
+
- **PDF Q&A:** Upload a PDF file and then type your question in the prompt.
|
| 79 |
+
- **Code Inspector:** "check code: print('Hello')\n print('World')"
|