@vvedantb/server 0.12.0 → 0.13.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.
- package/CHANGELOG.md +15 -0
- package/dist/convex/index.d.ts +1 -1
- package/dist/convex/mcpServerInfo.d.ts +16 -1
- package/dist/convex/mcpServerInfo.js +17 -2
- package/docs/convex.md +8 -1
- package/docs/mcp.md +13 -1
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
Optional `title`, `websiteUrl` and `icons` in MCP `serverInfo` (MCP 2025-11-25 `Implementation`), so MCP clients can show an app's name and icon. Additive; nothing in 0.12.0 changes. `defineMcpServerInfo({ name, version })` returns the same object as before.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `defineMcpServerInfo` takes optional `title`, `websiteUrl` and `icons`. Each is included only when passed; no `undefined` keys. Icons are copied as given, with no `mimeType`, `sizes` or `theme` invented. An icon with an empty `src` throws. `name` and `version` checks are unchanged.
|
|
10
|
+
- Type `McpServerIcon` (`{ src, mimeType?, sizes?, theme? }`, `theme` is `"light"` or `"dark"`). `McpServerInfo` gains the optional fields.
|
|
11
|
+
- `createMcpDispatcher` already returns `serverInfo` as given, so the optional fields reach the initialize result with no dispatcher change.
|
|
12
|
+
|
|
13
|
+
### Tests
|
|
14
|
+
|
|
15
|
+
- `defineMcpServerInfo`: title, websiteUrl and icons included when passed, omitted when not, and empty icon `src` rejected.
|
|
16
|
+
- Dispatcher: an initialize result carries `title`, `websiteUrl` and `icons`.
|
|
17
|
+
|
|
3
18
|
## 0.12.0
|
|
4
19
|
|
|
5
20
|
Shared V Pro checks and Clerk Billing webhook helpers, so apps stop keeping their own copies, with config options so apps whose webhook copies differ from the defaults can adopt them with no change users can see. Additive; nothing in 0.11.0 changes. No new dependency: `@clerk/backend` stays an optional peer and is never imported. (These helpers were first drafted as 0.11.0; 0.11.0 shipped the AI Gateway helpers instead.)
|
package/dist/convex/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { createMemoryOptimisticStore } from "./memoryStore.js";
|
|
|
12
12
|
export { forEachLoadedQuery, mapLoadedQuery, patchLoadedQuery, updateAllCachedQueries, type OptimisticStore, } from "./optimistic.js";
|
|
13
13
|
export { createOriginAllowlistCors, type OriginAllowlistCors, } from "./originAllowlistCors.js";
|
|
14
14
|
export { requiredEnv, requiredEnvUrl, type EnvSource } from "./env.js";
|
|
15
|
-
export { defineMcpServerInfo, type McpServerInfo } from "./mcpServerInfo.js";
|
|
15
|
+
export { defineMcpServerInfo, type McpServerIcon, type McpServerInfo } from "./mcpServerInfo.js";
|
|
16
16
|
export { assertMcpTools, expectMcpToolCount } from "./mcpTestHelpers.js";
|
|
17
17
|
export { tempId, type TempIdFormat, type TempIdOptions } from "./tempId.js";
|
|
18
18
|
export { consoleClerkVerifyLogger, verifyClerkAccessToken, type ClerkAuthLike, type ClerkLike, type ClerkRequestStateLike, type ClerkTokenType, type ClerkVerifyRejection, type VerifiedClerkToken, type VerifyClerkAccessTokenOptions, } from "./verifyClerkAccessToken.js";
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
/** An icon in MCP `serverInfo.icons` (MCP 2025-11-25 `Implementation.icons`). */
|
|
2
|
+
export type McpServerIcon = {
|
|
3
|
+
/** Icon URL, for example an absolute https URL to the app's public icon. */
|
|
4
|
+
src: string;
|
|
5
|
+
mimeType?: string;
|
|
6
|
+
/** For example `["48x48"]` or `["any"]`. */
|
|
7
|
+
sizes?: string[];
|
|
8
|
+
theme?: "light" | "dark";
|
|
9
|
+
};
|
|
1
10
|
export type McpServerInfo = {
|
|
2
11
|
name: string;
|
|
3
12
|
version: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
websiteUrl?: string;
|
|
15
|
+
icons?: McpServerIcon[];
|
|
4
16
|
};
|
|
5
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Build the MCP `serverInfo` object. The caller owns every value. Optional
|
|
19
|
+
* fields appear only when passed, so `{ name, version }` gives exactly that.
|
|
20
|
+
*/
|
|
6
21
|
export declare function defineMcpServerInfo(options: McpServerInfo): McpServerInfo;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Build the MCP `serverInfo` object. The caller owns every value. Optional
|
|
3
|
+
* fields appear only when passed, so `{ name, version }` gives exactly that.
|
|
4
|
+
*/
|
|
2
5
|
export function defineMcpServerInfo(options) {
|
|
3
6
|
if (!options.name)
|
|
4
7
|
throw new Error("MCP server name must not be empty");
|
|
5
8
|
if (!options.version)
|
|
6
9
|
throw new Error("MCP server version must not be empty");
|
|
7
|
-
|
|
10
|
+
const info = { name: options.name, version: options.version };
|
|
11
|
+
if (options.title !== undefined)
|
|
12
|
+
info.title = options.title;
|
|
13
|
+
if (options.websiteUrl !== undefined)
|
|
14
|
+
info.websiteUrl = options.websiteUrl;
|
|
15
|
+
if (options.icons !== undefined) {
|
|
16
|
+
info.icons = options.icons.map((icon, i) => {
|
|
17
|
+
if (!icon.src)
|
|
18
|
+
throw new Error(`MCP server icon ${i} src must not be empty`);
|
|
19
|
+
return { ...icon };
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return info;
|
|
8
23
|
}
|
package/docs/convex.md
CHANGED
|
@@ -38,6 +38,13 @@ if (request.method === "OPTIONS") return corsPreflight();
|
|
|
38
38
|
return jsonWithCors({ error: "Unauthorized" }, { status: 401, extraHeaders: { "WWW-Authenticate": "Bearer" } });
|
|
39
39
|
|
|
40
40
|
const serverInfo = defineMcpServerInfo({ name: "my-mcp", version: "1.0.0" });
|
|
41
|
+
const withIcon = defineMcpServerInfo({
|
|
42
|
+
name: "my-mcp",
|
|
43
|
+
version: "1.0.0",
|
|
44
|
+
title: "My app",
|
|
45
|
+
websiteUrl: "https://my-app.example",
|
|
46
|
+
icons: [{ src: "https://my-app.example/icon.png", mimeType: "image/png", sizes: ["any"] }],
|
|
47
|
+
});
|
|
41
48
|
```
|
|
42
49
|
|
|
43
50
|
```ts
|
|
@@ -56,7 +63,7 @@ expectMcpToolCount(toolNames, 2);
|
|
|
56
63
|
| `extractBearerToken(header)` | Token from an `Authorization` header, or `null`. |
|
|
57
64
|
| `requiredEnv(name, env?)`, `requiredEnvUrl(name, env?)` | Required env value, optionally stripping a trailing slash. |
|
|
58
65
|
| `mcpCorsHeaders`, `corsPreflight`, `jsonWithCors` | CORS for MCP HTTP handlers. Methods `GET,POST,DELETE,OPTIONS`; headers `Authorization,Content-Type`; credentials `false`. |
|
|
59
|
-
| `defineMcpServerInfo({ name, version })` | MCP `serverInfo`. The caller owns
|
|
66
|
+
| `defineMcpServerInfo({ name, version, title?, websiteUrl?, icons? })` | MCP `serverInfo`. The caller owns every value. `name` and `version` must not be empty. Optional fields appear only when passed; each icon is `{ src, mimeType?, sizes?, theme? }` and an empty `src` throws. See [mcp.md](mcp.md). |
|
|
60
67
|
| `expectMcpToolCount`, `assertMcpTools` | Test helpers. They throw plain errors, so they work with any runner. |
|
|
61
68
|
| `jsonResponse(data, status, extraHeaders?)` | `JSON.stringify(data)` with `Content-Type: application/json`; `extraHeaders` spread after it. |
|
|
62
69
|
| `createOriginAllowlistCors(allowedOrigins)` | `{ headers(origin), preflightHeaders(origin) }` for credentialed browser CORS on a fixed origin list. |
|
package/docs/mcp.md
CHANGED
|
@@ -192,6 +192,18 @@ registerMcpRoutes(http, {
|
|
|
192
192
|
|
|
193
193
|
### JSON-RPC dispatcher
|
|
194
194
|
|
|
195
|
+
`defineMcpServerInfo` requires a non-empty `name` and `version`. It also takes optional `title`, `websiteUrl` and `icons` (MCP 2025-11-25 `Implementation`). Each icon is `{ src, mimeType?, sizes?, theme? }`, where `theme` is `"light"` or `"dark"`; an empty `src` throws. Optional fields appear only when passed, so `{ name, version }` alone gives the same object as before. An absolute https URL to the app's public icon is enough for `src`; the package serves no icon files.
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
defineMcpServerInfo({
|
|
199
|
+
name: "my-mcp",
|
|
200
|
+
version: "1.0.0",
|
|
201
|
+
title: "My app",
|
|
202
|
+
websiteUrl: "https://my-app.example",
|
|
203
|
+
icons: [{ src: "https://my-app.example/icon.png", mimeType: "image/png", sizes: ["any"] }],
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
195
207
|
| Export | What it does |
|
|
196
208
|
| --- | --- |
|
|
197
209
|
| `createMcpDispatcher(config)` | `{ handleRpc }` for stateless HTTP: `initialize`, `ping`, `tools/list`, `tools/call`, notifications (202, empty body), batches. Other methods: -32601 "Method not found". |
|
|
@@ -200,7 +212,7 @@ registerMcpRoutes(http, {
|
|
|
200
212
|
| `parseRpcBody(text)` | Parse a body, or the SDK's 400 -32700 "Parse error: Invalid JSON" result. |
|
|
201
213
|
| `rpcResult`, `rpcError`, `JSON_RPC_ERROR` | Response builders with the SDK's key order. |
|
|
202
214
|
|
|
203
|
-
Config: `serverInfo` (or a function of the scope), `tools`, `protocol` (`versions`, `fallback`; default SDK list, fallback `"2025-11-25"` as the SDK), `capabilities` (default `{ tools: { listChanged: true } }` as `McpServer`), `instructions`, `toJsonSchema`.
|
|
215
|
+
Config: `serverInfo` (or a function of the scope; returned in the initialize result as given), `tools`, `protocol` (`versions`, `fallback`; default SDK list, fallback `"2025-11-25"` as the SDK), `capabilities` (default `{ tools: { listChanged: true } }` as `McpServer`), `instructions`, `toJsonSchema`.
|
|
204
216
|
|
|
205
217
|
### Tools
|
|
206
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared Convex backend helpers, MCP server scaffolding and Node-side MCP OAuth client helpers from one root import: query-limit errors, Clerk auth and token verification, an MCP bearer-token cache, Clerk-user lookups and ensure-user for Convex functions, V Pro plan checks and Clerk Billing webhook helpers, bearer tokens, env, CORS, JSON responses, MCP route registration, a bearer-auth MCP HTTP handler, OAuth metadata, a JSON-RPC dispatcher, explorer tools, WebCrypto primitives, Convex optimistic-update helpers, MCP OAuth client helpers (provider, sign-in, refresh, revocation, loopback redirect server) for desktop apps, a QuickJS code sandbox that bridges script tool calls to host handlers, and a pure artifacts core (Zod contract, state limits and ops, quiz and flashcards pages, a sandboxed document wrapper with CSP and a guest state bridge); and, from the `@vvedantb/server/ai` subpath, Vercel AI Gateway helpers (service tier provider options, cost from provider metadata, error classification).",
|
|
6
6
|
"type": "module",
|
|
@@ -41,12 +41,6 @@
|
|
|
41
41
|
"quickjs-emscripten-core": false,
|
|
42
42
|
"@jitl/quickjs-singlefile-cjs-release-sync": false
|
|
43
43
|
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "tsc -p tsconfig.json",
|
|
46
|
-
"typecheck": "tsc -p tsconfig.test.json",
|
|
47
|
-
"test": "vitest run && node --test tests-node/esm-exports.mjs tests-node/bundle.mjs",
|
|
48
|
-
"prepack": "tsc -p tsconfig.json"
|
|
49
|
-
},
|
|
50
44
|
"peerDependencies": {
|
|
51
45
|
"@ai-sdk/gateway": ">=1",
|
|
52
46
|
"@clerk/backend": ">=1",
|
|
@@ -95,5 +89,10 @@
|
|
|
95
89
|
"vitest": "^3.2.0",
|
|
96
90
|
"zod": "^4.0.0",
|
|
97
91
|
"zod3": "npm:zod@^3.25.76"
|
|
92
|
+
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build": "tsc -p tsconfig.json",
|
|
95
|
+
"typecheck": "tsc -p tsconfig.test.json",
|
|
96
|
+
"test": "vitest run && node --test tests-node/esm-exports.mjs tests-node/bundle.mjs"
|
|
98
97
|
}
|
|
99
|
-
}
|
|
98
|
+
}
|