@vibepr/mcp 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -2
  3. package/configs/ALL_CLIENTS.md +33 -0
  4. package/dist/auth/oauth.d.ts +22 -0
  5. package/dist/auth/oauth.js +444 -0
  6. package/dist/auth/oauth.js.map +1 -0
  7. package/dist/client/types.d.ts +104 -0
  8. package/dist/client/types.js +2 -0
  9. package/dist/client/types.js.map +1 -0
  10. package/dist/client/vibeprClient.d.ts +143 -0
  11. package/dist/client/vibeprClient.js +220 -0
  12. package/dist/client/vibeprClient.js.map +1 -0
  13. package/dist/clients/registry.d.ts +18 -0
  14. package/dist/clients/registry.js +285 -0
  15. package/dist/clients/registry.js.map +1 -0
  16. package/dist/config.d.ts +16 -0
  17. package/dist/config.js +89 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.js +59 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/prompts/index.d.ts +2 -0
  23. package/dist/prompts/index.js +112 -0
  24. package/dist/prompts/index.js.map +1 -0
  25. package/dist/resources/index.d.ts +3 -0
  26. package/dist/resources/index.js +30 -0
  27. package/dist/resources/index.js.map +1 -0
  28. package/dist/server.d.ts +11 -0
  29. package/dist/server.js +32 -0
  30. package/dist/server.js.map +1 -0
  31. package/dist/tools/account.d.ts +6 -0
  32. package/dist/tools/account.js +48 -0
  33. package/dist/tools/account.js.map +1 -0
  34. package/dist/tools/campaigns.d.ts +5 -0
  35. package/dist/tools/campaigns.js +197 -0
  36. package/dist/tools/campaigns.js.map +1 -0
  37. package/dist/tools/contacts.d.ts +5 -0
  38. package/dist/tools/contacts.js +131 -0
  39. package/dist/tools/contacts.js.map +1 -0
  40. package/dist/tools/groups.d.ts +5 -0
  41. package/dist/tools/groups.js +71 -0
  42. package/dist/tools/groups.js.map +1 -0
  43. package/dist/tools/index.d.ts +7 -0
  44. package/dist/tools/index.js +35 -0
  45. package/dist/tools/index.js.map +1 -0
  46. package/dist/tools/replies.d.ts +5 -0
  47. package/dist/tools/replies.js +65 -0
  48. package/dist/tools/replies.js.map +1 -0
  49. package/dist/tools/smtp.d.ts +3 -0
  50. package/dist/tools/smtp.js +39 -0
  51. package/dist/tools/smtp.js.map +1 -0
  52. package/dist/tools/templates.d.ts +5 -0
  53. package/dist/tools/templates.js +140 -0
  54. package/dist/tools/templates.js.map +1 -0
  55. package/dist/transports/http.d.ts +4 -0
  56. package/dist/transports/http.js +275 -0
  57. package/dist/transports/http.js.map +1 -0
  58. package/dist/transports/stdio.d.ts +2 -0
  59. package/dist/transports/stdio.js +19 -0
  60. package/dist/transports/stdio.js.map +1 -0
  61. package/dist/utils/errors.d.ts +13 -0
  62. package/dist/utils/errors.js +59 -0
  63. package/dist/utils/errors.js.map +1 -0
  64. package/dist/utils/sanitizer.d.ts +12 -0
  65. package/dist/utils/sanitizer.js +54 -0
  66. package/dist/utils/sanitizer.js.map +1 -0
  67. package/dist/utils/templateRenderer.d.ts +15 -0
  68. package/dist/utils/templateRenderer.js +50 -0
  69. package/dist/utils/templateRenderer.js.map +1 -0
  70. package/package.json +63 -4
  71. package/skill/SKILL.md +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 VibePR
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,91 @@
1
- # Temporary Holding Version
1
+ # `@vibepr/mcp` — Universal VibePR MCP Server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Connect **every major AI agent** — **Claude, Claude + Claude Cowork, Claude Code, Codex, ChatGPT, Cursor, Grok, Grok Bot, Grok Build, Hermes, OpenClaw, Notion, Warp, Muse, Gemini, Gemini CLI, VS Code, Devin Desktop / Windsurf, Cline, Antigravity, OpenAI Agent Builder, n8n, and any generic MCP URL client** — to your **VibePR** email outreach workspace.
4
+
5
+ ## Features
6
+ - **Dual Transport:**
7
+ - Local `stdio` (`npx -y @vibepr/mcp`)
8
+ - Remote **Streamable HTTP** (`POST /mcp`, MCP 2025-03-26+) at `https://mcp.vibepr.in/mcp`
9
+ - **Universal Auth:** Built-in **OAuth 2.1 + PKCE (S256) + Dynamic Client Registration (RFC 7591)** + RFC 9728/8414 discovery (required by ChatGPT, Claude + Cowork, Notion, Grok), plus **Bearer API Keys (`vpr_live_...`)** and `?api_key=` URL fallback.
10
+ - **Built-in Client Config Generator:** Run `npx @vibepr/mcp clients` or `npx @vibepr/mcp config <client>` (see [configs/ALL_CLIENTS.md](configs/ALL_CLIENTS.md) for all 19+ agents).
11
+ - **Modular Toolsets:** `account`, `analytics`, `contacts`, `groups`, `templates`, `smtp`, `campaigns`, `replies`.
12
+ - **Safety-First Outreach:**
13
+ - `create_campaign_draft` never auto-sends.
14
+ - `start_campaign` defaults to `dryRun: true` (renders sample email & checks missing `{{variables}}`) and requires `dryRun: false, confirmSend: true`.
15
+ - `--read-only` flag hides all write/send tools.
16
+ - Recursive response sanitizer strips any password/secret/token keys before entering LLM context.
17
+ - **8 `vibepr://` Resources** and **5 Pre-Built Outreach Prompts**.
18
+
19
+ ---
20
+
21
+ ## Quick Start
22
+
23
+ ### 1. Build Locally
24
+ ```bash
25
+ npm install
26
+ npm run build
27
+ ```
28
+
29
+ ### 2. Local `stdio` Mode (IDE & Desktop Agents)
30
+ Works with **Antigravity, Cursor, Claude Desktop, Windsurf, VS Code, Cline, Zed**:
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "vibepr": {
35
+ "command": "npx",
36
+ "args": ["-y", "@vibepr/mcp"],
37
+ "env": {
38
+ "VIBEPR_API_KEY": "vpr_live_your_api_key_here",
39
+ "VIBEPR_API_URL": "https://rapi.vibepr.in"
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ #### Read-Only Analytics Mode
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "vibepr-readonly": {
51
+ "command": "npx",
52
+ "args": ["-y", "@vibepr/mcp", "--read-only"],
53
+ "env": {
54
+ "VIBEPR_API_KEY": "vpr_live_your_readonly_key",
55
+ "VIBEPR_API_URL": "https://rapi.vibepr.in"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### 3. Remote `Streamable HTTP` Mode (Cloud Agents, n8n, SDKs)
63
+ Run the HTTP server:
64
+ ```bash
65
+ VIBEPR_API_URL=https://rapi.vibepr.in PORT=8787 npm run start:http
66
+ ```
67
+
68
+ Connect from **Claude Code**:
69
+ ```bash
70
+ claude mcp add --transport http vibepr http://127.0.0.1:8787/mcp \
71
+ --header "Authorization: Bearer vpr_live_your_api_key_here"
72
+ ```
73
+
74
+ Connect from **n8n / LangGraph / OpenAI Agents SDK / Vercel AI SDK**:
75
+ - Endpoint: `POST https://mcp.vibepr.in/mcp` (or `http://127.0.0.1:8787/mcp` locally)
76
+ - Header: `Authorization: Bearer vpr_live_your_api_key_here`
77
+ - Optional Header: `X-VibePR-Read-Only: true`
78
+
79
+ ---
80
+
81
+ ## CLI Options & Environment Variables
82
+
83
+ | Flag | Env Var | Default | Description |
84
+ |---|---|---|---|
85
+ | `--api-url` | `VIBEPR_API_URL` | `https://rapi.vibepr.in` | VibePR backend base URL |
86
+ | `--api-key` | `VIBEPR_API_KEY` | — | Scoped API key (`vpr_live_...`) or JWT |
87
+ | `--read-only` | `VIBEPR_READ_ONLY` | `false` | Expose only read-only tools |
88
+ | `--toolsets` | `VIBEPR_TOOLSETS` | `all` | Comma-separated subset of toolsets |
89
+ | `--http` | `MCP_TRANSPORT=http` | `stdio` | Run Streamable HTTP server instead of stdio |
90
+ | `--port` | `PORT` | `8787` | HTTP server port |
91
+ | `--host` | `HOST` | `127.0.0.1` | HTTP bind host |
@@ -0,0 +1,33 @@
1
+ # VibePR MCP — All Supported Agents & One-Command Configs
2
+
3
+ VibePR MCP supports **dual transport** (`stdio` for local IDEs/CLIs, and **Streamable HTTP `/mcp`** for remote/cloud agents) + **OAuth 2.1 (PKCE + Dynamic Client Registration)** + **Bearer API Keys (`vpr_live_...`)**, making it compatible with every major AI agent platform:
4
+
5
+ | Agent / Client | Transport | Auth Method | CLI Config Command |
6
+ |---|---|---|---|
7
+ | **Claude / Claude Desktop / Claude + Claude Cowork** | Streamable HTTP / `stdio` | OAuth 2.1 or API Key | `npx @vibepr/mcp config claude` |
8
+ | **Claude Code** | Streamable HTTP / `stdio` | OAuth 2.1 or API Key | `npx @vibepr/mcp config claude-code` |
9
+ | **Codex (OpenAI Codex CLI)** | Streamable HTTP / `stdio` | Bearer Env / API Key | `npx @vibepr/mcp config codex` |
10
+ | **ChatGPT** | Streamable HTTP (`/mcp`) | OAuth 2.1 + PKCE + DCR | `npx @vibepr/mcp config chatgpt` |
11
+ | **Cursor** | Streamable HTTP / `stdio` | OAuth 2.1 or Bearer (`cursor://` deeplink) | `npx @vibepr/mcp config cursor` |
12
+ | **Grok / Grok Bot / Grok Build** | Streamable HTTP (`/mcp`) | OAuth 2.1 or Bearer | `npx @vibepr/mcp config grok` |
13
+ | **Hermes** | Streamable HTTP / `stdio` | Bearer or Env | `npx @vibepr/mcp config hermes` |
14
+ | **OpenClaw** | Streamable HTTP / `stdio` + `SKILL.md` | Bearer or Env | `npx @vibepr/mcp config openclaw` |
15
+ | **Notion** | Streamable HTTP (`/mcp`) | OAuth 2.1 + PKCE + DCR | `npx @vibepr/mcp config notion` |
16
+ | **Warp** | `stdio` / Streamable HTTP | API Key Env / Bearer | `npx @vibepr/mcp config warp` |
17
+ | **Muse** | Streamable HTTP (`/mcp`) | OAuth 2.1 or Bearer | `npx @vibepr/mcp config muse` |
18
+ | **Gemini & Gemini CLI** | Streamable HTTP / `stdio` | Bearer or Env | `npx @vibepr/mcp config gemini` |
19
+ | **VS Code (Copilot MCP)** | Streamable HTTP / `stdio` | OAuth 2.1 or Bearer (`vscode:` deeplink) | `npx @vibepr/mcp config vscode` |
20
+ | **Devin Desktop / Windsurf** | Streamable HTTP / `stdio` | Bearer or Env | `npx @vibepr/mcp config windsurf` |
21
+ | **Cline** | Streamable HTTP / `stdio` | Bearer or Env | `npx @vibepr/mcp config cline` |
22
+ | **Antigravity** | Streamable HTTP / `stdio` | OAuth 2.1 or Bearer | `npx @vibepr/mcp config antigravity` |
23
+ | **OpenAI Agent Builder** | Streamable HTTP (`/mcp`) | Bearer or OAuth 2.1 | `npx @vibepr/mcp config agent-builder` |
24
+ | **n8n** | Streamable HTTP (`/mcp`) | Header Auth (`Bearer`) | `npx @vibepr/mcp config n8n` |
25
+ | **Generic MCP URL** | `/mcp` or `?api_key=...` | OAuth 2.1 / Bearer / Query | `npx @vibepr/mcp config mcp-url` |
26
+
27
+ ## Endpoints Summary (When Hosted at `https://mcp.vibepr.in`)
28
+ - **Streamable HTTP:** `https://mcp.vibepr.in/mcp`
29
+ - **OAuth 2.1 Protected Resource Metadata:** `https://mcp.vibepr.in/.well-known/oauth-protected-resource`
30
+ - **OAuth 2.1 Authorization Server Metadata:** `https://mcp.vibepr.in/.well-known/oauth-authorization-server`
31
+ - **Dynamic Client Registration (RFC 7591):** `POST https://mcp.vibepr.in/oauth/register`
32
+
33
+ > **Note on legacy SSE:** the hosted endpoint is serverless, so it serves Streamable HTTP only. Legacy HTTP+SSE (`/sse`) is available when you self-host the server as a long-running process (see `Dockerfile`) — useful for older n8n (<1.88) and Cline builds.
@@ -0,0 +1,22 @@
1
+ import { type Router } from 'express';
2
+ export interface OAuthOptions {
3
+ /** Public base URL of this MCP server, e.g. https://mcp.vibepr.in */
4
+ publicUrl: string;
5
+ /** VibePR backend API URL used to verify user credentials / API keys */
6
+ apiUrl: string;
7
+ /** 32-byte secret (or arbitrary passphrase hashed to 32 bytes) for AES-256-GCM token sealing */
8
+ secret: string;
9
+ /** Optional custom fetch implementation for tests */
10
+ fetchImpl?: typeof fetch;
11
+ }
12
+ export interface DecodedOAuthToken {
13
+ vibeprToken: string;
14
+ scope: string;
15
+ readOnly: boolean;
16
+ clientId: string;
17
+ exp: number;
18
+ }
19
+ export declare function sealToken(payload: DecodedOAuthToken, secret: string): string;
20
+ export declare function unsealToken(token: string, secret: string): DecodedOAuthToken | null;
21
+ export declare function isAllowedRedirectUri(raw: string): boolean;
22
+ export declare function createOAuthRouter(options: OAuthOptions): Router;
@@ -0,0 +1,444 @@
1
+ import crypto from 'node:crypto';
2
+ import express from 'express';
3
+ function deriveKey(secret) {
4
+ return crypto.createHash('sha256').update(secret).digest();
5
+ }
6
+ export function sealToken(payload, secret) {
7
+ const key = deriveKey(secret);
8
+ const iv = crypto.randomBytes(12);
9
+ const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
10
+ const plaintext = Buffer.from(JSON.stringify(payload), 'utf8');
11
+ const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
12
+ const tag = cipher.getAuthTag();
13
+ return `vpr_oauth_${Buffer.concat([iv, tag, encrypted]).toString('base64url')}`;
14
+ }
15
+ export function unsealToken(token, secret) {
16
+ if (!token.startsWith('vpr_oauth_'))
17
+ return null;
18
+ try {
19
+ const raw = Buffer.from(token.slice('vpr_oauth_'.length), 'base64url');
20
+ if (raw.length < 28)
21
+ return null;
22
+ const iv = raw.subarray(0, 12);
23
+ const tag = raw.subarray(12, 28);
24
+ const ciphertext = raw.subarray(28);
25
+ const key = deriveKey(secret);
26
+ const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
27
+ decipher.setAuthTag(tag);
28
+ const decrypted = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
29
+ const parsed = JSON.parse(decrypted.toString('utf8'));
30
+ if (!parsed.exp || parsed.exp < Date.now()) {
31
+ return null;
32
+ }
33
+ return parsed;
34
+ }
35
+ catch {
36
+ return null;
37
+ }
38
+ }
39
+ function verifyPkceS256(codeVerifier, expectedChallenge) {
40
+ const computed = crypto.createHash('sha256').update(codeVerifier).digest('base64url');
41
+ const a = Buffer.from(computed);
42
+ const b = Buffer.from(expectedChallenge);
43
+ return a.length === b.length && crypto.timingSafeEqual(a, b);
44
+ }
45
+ const ALLOWED_CUSTOM_SCHEMES = new Set([
46
+ 'cursor:',
47
+ 'vscode:',
48
+ 'vscode-insiders:',
49
+ 'claude:',
50
+ 'windsurf:',
51
+ 'antigravity:',
52
+ ]);
53
+ export function isAllowedRedirectUri(raw) {
54
+ try {
55
+ const parsed = new URL(raw);
56
+ if (parsed.protocol === 'https:')
57
+ return true;
58
+ if (parsed.protocol === 'http:' &&
59
+ (parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1' || parsed.hostname === '[::1]')) {
60
+ return true;
61
+ }
62
+ if (ALLOWED_CUSTOM_SCHEMES.has(parsed.protocol))
63
+ return true;
64
+ return false;
65
+ }
66
+ catch {
67
+ return false;
68
+ }
69
+ }
70
+ function createCsrfToken(clientId, redirectUri, codeChallenge, secret) {
71
+ const ts = String(Date.now());
72
+ const sig = crypto
73
+ .createHmac('sha256', deriveKey(secret))
74
+ .update(`${clientId}|${redirectUri}|${codeChallenge}|${ts}`)
75
+ .digest('base64url');
76
+ return `${ts}.${sig}`;
77
+ }
78
+ function verifyCsrfToken(token, clientId, redirectUri, codeChallenge, secret) {
79
+ const [ts, sig] = token.split('.');
80
+ if (!ts || !sig)
81
+ return false;
82
+ const ageMs = Date.now() - Number(ts);
83
+ if (!Number.isFinite(ageMs) || ageMs < 0 || ageMs > 15 * 60_000)
84
+ return false;
85
+ const expected = crypto
86
+ .createHmac('sha256', deriveKey(secret))
87
+ .update(`${clientId}|${redirectUri}|${codeChallenge}|${ts}`)
88
+ .digest('base64url');
89
+ const a = Buffer.from(sig);
90
+ const b = Buffer.from(expected);
91
+ return a.length === b.length && crypto.timingSafeEqual(a, b);
92
+ }
93
+ function escapeHtml(input) {
94
+ return input
95
+ .replace(/&/g, '&amp;')
96
+ .replace(/</g, '&lt;')
97
+ .replace(/>/g, '&gt;')
98
+ .replace(/"/g, '&quot;')
99
+ .replace(/'/g, '&#39;');
100
+ }
101
+ function renderAuthorizePage(params) {
102
+ return `<!DOCTYPE html>
103
+ <html lang="en">
104
+ <head>
105
+ <meta charset="utf-8" />
106
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
107
+ <title>Connect VibePR MCP</title>
108
+ <style>
109
+ body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #0b0f19; color: #e5e7eb; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; padding: 16px; }
110
+ .card { background: #111827; border: 1px solid #1f2937; border-radius: 14px; max-width: 440px; width: 100%; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,0.45); }
111
+ h1 { margin: 0 0 8px; font-size: 20px; color: #fff; }
112
+ p { margin: 0 0 18px; font-size: 14px; color: #9ca3af; line-height: 1.5; }
113
+ label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #d1d5db; }
114
+ input[type="text"], input[type="password"], input[type="email"] { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 8px; border: 1px solid #374151; background: #0b0f19; color: #fff; margin-bottom: 14px; font-size: 14px; }
115
+ .divider { text-align: center; font-size: 12px; color: #6b7280; margin: 14px 0; }
116
+ .checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #d1d5db; margin-bottom: 18px; }
117
+ button { width: 100%; padding: 11px 16px; border-radius: 8px; border: none; background: #6366f1; color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; }
118
+ button:hover { background: #4f46e5; }
119
+ .err { background: #7f1d1d; color: #fecaca; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
120
+ .badge { display: inline-block; background: #1e1b4b; color: #a5b4fc; border: 1px solid #312e81; padding: 2px 8px; border-radius: 999px; font-size: 12px; margin-bottom: 12px; }
121
+ </style>
122
+ </head>
123
+ <body>
124
+ <div class="card">
125
+ <div class="badge">VibePR MCP Authorization</div>
126
+ <h1>Authorize ${escapeHtml(params.clientName)}</h1>
127
+ <p>Grant <strong>${escapeHtml(params.clientName)}</strong> access to your VibePR workspace via OAuth 2.1. Your SMTP passwords are never exposed.</p>
128
+ ${params.error ? `<div class="err">${escapeHtml(params.error)}</div>` : ''}
129
+ <form method="POST" action="/oauth/authorize">
130
+ <input type="hidden" name="client_id" value="${escapeHtml(params.clientId)}" />
131
+ <input type="hidden" name="redirect_uri" value="${escapeHtml(params.redirectUri)}" />
132
+ <input type="hidden" name="state" value="${escapeHtml(params.state)}" />
133
+ <input type="hidden" name="code_challenge" value="${escapeHtml(params.codeChallenge)}" />
134
+ <input type="hidden" name="code_challenge_method" value="${escapeHtml(params.codeChallengeMethod)}" />
135
+ <input type="hidden" name="scope" value="${escapeHtml(params.scope)}" />
136
+ <input type="hidden" name="csrf_token" value="${escapeHtml(params.csrfToken)}" />
137
+
138
+ <label for="api_key">Option A: VibePR API Key (Recommended)</label>
139
+ <input id="api_key" name="api_key" type="password" placeholder="vpr_live_..." autocomplete="off" />
140
+
141
+ <div class="divider">— OR sign in with VibePR account —</div>
142
+
143
+ <label for="email">Option B: VibePR Email</label>
144
+ <input id="email" name="email" type="email" placeholder="you@company.com" />
145
+
146
+ <label for="password">VibePR Password</label>
147
+ <input id="password" name="password" type="password" placeholder="••••••••" />
148
+
149
+ <label class="checkbox">
150
+ <input type="checkbox" name="read_only" value="true" />
151
+ Read-only mode (disable all write &amp; campaign launch tools)
152
+ </label>
153
+
154
+ <button type="submit">Approve &amp; Connect</button>
155
+ </form>
156
+ </div>
157
+ </body>
158
+ </html>`;
159
+ }
160
+ export function createOAuthRouter(options) {
161
+ const router = express.Router();
162
+ const baseUrl = options.publicUrl.replace(/\/+$/, '');
163
+ const apiUrl = options.apiUrl.replace(/\/+$/, '');
164
+ const fetchFn = options.fetchImpl ?? fetch;
165
+ const clients = new Map();
166
+ const authCodes = new Map();
167
+ const purgeExpiredCodes = () => {
168
+ const now = Date.now();
169
+ for (const [k, v] of authCodes.entries()) {
170
+ if (v.expiresAt < now)
171
+ authCodes.delete(k);
172
+ }
173
+ };
174
+ // Security headers on all OAuth responses
175
+ router.use((_req, res, next) => {
176
+ res.setHeader('Cache-Control', 'no-store');
177
+ res.setHeader('Pragma', 'no-cache');
178
+ res.setHeader('X-Frame-Options', 'DENY');
179
+ res.setHeader('X-Content-Type-Options', 'nosniff');
180
+ res.setHeader('Referrer-Policy', 'no-referrer');
181
+ next();
182
+ });
183
+ // RFC 9728 — OAuth 2.0 Protected Resource Metadata (required by ChatGPT, Claude, Notion, Cursor)
184
+ const protectedResourceMetadata = (_req, res) => {
185
+ res.json({
186
+ resource: `${baseUrl}/mcp`,
187
+ authorization_servers: [baseUrl],
188
+ bearer_methods_supported: ['header'],
189
+ scopes_supported: ['vibepr:read', 'vibepr:write', 'vibepr:send'],
190
+ resource_documentation: 'https://vibepr.in',
191
+ });
192
+ };
193
+ router.get('/.well-known/oauth-protected-resource', protectedResourceMetadata);
194
+ router.get('/.well-known/oauth-protected-resource/mcp', protectedResourceMetadata);
195
+ // RFC 8414 — OAuth 2.0 Authorization Server Metadata
196
+ router.get('/.well-known/oauth-authorization-server', (_req, res) => {
197
+ res.json({
198
+ issuer: baseUrl,
199
+ authorization_endpoint: `${baseUrl}/oauth/authorize`,
200
+ token_endpoint: `${baseUrl}/oauth/token`,
201
+ registration_endpoint: `${baseUrl}/oauth/register`,
202
+ revocation_endpoint: `${baseUrl}/oauth/revoke`,
203
+ response_types_supported: ['code'],
204
+ grant_types_supported: ['authorization_code', 'refresh_token'],
205
+ code_challenge_methods_supported: ['S256'],
206
+ token_endpoint_auth_methods_supported: ['none', 'client_secret_post'],
207
+ scopes_supported: ['vibepr:read', 'vibepr:write', 'vibepr:send'],
208
+ });
209
+ });
210
+ // RFC 7591 — Dynamic Client Registration (used by Claude, ChatGPT, Notion, Cursor, VS Code, Grok)
211
+ router.post('/oauth/register', (req, res) => {
212
+ const body = (req.body ?? {});
213
+ const redirectUris = Array.isArray(body.redirect_uris) ? body.redirect_uris : [];
214
+ if (redirectUris.length === 0 || !redirectUris.every((u) => typeof u === 'string' && isAllowedRedirectUri(u))) {
215
+ res.status(400).json({
216
+ error: 'invalid_redirect_uri',
217
+ error_description: 'redirect_uris must be a non-empty array of valid https://, localhost, or supported desktop app URIs',
218
+ });
219
+ return;
220
+ }
221
+ if (clients.size >= 10_000) {
222
+ const oldestKey = clients.keys().next().value;
223
+ if (oldestKey)
224
+ clients.delete(oldestKey);
225
+ }
226
+ const clientId = `vpr_client_${crypto.randomBytes(12).toString('hex')}`;
227
+ const record = {
228
+ client_id: clientId,
229
+ client_name: body.client_name?.trim() || 'AI Agent Client',
230
+ redirect_uris: redirectUris,
231
+ grant_types: body.grant_types ?? ['authorization_code', 'refresh_token'],
232
+ response_types: body.response_types ?? ['code'],
233
+ token_endpoint_auth_method: body.token_endpoint_auth_method ?? 'none',
234
+ created_at: Math.floor(Date.now() / 1000),
235
+ };
236
+ clients.set(clientId, record);
237
+ res.status(201).json({
238
+ client_id: record.client_id,
239
+ client_id_issued_at: record.created_at,
240
+ client_name: record.client_name,
241
+ redirect_uris: record.redirect_uris,
242
+ grant_types: record.grant_types,
243
+ response_types: record.response_types,
244
+ token_endpoint_auth_method: record.token_endpoint_auth_method,
245
+ });
246
+ });
247
+ // Authorization consent page
248
+ router.get('/oauth/authorize', (req, res) => {
249
+ const clientId = String(req.query.client_id ?? '');
250
+ const redirectUri = String(req.query.redirect_uri ?? '');
251
+ const state = String(req.query.state ?? '');
252
+ const codeChallenge = String(req.query.code_challenge ?? '');
253
+ const codeChallengeMethod = String(req.query.code_challenge_method ?? 'S256');
254
+ const scope = String(req.query.scope ?? 'vibepr:read vibepr:write');
255
+ if (!clientId || !redirectUri || !codeChallenge || codeChallengeMethod !== 'S256') {
256
+ res.status(400).send('Invalid OAuth authorization request. PKCE S256 is required.');
257
+ return;
258
+ }
259
+ const registered = clients.get(clientId);
260
+ if (!registered || !registered.redirect_uris.includes(redirectUri)) {
261
+ res.status(400).send('Unknown client_id or unregistered redirect_uri.');
262
+ return;
263
+ }
264
+ const csrfToken = createCsrfToken(clientId, redirectUri, codeChallenge, options.secret);
265
+ res.setHeader('Content-Security-Policy', "default-src 'none'; style-src 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'");
266
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
267
+ res.send(renderAuthorizePage({
268
+ clientName: registered.client_name,
269
+ clientId,
270
+ redirectUri,
271
+ state,
272
+ codeChallenge,
273
+ codeChallengeMethod,
274
+ scope,
275
+ csrfToken,
276
+ }));
277
+ });
278
+ // Authorization form submission
279
+ router.post('/oauth/authorize', express.urlencoded({ extended: false }), async (req, res) => {
280
+ const body = (req.body ?? {});
281
+ const clientId = body.client_id ?? '';
282
+ const redirectUri = body.redirect_uri ?? '';
283
+ const state = body.state ?? '';
284
+ const codeChallenge = body.code_challenge ?? '';
285
+ const codeChallengeMethod = body.code_challenge_method ?? 'S256';
286
+ const scope = body.scope ?? 'vibepr:read vibepr:write';
287
+ const readOnly = body.read_only === 'true';
288
+ const registered = clients.get(clientId);
289
+ if (!registered || !registered.redirect_uris.includes(redirectUri)) {
290
+ res.status(400).send('Unknown client_id or unregistered redirect_uri.');
291
+ return;
292
+ }
293
+ const freshCsrf = createCsrfToken(clientId, redirectUri, codeChallenge, options.secret);
294
+ const renderError = (error) => {
295
+ res.setHeader('Content-Security-Policy', "default-src 'none'; style-src 'unsafe-inline'; form-action 'self'; frame-ancestors 'none'");
296
+ res.status(400).setHeader('Content-Type', 'text/html; charset=utf-8');
297
+ res.send(renderAuthorizePage({
298
+ clientName: registered.client_name,
299
+ clientId,
300
+ redirectUri,
301
+ state,
302
+ codeChallenge,
303
+ codeChallengeMethod,
304
+ scope,
305
+ csrfToken: freshCsrf,
306
+ error,
307
+ }));
308
+ };
309
+ if (!clientId || !redirectUri || !codeChallenge || codeChallengeMethod !== 'S256') {
310
+ renderError('Invalid OAuth parameters.');
311
+ return;
312
+ }
313
+ if (!verifyCsrfToken(body.csrf_token ?? '', clientId, redirectUri, codeChallenge, options.secret)) {
314
+ renderError('Session expired or invalid CSRF token. Please try authorizing again.');
315
+ return;
316
+ }
317
+ let vibeprToken = (body.api_key ?? '').trim();
318
+ try {
319
+ if (vibeprToken) {
320
+ const verifyRes = await fetchFn(`${apiUrl}/api/auth/me`, {
321
+ headers: { Authorization: `Bearer ${vibeprToken}`, Accept: 'application/json' },
322
+ });
323
+ if (!verifyRes.ok) {
324
+ renderError('Invalid or expired VibePR API key.');
325
+ return;
326
+ }
327
+ }
328
+ else if (body.email && body.password) {
329
+ const loginRes = await fetchFn(`${apiUrl}/api/auth/login`, {
330
+ method: 'POST',
331
+ headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
332
+ body: JSON.stringify({ email: body.email.trim(), password: body.password }),
333
+ });
334
+ if (!loginRes.ok) {
335
+ renderError('Invalid VibePR email or password.');
336
+ return;
337
+ }
338
+ const loginData = (await loginRes.json());
339
+ vibeprToken = loginData.token ?? loginData.accessToken ?? '';
340
+ if (!vibeprToken) {
341
+ renderError('VibePR login did not return an access token.');
342
+ return;
343
+ }
344
+ }
345
+ else {
346
+ renderError('Please provide either a VibePR API Key or your VibePR email and password.');
347
+ return;
348
+ }
349
+ }
350
+ catch {
351
+ renderError('Could not reach VibePR backend to verify credentials.');
352
+ return;
353
+ }
354
+ purgeExpiredCodes();
355
+ const code = crypto.randomBytes(24).toString('base64url');
356
+ authCodes.set(code, {
357
+ code,
358
+ clientId,
359
+ redirectUri,
360
+ codeChallenge,
361
+ codeChallengeMethod: 'S256',
362
+ scope,
363
+ vibeprToken,
364
+ readOnly,
365
+ expiresAt: Date.now() + 5 * 60_000,
366
+ });
367
+ const target = new URL(redirectUri);
368
+ target.searchParams.set('code', code);
369
+ if (state)
370
+ target.searchParams.set('state', state);
371
+ res.redirect(302, target.toString());
372
+ });
373
+ // Token exchange (authorization_code + refresh_token)
374
+ router.post('/oauth/token', express.urlencoded({ extended: false }), (req, res) => {
375
+ const body = (req.body ?? {});
376
+ const grantType = body.grant_type;
377
+ if (grantType === 'authorization_code') {
378
+ const code = body.code ?? '';
379
+ const codeVerifier = body.code_verifier ?? '';
380
+ const redirectUri = body.redirect_uri ?? '';
381
+ const record = authCodes.get(code);
382
+ authCodes.delete(code);
383
+ if (!record || record.expiresAt < Date.now()) {
384
+ res.status(400).json({ error: 'invalid_grant', error_description: 'Invalid or expired code' });
385
+ return;
386
+ }
387
+ if (redirectUri && record.redirectUri !== redirectUri) {
388
+ res.status(400).json({ error: 'invalid_grant', error_description: 'redirect_uri mismatch' });
389
+ return;
390
+ }
391
+ if (!codeVerifier || !verifyPkceS256(codeVerifier, record.codeChallenge)) {
392
+ res.status(400).json({ error: 'invalid_grant', error_description: 'PKCE verification failed' });
393
+ return;
394
+ }
395
+ const accessExpiresIn = 3600; // 1 hour
396
+ const refreshExpiresIn = 30 * 24 * 3600; // 30 days
397
+ const accessToken = sealToken({
398
+ vibeprToken: record.vibeprToken,
399
+ scope: record.scope,
400
+ readOnly: record.readOnly,
401
+ clientId: record.clientId,
402
+ exp: Date.now() + accessExpiresIn * 1000,
403
+ }, options.secret);
404
+ const refreshToken = sealToken({
405
+ vibeprToken: record.vibeprToken,
406
+ scope: record.scope,
407
+ readOnly: record.readOnly,
408
+ clientId: record.clientId,
409
+ exp: Date.now() + refreshExpiresIn * 1000,
410
+ }, options.secret);
411
+ res.json({
412
+ access_token: accessToken,
413
+ token_type: 'Bearer',
414
+ expires_in: accessExpiresIn,
415
+ refresh_token: refreshToken,
416
+ scope: record.scope,
417
+ });
418
+ return;
419
+ }
420
+ if (grantType === 'refresh_token') {
421
+ const decoded = unsealToken(body.refresh_token ?? '', options.secret);
422
+ if (!decoded) {
423
+ res.status(400).json({ error: 'invalid_grant', error_description: 'Invalid or expired refresh_token' });
424
+ return;
425
+ }
426
+ const accessExpiresIn = 3600;
427
+ const accessToken = sealToken({ ...decoded, exp: Date.now() + accessExpiresIn * 1000 }, options.secret);
428
+ res.json({
429
+ access_token: accessToken,
430
+ token_type: 'Bearer',
431
+ expires_in: accessExpiresIn,
432
+ refresh_token: body.refresh_token,
433
+ scope: decoded.scope,
434
+ });
435
+ return;
436
+ }
437
+ res.status(400).json({ error: 'unsupported_grant_type' });
438
+ });
439
+ router.post('/oauth/revoke', (_req, res) => {
440
+ res.status(200).json({ revoked: true });
441
+ });
442
+ return router;
443
+ }
444
+ //# sourceMappingURL=oauth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/auth/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,OAAwB,MAAM,SAAS,CAAC;AA2C/C,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAA0B,EAAE,MAAc;IAClE,MAAM,GAAG,GAAG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