@softure-ai/mcp-access 0.7.0 → 0.7.2

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 (45) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/README.md +20 -2
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/jobs/index.d.ts.map +1 -1
  8. package/dist/jobs/operation-state.d.ts.map +1 -1
  9. package/dist/jobs/operation-state.js.map +1 -1
  10. package/dist/jobs/operation-tasks.js.map +1 -1
  11. package/dist/jobs/operations.js.map +1 -1
  12. package/dist/messages/en.d.ts.map +1 -1
  13. package/dist/next/context.js.map +1 -1
  14. package/dist/next/issue-token.js.map +1 -1
  15. package/dist/next/pages.js.map +1 -1
  16. package/dist/options.d.ts +2 -2
  17. package/dist/options.d.ts.map +1 -1
  18. package/dist/routes.d.ts.map +1 -1
  19. package/dist/schema.d.ts +14 -14
  20. package/dist/scripts/registration-scripts.js.map +1 -1
  21. package/dist/server/action-tool.js.map +1 -1
  22. package/dist/server/oauth-http.d.ts +1 -1
  23. package/dist/server/oauth-http.d.ts.map +1 -1
  24. package/dist/server/oauth-http.js.map +1 -1
  25. package/dist/server/server-info.d.ts +7 -1
  26. package/dist/server/server-info.d.ts.map +1 -1
  27. package/dist/server/server-info.js +9 -7
  28. package/dist/server/server-info.js.map +1 -1
  29. package/dist/server/strict-input.js.map +1 -1
  30. package/dist/server/tool-list.js.map +1 -1
  31. package/dist/server/tools.js.map +1 -1
  32. package/dist/ui/index.d.ts +1 -1
  33. package/dist/ui/index.d.ts.map +1 -1
  34. package/dist/ui/index.js +1 -1
  35. package/dist/ui/index.js.map +1 -1
  36. package/dist/ui/token-manager.d.ts +14 -1
  37. package/dist/ui/token-manager.d.ts.map +1 -1
  38. package/dist/ui/token-manager.js +6 -3
  39. package/dist/ui/token-manager.js.map +1 -1
  40. package/module.json +1 -1
  41. package/package.json +2 -2
  42. package/src/index.ts +1 -1
  43. package/src/server/server-info.ts +19 -9
  44. package/src/ui/index.ts +2 -0
  45. package/src/ui/token-manager.tsx +56 -33
