README.md•2.22 kB
# Google Drive MCP Server
A Model Context Protocol (MCP) server that provides AI agents with efficient access to Google Drive documents. The server downloads files locally, converts them to markdown, and offers selective content extraction to optimize context window usage.
## Features
- **Document Processing**: Convert Google Docs, PDFs, and Word documents to markdown
- **Selective Content Extraction**: Extract specific sections, page ranges, or keyword-based content
- **Intelligent Caching**: Local caching with LRU eviction and TTL-based expiration
- **Advanced Search**: Search files by name, type, content, and metadata
- **Permission Management**: Respect Google Drive permissions and sharing settings
- **MCP Protocol Compliance**: Full integration with MCP-compatible AI agents
## Project Structure
```
src/
├── auth/ # Authentication management
├── cache/ # Caching system
├── content/ # Content processing pipeline
├── search/ # Search functionality
├── types/ # TypeScript interfaces and types
└── index.ts # Main server entry point
```
## Installation
```bash
npm install
```
## Configuration
The server requires Google Drive API credentials. Create a `config.json` file or set environment variables:
### Environment Variables
```bash
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://localhost:8080/callback
CACHE_DIR=./cache
CACHE_MAX_SIZE=1GB
CACHE_TTL=3600
LOG_LEVEL=info
MAX_FILE_SIZE=100MB
```
## Development
```bash
# Build the project
npm run build
# Start in development mode
npm run dev
# Type checking
npm run type-check
# Linting
npm run lint
```
## MCP Tools
The server exposes the following MCP tools:
- `drive_search_files`: Search files on Google Drive
- `drive_get_file`: Get file information and content
- `drive_get_content_chunk`: Extract specific content portions
- `drive_get_file_metadata`: Retrieve file metadata and permissions
- `drive_list_folder`: List folder contents
- `drive_get_comments`: Get file comments (if available)
## Requirements
- Node.js >= 18.0.0
- Google Drive API credentials
- TypeScript 5.5+
## License
MIT