Skip to main content
Glama
jerryscy

plaud-mcp-dcr-bridge

by jerryscy
README.md
# Plaud MCP DCR Bridge for Gemini Enterprise

Package repository for deploying Plaud Remote Model Context Protocol (MCP) with Dynamic Client Registration (DCR) and OAuth 2.0 proxying on Google Cloud Run and connecting to Gemini Enterprise apps.

## Target GCP Specifications
- **GCP Project**: `{YOUR_GCP_PROJECT_ID}` (Configurable via `GCP_PROJECT_ID` env var)
- **Cloud Run Service**: `plaud-mcp-dcr-bridge` (Region: `us-central1`)

---

## Prerequisites

* **Google Cloud SDK (`gcloud` CLI)** installed and authenticated:
  ```bash
  gcloud auth login
  gcloud config set project <YOUR_PROJECT_ID>
  ```
* **Discovery Engine Service Agent** granted Secret Accessor IAM permissions:
  ```bash
  gcloud projects add-iam-policy-binding <YOUR_PROJECT_ID> \
      --member="serviceAccount:service-<YOUR_PROJECT_NUMBER>@gcp-sa-discoveryengine.iam.gserviceaccount.com" \
      --role="roles/secretmanager.secretAccessor"
  ```

---

## Environment Setup (`.env`)

Copy `.env.example` to `.env` and fill in your GCP Project ID:

```bash
cp .env.example .env
```

`.env` configuration example:
```env
# GCP Configuration
GCP_PROJECT_ID={YOUR_GCP_PROJECT_ID}
GCP_REGION=us-central1
SERVICE_NAME=plaud-mcp-dcr-bridge

# Plaud Remote Endpoints
BASE_URL=https://mcp.plaud.ai
API_URL=https://api.plaud.ai
```

---

## Quick Deployment Command

```bash
chmod +x deploy.sh
./deploy.sh
```

or via `gcloud`:

```bash
gcloud builds submit --tag us-central1-docker.pkg.dev/{YOUR_GCP_PROJECT_ID}/cloud-run-source-deploy/plaud-mcp-dcr-bridge:latest
gcloud run deploy plaud-mcp-dcr-bridge \
  --image us-central1-docker.pkg.dev/{YOUR_GCP_PROJECT_ID}/cloud-run-source-deploy/plaud-mcp-dcr-bridge:latest \
  --region us-central1 \
  --project {YOUR_GCP_PROJECT_ID} \
  --allow-unauthenticated
```

---

## Endpoints Provided

| Endpoint | Method | Description |
| :--- | :--- | :--- |
| `/.well-known/oauth-authorization-server` | GET | OAuth 2.0 Authorization Server Metadata |
| `/.well-known/mcp-configuration` | GET | Remote MCP Server discovery metadata |
| `/register` | POST | Dynamic Client Registration (DCR, RFC 7591) |
| `/authorize` | GET | OAuth 2.0 Authorization Proxy |
| `/token` | POST | OAuth 2.0 Token Proxy |
| `/mcp` | POST / GET | Streamable HTTP MCP Protocol Transport |
| `/health` | GET | Health Check Endpoint |

---

## How to Get / Generate the Client ID

### Option A: Via `curl` Command in Terminal (Instant)

Run this request to retrieve or generate a Client ID and Secret directly:

```bash
curl -X POST https://{YOUR_CLOUD_RUN_SERVICE_URL}/register \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "Gemini Enterprise App",
    "redirect_uris": ["https://vertexaisearch.cloud.google.com/oauth-redirect"]
  }'
```

**JSON Output Example**:
```json
{
  "client_id": "eyJ2...",
  "client_secret": "plaud-dcr-secret",
  "client_name": "Gemini Enterprise App",
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"]
}
```

Copy the `client_id` string (`eyJ2...`) to use in Gemini Enterprise authentication settings.

### Option B: Automatically via Gemini Enterprise DCR
When configuring the Extension in Gemini Enterprise, enter the Registration URL (`https://{YOUR_CLOUD_RUN_SERVICE_URL}/register`). Gemini Enterprise will automatically execute `/register` and populate the Client ID and Secret fields behind the scenes!

---

## Connecting to Gemini Enterprise

1. Open **Google Cloud Console** -> **Gemini Enterprise** (or **Agent Space**).
2. Go to **Connected data stores** -> **+ New data store** -> **Add MCP server** and enter these parameters:

| Setting Field | Value to Enter |
| :--- | :--- |
| **MCP Server URL** | `https://{YOUR_CLOUD_RUN_SERVICE_URL}/mcp` |
| **Authorization URL** | `https://{YOUR_CLOUD_RUN_SERVICE_URL}/authorize` |
| **Token URL** | `https://{YOUR_CLOUD_RUN_SERVICE_URL}/token` |
| **Registration URL (DCR)** | `https://{YOUR_CLOUD_RUN_SERVICE_URL}/register` |
| **Client ID** | `eyJ2...` *(or auto-generated via DCR)* |
| **Client Secret** | `plaud-dcr-secret` *(or auto-generated via DCR)* |
| **Scopes** | `offline_access` |
| **Enable PKCE Support** | **CHECK / ENABLE** ✅ |
| **Use HTTP Basic Authentication** | **UNCHECK / DISABLE** ❌ |

3. After connecting to Connected data stores, click **Actions** and select **Reload custom actions**.