Model-Context-Protocol
The MCP File System API is a server that allows interaction with a file system using HTTP requests and integrates with the Google Gemini API. It supports various file operations and is designed for efficient file handling and text summarization.
š MCP File System API
š Overview
This project implements an MCP (Model Context Protocol) Server that allows interaction with a file system via HTTP requests. It supports file creation, reading, copying, moving, and deletion using FastAPI. Additionally, it integrates with Google Gemini API to process and summarize file contents.
š Features
ā
Read various file formats (.txt, .csv, .json, .xml, .docx)
ā
Stream large files efficiently
ā
Integrate with Google Gemini API for text summarization
ā
Cloud Run deployment support
š ļø Tech Stack
- Python 3.9+
- FastAPI
- MCP (Model Context Protocol)
- Google Gemini API
- Uvicorn (ASGI Server)
- httpx (Async HTTP requests)
- aiofiles (Async File Handling)
- Docker & Cloud Run
š Getting Started
1ļøā£ Clone the Repository
$ git clone https://github.com/Vijayk-213/Model-Context-Protocol.git
$ cd Model-Context-Protocol
2ļøā£ Set Up a Virtual Environment
$ python3 -m venv venv
$ source venv/bin/activate # On Windows use `venv\Scripts\activate`
3ļøā£ Install Dependencies
$ pip install -r requirements.txt
4ļøā£ Set Environment Variables
Create a .env
file and add your Google Gemini API Key:
MCP_SERVER_URL=http://127.0.0.1:8000
GEMINI_API_KEY=your_gemini_api_key
š Running the Application
Start the MCP Server
$ uvicorn mcp_server:app --host 127.0.0.1 --port 8000 --reload
Run the Main Application
$ python main.py
š API Endpoints
Method | Endpoint | Description |
---|---|---|
GET | /read-text-from-file?file_path=path.txt | Read file contents |
POST | /invoke | Call MCP function |
š ļø Future Enhancements
ā
Implement WebSockets for real-time file updates
ā
Add support for cloud storage (Google Cloud Storage, AWS S3)
ā
Improve error handling & logging
š Contributing
Feel free to open issues or pull requests to improve the project!
š Happy Coding! šÆ