|
1 | | -# McpTesting |
| 1 | +# MCPBro - Gemini Chatbot with MCP Tools |
| 2 | + |
| 3 | +This project is a web-based chatbot powered by Google Gemini, utilizing the Model Context Protocol (MCP) to interact with external tools like filesystem access and memory. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +* **Web Interface:** Simple chat interface built with Flask and SocketIO. |
| 8 | +* **Gemini Integration:** Uses the Google Generative AI SDK for chat responses. |
| 9 | +* **MCP Tool Usage:** Connects to MCP servers (filesystem, memory) to provide tools to the Gemini model. |
| 10 | +* **Real-time Communication:** Uses Flask-SocketIO for instant message updates. |
| 11 | +* **Configuration:** Flexible configuration via `config.json` and environment variables. |
| 12 | +* **Dependency Management:** Uses Poetry for managing Python dependencies. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +* Python >= 3.13 |
| 17 | +* [Poetry](https://python-poetry.org/docs/#installation) |
| 18 | +* Node.js and npx (for running MCP servers like `@modelcontextprotocol/server-filesystem` and `@modelcontextprotocol/server-memory`) |
| 19 | +* A Google Gemini API Key |
| 20 | + |
| 21 | +## Setup |
| 22 | + |
| 23 | +1. **Clone the repository:** |
| 24 | + ```bash |
| 25 | + git clone <your-repository-url> |
| 26 | + cd mcpbro |
| 27 | + ``` |
| 28 | + |
| 29 | +2. **Install dependencies:** |
| 30 | + ```bash |
| 31 | + poetry install |
| 32 | + ``` |
| 33 | + This will install all necessary Python packages based on the `poetry.lock` file. |
| 34 | + |
| 35 | +3. **Configure the application:** |
| 36 | + * Copy the sample configuration file: |
| 37 | + ```bash |
| 38 | + cp bot_config/config.json.sample bot_config/config.json |
| 39 | + ``` |
| 40 | + * Edit `bot_config/config.json`: |
| 41 | + * Set `gemini_api_key` to your Google Gemini API key (alternatively, set the `GEMINI_API_KEY` environment variable). |
| 42 | + * Add the absolute paths to the directories you want the filesystem tool to access under `filesystem_target_directories`. |
| 43 | + * Set `enable_memory_server` to `true` if you want to use the memory tool. |
| 44 | + * (Optional) Edit `bot_config/system_instruction.md` to customize the chatbot's behavior and personality. |
| 45 | +
|
| 46 | +## Running the Application |
| 47 | +
|
| 48 | +1. **Start the server:** |
| 49 | + You can use the Poe the Poet task defined in `pyproject.toml`: |
| 50 | + ```bash |
| 51 | + poetry run poe start |
| 52 | + ``` |
| 53 | + Alternatively, run directly: |
| 54 | + ```bash |
| 55 | + poetry run python run.py |
| 56 | + ``` |
| 57 | +
|
| 58 | +2. **Access the application:** |
| 59 | + Open your web browser and navigate to `http://127.0.0.1:5000` (or the host/port specified in the console output). |
| 60 | +
|
| 61 | +## Usage |
| 62 | +
|
| 63 | +* Type your messages into the input box and press Enter or click Send. |
| 64 | +* The chatbot will respond, potentially using the configured MCP tools. |
| 65 | +* Internal steps (like tool usage) will be displayed in the chat interface. |
| 66 | +* Use the `/reset` endpoint (e.g., `http://127.0.0.1:5000/reset`) to clear the chat history. |
| 67 | +* Use the `/debug` endpoint to view server-side debug logs. |
| 68 | +
|
| 69 | +## Key Dependencies |
| 70 | +
|
| 71 | +* Flask |
| 72 | +* Flask-SocketIO |
| 73 | +* Flask-Session |
| 74 | +* gevent |
| 75 | +* google-generativeai |
| 76 | +* mcp |
| 77 | +
|
| 78 | +See `pyproject.toml` for the full list of dependencies. |
0 commit comments