Skip to content

Commit cae5891

Browse files
committed
fix(web): correct two brand strings visible to API/MCP clients
Probing the public API surface on claudepot.com surfaced two client-visible brand bugs: 1. /api/v1/me returned a 401 problem-detail JSON whose `detail` field told callers the token format was `shn_pat_<28 chars>`. That's Shannon's Personal Access Token prefix; the rebrand should have switched it. No PATs are minted yet (api_tokens is empty on the fresh Neon DB), so the prefix change is safe. - TOKEN_PREFIX: shn_pat_ → cdp_pat_ (ClauDepot PAT) - TOKEN_FORMAT_RE adjusted to match the new prefix - error message + JSDoc + schema.ts comment updated 2. /api/mcp's `initialize` response carried `serverInfo.name = "sha.com"` — a mangled remnant from an earlier perl substitution that turned a `sha.nnon.ai` snippet into `sha.com` in source. MCP clients that connect (e.g. Claude Desktop with the MCP integration) would see "sha.com" as the server identity. Switched to "claudepot.com". Migration 0012 (api_tokens) keeps `shn_pat_` in its frozen header comment — historical, not user-visible. Routes referencing it via the live constants pick up the new prefix automatically.
1 parent d9add08 commit cae5891

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

web/src/app/api/[transport]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const baseHandler = createMcpHandler(
2626
},
2727
{
2828
serverInfo: {
29-
name: "sha.com",
29+
name: "claudepot.com",
3030
version: "0.1.0",
3131
},
3232
},

web/src/db/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ export const metricsDaily = pgTable("metrics_daily", {
653653

654654
/* ── Public API tokens ──────────────────────────────────────────
655655
* Per-user Personal Access Tokens for the public REST + MCP API.
656-
* Plaintext (`shn_pat_<28 random url-safe-base64 chars>`) is shown
656+
* Plaintext (`cdp_pat_<28 random url-safe-base64 chars>`) is shown
657657
* once at creation; only the SHA-256 hex digest is stored.
658658
*
659659
* Scopes are an open text array, validated in app code (see

web/src/lib/api/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type AuthSuccess = { ok: true; token: ApiToken; user: AuthUser };
3939
export type AuthFailure = { ok: false; problem: Problem };
4040

4141
// Tight upper bound on the bearer value length. Format is
42-
// `shn_pat_<28 base64url>` (36 chars); cap a touch higher to reject
42+
// `cdp_pat_<28 base64url>` (36 chars); cap a touch higher to reject
4343
// pathological inputs before doing any work but still allow future
4444
// prefix changes without code edits.
4545
const MAX_BEARER_LEN = 64;
@@ -53,7 +53,7 @@ export async function authenticate(
5353
return {
5454
ok: false,
5555
problem: unauthorized(
56-
"Missing or malformed Authorization header. Expected: Authorization: Bearer shn_pat_<28 url-safe-base64 chars>",
56+
"Missing or malformed Authorization header. Expected: Authorization: Bearer cdp_pat_<28 url-safe-base64 chars>",
5757
),
5858
};
5959
}

web/src/lib/api/tokens.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Token generation, hashing, and lookup.
33
*
4-
* Plaintext format: `shn_pat_<28 url-safe-base64 chars>` (168 bits of entropy).
4+
* Plaintext format: `cdp_pat_<28 url-safe-base64 chars>` (168 bits of entropy).
55
* Storage: SHA-256 hex digest of the full plaintext. The plaintext leaves
66
* the server exactly once — at creation time — and is never logged.
77
*
@@ -17,16 +17,16 @@ import { eq } from "drizzle-orm";
1717
import { db } from "@/db/client";
1818
import { apiTokens } from "@/db/schema";
1919

20-
const TOKEN_PREFIX = "shn_pat_";
20+
const TOKEN_PREFIX = "cdp_pat_";
2121
const RANDOM_BYTES = 21; // 21 bytes -> 28 base64url chars
22-
const DISPLAY_PREFIX_LEN = 12; // "shn_pat_XXXX"
22+
const DISPLAY_PREFIX_LEN = 12; // "cdp_pat_XXXX"
2323

2424
/**
2525
* Strict format validator: prefix + exactly 28 URL-safe-base64 chars.
2626
* Used by auth.ts to reject oversized / malformed bearer values BEFORE
2727
* paying for a SHA-256 hash and DB query.
2828
*/
29-
export const TOKEN_FORMAT_RE = /^shn_pat_[A-Za-z0-9_-]{28}$/;
29+
export const TOKEN_FORMAT_RE = /^cdp_pat_[A-Za-z0-9_-]{28}$/;
3030

3131
export type ApiToken = typeof apiTokens.$inferSelect;
3232

0 commit comments

Comments
 (0)