@@ -20,6 +20,15 @@ export type IssueTokenAction = (previous: IssueTokenFormState, formData: FormDat
20
20
  export type RevokeTokenAction = (previous: RevokeTokenFormState, formData: FormData) => Promise<RevokeTokenFormState>;
21
21
  export type RevokeGrantAction = (previous: RevokeGrantFormState, formData: FormData) => Promise<RevokeGrantFormState>;
22
22
 
23
+ /**
24
+ * One part of the token page: the tool catalog, the MCP token form (with the token just issued), the API scopes with
25
+ * their form, the owner's tokens, the apps connected through OAuth.
26
+ */
27
+ export type TokenManagerSection = "tools" | "issue" | "api" | "tokens" | "grants";
28
+
29
+ /** Every section, in the order the page shows them. */
30
+ export const TOKEN_MANAGER_SECTIONS: readonly TokenManagerSection[] = ["tools", "issue", "api", "tokens", "grants"];
31
+
23
32
  export type TokenManagerSlot = "root" | "section" | "heading" | "text" | "list" | "item" | "itemHeader" | "badge" | "details" | "snippet" | "code";
24
33
 
25
34
  /** One tool of the app's catalog, prepared on the server. */
@@ -83,6 +92,12 @@ export interface TokenManagerProps {
83
92
  * for other apps, submitted to `issueAction` with `kind=api`. Leave out, and the page offers MCP tokens only.
84
93
  */
85
94
  readonly apiScopes?: readonly TokenManagerApiScope[];
95
+ /**
96
+ * The sections to show, for an app that lays them out itself (tabs, an accordion): render one `TokenManager` per
97
+ * place with the sections it holds. Leave out for every section. The page keeps its own order whatever the order
98
+ * given here; a section whose data is missing (`api` without `apiScopes`, `grants` without `grants`) stays hidden.
99
+ */
100
+ readonly sections?: readonly TokenManagerSection[];
86
101
  readonly messages: McpAccessMessages;
87
102
  /** Locale of the built-in copy of the ui primitives. */
88
103
  readonly locale?: Locale;
@@ -403,34 +418,40 @@ export function TokenManager({
403
418
  grants,
404
419
  revokeGrantAction,
405
420
  apiScopes,
421
+ sections = TOKEN_MANAGER_SECTIONS,
406
422
  messages,
407
423
  locale,
408
424
  classNames,
409
425
  unstyled,
410
426
  }: TokenManagerProps) {
411
427
  const slot = createSlotClassGetter({ defaults: DEFAULT_CLASSES, classNames, unstyled });
428
+ const isShown = (section: TokenManagerSection) => sections.includes(section);
412
429
  return (
413
430
  <div className={slot("root")}>
414
- <section className={slot("section")}>
415
- <h2 className={slot("heading")}>{messages.tools.title}</h2>
416
- {tools.length === 0 ? (
417
- <p className={slot("text")}>{messages.tools.empty}</p>
418
- ) : (
419
- <ul className={slot("list")}>
420
- {tools.map((tool) => (
421
- <li key={tool.name} className={slot("item")}>
422
- <div className={slot("itemHeader")}>
423
- <code className={slot("heading")}>{tool.name}</code>
424
- <span className={slot("badge")}>{tool.accessText}</span>
425
- </div>
426
- <p className={slot("text")}>{tool.description}</p>
427
- </li>
428
- ))}
429
- </ul>
430
- )}
431
- </section>
432
- <IssueForm action={issueAction} allowWrites={allowWrites} maxTokens={maxTokens} messages={messages} locale={locale} slot={slot} unstyled={unstyled} />
433
- {apiScopes === undefined ? null : (
431
+ {isShown("tools") ? (
432
+ <section className={slot("section")}>
433
+ <h2 className={slot("heading")}>{messages.tools.title}</h2>
434
+ {tools.length === 0 ? (
435
+ <p className={slot("text")}>{messages.tools.empty}</p>
436
+ ) : (
437
+ <ul className={slot("list")}>
438
+ {tools.map((tool) => (
439
+ <li key={tool.name} className={slot("item")}>
440
+ <div className={slot("itemHeader")}>
441
+ <code className={slot("heading")}>{tool.name}</code>
442
+ <span className={slot("badge")}>{tool.accessText}</span>
443
+ </div>
444
+ <p className={slot("text")}>{tool.description}</p>
445
+ </li>
446
+ ))}
447
+ </ul>
448
+ )}
449
+ </section>
450
+ ) : null}
451
+ {isShown("issue") ? (
452
+ <IssueForm action={issueAction} allowWrites={allowWrites} maxTokens={maxTokens} messages={messages} locale={locale} slot={slot} unstyled={unstyled} />
453
+ ) : null}
454
+ {apiScopes === undefined || !isShown("api") ? null : (
434
455
  <>
435
456
  <section className={slot("section")}>
436
457
  <h2 className={slot("heading")}>{messages.apiScopes.title}</h2>
@@ -450,19 +471,21 @@ export function TokenManager({
450
471
  <ApiIssueForm action={issueAction} scopes={apiScopes} maxTokens={maxTokens} messages={messages} locale={locale} slot={slot} unstyled={unstyled} />
451
472
  </>
452
473
  )}
453
- <section className={slot("section")}>
454
- <h2 className={slot("heading")}>{messages.list.title}</h2>
455
- {tokens.length === 0 ? (
456
- <p className={slot("text")}>{messages.list.empty}</p>
457
- ) : (
458
- <ul className={slot("list")}>
459
- {tokens.map((row) => (
460
- <TokenItem key={row.id} row={row} action={revokeAction} messages={messages} slot={slot} unstyled={unstyled} />
461
- ))}
462
- </ul>
463
- )}
464
- </section>
465
- {grants === undefined || revokeGrantAction === undefined ? null : (
474
+ {isShown("tokens") ? (
475
+ <section className={slot("section")}>
476
+ <h2 className={slot("heading")}>{messages.list.title}</h2>
477
+ {tokens.length === 0 ? (
478
+ <p className={slot("text")}>{messages.list.empty}</p>
479
+ ) : (
480
+ <ul className={slot("list")}>
481
+ {tokens.map((row) => (
482
+ <TokenItem key={row.id} row={row} action={revokeAction} messages={messages} slot={slot} unstyled={unstyled} />
483
+ ))}
484
+ </ul>
485
+ )}
486
+ </section>
487
+ ) : null}
488
+ {grants === undefined || revokeGrantAction === undefined || !isShown("grants") ? null : (
466
489
  <section className={slot("section")}>
467
490
  <h2 className={slot("heading")}>{messages.grants.title}</h2>
468
491
  <p className={slot("text")}>{messages.grants.lead}</p>