Skip to main content
Glama
huazrickty

Diversion MCP Server

by huazrickty
README.md
# Diversion MCP Server

MCP server untuk connect Claude dengan Diversion version control API.

## Tools Available

| Tool | Description |
|------|-------------|
| `test_auth` | Test API token |
| `list_repos` | List semua repos |
| `get_repo` | Get details sesebuah repo |
| `list_branches` | List branches dalam repo |
| `create_branch` | Buat branch baru |
| `get_branch` | Get details sesebuah branch |
| `list_commits` | List commits |
| `get_commit` | Get details sesebuah commit |
| `list_workspaces` | List workspaces |
| `workspace_status` | Check workspace status (modified files) |
| `get_file_tree` | Get file tree sesebuah repo |
| `get_file_history` | Get commit history untuk file tertentu |
| `list_reviews` | List reviews/PRs |
| `list_collaborators` | List collaborators |

---

## Deploy ke Railway (Paling Mudah)

### 1. Push ke GitHub dulu
```bash
git init
git add .
git commit -m "init diversion mcp server"
gh repo create diversion-mcp --public --push
```

### 2. Deploy kat Railway
1. Pergi https://railway.app
2. New Project → Deploy from GitHub repo
3. Pilih repo `diversion-mcp`
4. Add environment variable:
   - `DIVERSION_API_KEY` = (API key kau, optional — boleh pass per-request)
5. Railway auto-detect Node.js dan build sendiri
6. Copy URL yang Railway bagi (format: `https://xxx.railway.app`)

### 3. Tambah dalam Claude
1. Pergi **Settings → Connectors → Add custom connector**
2. URL: `https://xxx.railway.app/mcp`
3. Dalam Advanced Settings, letak Authorization header:
   - Key: `Authorization`
   - Value: `Bearer <DIVERSION_API_KEY_KAU>`
4. Save ✅

---

## Deploy ke Render (Free Tier Available)

1. Push ke GitHub
2. Pergi https://render.com → New Web Service
3. Connect GitHub repo
4. Settings:
   - **Build Command:** `npm install && npm run build`
   - **Start Command:** `npm start`
   - **Environment:** `DIVERSION_API_KEY=<token_kau>`
5. Copy URL → tambah `/mcp` → letak dalam Claude connectors

---

## Run Locally (Testing)

```bash
npm install
npm run dev
```

Server akan run kat `http://localhost:3000/mcp`

Untuk test, gunakan [MCP Inspector](https://inspector.tools) atau curl:

```bash
curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <DIVERSION_API_KEY>" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
```

---

## Authentication

Server support dua cara auth:

1. **Per-request** — Pass `Authorization: Bearer <token>` dalam setiap request (recommended, lebih secure)
2. **Environment variable** — Set `DIVERSION_API_KEY` dan server akan guna tu kalau header tak ada