OfficeCLI MCP Serverless for Gemini Spark
by luckyrespec
README.md
# OfficeCLI MCP Serverless for Gemini Spark
Stateless & Serverless Model Context Protocol (MCP) server yang membungkus [OfficeCLI](https://github.com/iOfficeAI/OfficeCLI) untuk membuat dan mengedit dokumen Microsoft Word (`.docx`) langsung melalui instruksi AI di **Gemini Spark Custom App**.
---
## 🚀 Fitur Utama
- **Stateless & Serverless Ready:** Didesain khusus untuk runtime Vercel Functions (`/tmp` scratch space, auto-cleanup).
- **Batch Pipeline Execution:** Menjalankan kumpulan perintah OfficeCLI secara berurutan dalam satu turn request.
- **Base64 Data URL Output:** Menghasilkan file Word langsung dalam format Base64 Data URL tanpa perlu external storage (S3/Blob).
- **Auto Binary Provisioning:** Otomatis mengunduh atau menyiapkan executable `officecli` Linux x86_64 di environment serverless.
---
## 🛠️ Tool MCP yang Tersedia
### `generate_office_document`
Mengeksekusi batch perintah OfficeCLI untuk membuat atau mengubah dokumen `.docx`.
**Parameter Input:**
* `filename` (*string, required*): Nama file output (contoh: `Laporan_Proyek.docx`).
* `commands` (*string[], required*): Daftar perintah OfficeCLI yang dieksekusi berurutan.
```json
[
"create output.docx",
"add output.docx / --type paragraph --prop \"text=Laporan Evaluasi Kuartal 3\"",
"add output.docx / --type table --prop rows=3 --prop cols=3"
]
```
* `initial_file_base64` (*string, optional*): Base64 string dokumen awal jika ingin melakukan edit pada template existing.
---
## 📦 Menghubungkan ke Gemini Spark Custom App
1. **Deploy ke Vercel:**
```bash
pnpm install
vercel deploy --prod
```
2. Salin URL hasil deploy Vercel Anda, misalnya:
`https://officecli-mcp.vercel.app/api/index`
3. **Tambahkan ke Gemini Spark:**
- Buka pengaturan **Gemini Spark Custom App** / **Custom Tools / MCP Servers**.
- Masukkan Server URL: `https://officecli-mcp.vercel.app/api/index` (Transport: SSE / HTTP Remote MCP).
- Simpan dan mulai perintahkan Gemini:
> *"Buatkan saya dokumen Word tentang laporan bisnis lengkap dengan tabel metrik!"*
---
## 💻 Development & Testing Lokal
```bash
# Install dependencies
pnpm install
# Menjalankan unit tests
pnpm test
# Menjalankan MCP server di mode stdio
pnpm dev
```This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues