@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.
- package/CHANGELOG.md +19 -1
- package/README.md +20 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs/index.d.ts.map +1 -1
- package/dist/jobs/operation-state.d.ts.map +1 -1
- package/dist/jobs/operation-state.js.map +1 -1
- package/dist/jobs/operation-tasks.js.map +1 -1
- package/dist/jobs/operations.js.map +1 -1
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/next/context.js.map +1 -1
- package/dist/next/issue-token.js.map +1 -1
- package/dist/next/pages.js.map +1 -1
- package/dist/options.d.ts +2 -2
- package/dist/options.d.ts.map +1 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/schema.d.ts +14 -14
- package/dist/scripts/registration-scripts.js.map +1 -1
- package/dist/server/action-tool.js.map +1 -1
- package/dist/server/oauth-http.d.ts +1 -1
- package/dist/server/oauth-http.d.ts.map +1 -1
- package/dist/server/oauth-http.js.map +1 -1
- package/dist/server/server-info.d.ts +7 -1
- package/dist/server/server-info.d.ts.map +1 -1
- package/dist/server/server-info.js +9 -7
- package/dist/server/server-info.js.map +1 -1
- package/dist/server/strict-input.js.map +1 -1
- package/dist/server/tool-list.js.map +1 -1
- package/dist/server/tools.js.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/token-manager.d.ts +14 -1
- package/dist/ui/token-manager.d.ts.map +1 -1
- package/dist/ui/token-manager.js +6 -3
- package/dist/ui/token-manager.js.map +1 -1
- package/module.json +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/server/server-info.ts +19 -9
- package/src/ui/index.ts +2 -0
- package/src/ui/token-manager.tsx +56 -33
package/src/ui/token-manager.tsx
CHANGED
|
@@ -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
|
-
|
|
415
|
-
<
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
{
|
|
421
|
-
|
|
422
|
-
<
|
|
423
|
-
<
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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
|
-
|
|
454
|
-
<
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
{
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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>
|