@bevel-software/platform-core-frontend 0.12.1 → 0.13.1
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/package.json +2 -2
- package/src/modules/library/__tests__/McpServerSection.test.tsx +95 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +31 -0
- package/src/modules/library/__tests__/ToolVarRow.test.tsx +18 -0
- package/src/modules/library/components/tool-page/McpServerSection.tsx +338 -65
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +25 -9
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +8 -0
- package/src/modules/library/services/tools.api.ts +23 -1
- package/src/modules/secrets-vault/components/SecretsPage.tsx +321 -313
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +20 -11
- package/src/modules/secrets-vault/services/secrets.api.ts +2 -0
- package/src/modules/secrets-vault/services/tool-secrets.api.ts +6 -3
|
@@ -14,11 +14,12 @@ import { ToolVarRow } from './ToolVarRow';
|
|
|
14
14
|
* from you on everyone's behalf.
|
|
15
15
|
*
|
|
16
16
|
* The setup banner above the rows exists because `oauth-manual` is the one
|
|
17
|
-
* state the rows CANNOT explain on their own:
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* state the rows CANNOT explain on their own: the remote server wants a sign-in
|
|
18
|
+
* through an app the OWNER registers, so every row underneath is stuck through
|
|
19
|
+
* no fault of the person reading them. The banner names whose move it is — the
|
|
20
|
+
* owner's — and what the move is: declare the sign-in (the server editor on
|
|
21
|
+
* this page for an mcp.json server, the file itself for a `.tool`), then set
|
|
22
|
+
* its client secret. Once declared, only the secret remains and it says so.
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
25
|
export interface ToolConnectionSectionProps {
|
|
@@ -40,6 +41,12 @@ export function ToolConnectionSection({ tool, onChanged, onError }: ToolConnecti
|
|
|
40
41
|
// No oauth variable at all is the un-started case, so it counts as unfinished.
|
|
41
42
|
const setupUnfinished =
|
|
42
43
|
setupKind === 'oauth-manual' && !tool.variables.some((v) => v.oauth && v.adminConfigured);
|
|
44
|
+
// Declared but not yet finished: the client id is in the file, the secret
|
|
45
|
+
// isn't in the vault. Different sentence — "set the secret", not "declare".
|
|
46
|
+
const signInDeclared = tool.variables.some((v) => v.oauth);
|
|
47
|
+
// An mcp.json server is edited in the server section of THIS page; only a
|
|
48
|
+
// `.tool` manual sends the owner to a file.
|
|
49
|
+
const isMcpJsonServer = tool.path.endsWith('/mcp.json');
|
|
43
50
|
|
|
44
51
|
/**
|
|
45
52
|
* The CONFIGURATION this tool is still missing, named.
|
|
@@ -96,13 +103,22 @@ export function ToolConnectionSection({ tool, onChanged, onError }: ToolConnecti
|
|
|
96
103
|
|
|
97
104
|
{setupUnfinished && (
|
|
98
105
|
<Banner tone="wait" role="status" className="mb-2.5">
|
|
99
|
-
{tool.canWrite ? (
|
|
106
|
+
{tool.canWrite && signInDeclared ? (
|
|
107
|
+
<>
|
|
108
|
+
Sign-in setup needed: the sign-in is declared — set its client secret below to
|
|
109
|
+
finish.
|
|
110
|
+
{tool.setup?.reason && <em className="mt-1 block">{tool.setup.reason}</em>}
|
|
111
|
+
</>
|
|
112
|
+
) : tool.canWrite ? (
|
|
100
113
|
<>
|
|
101
114
|
Sign-in setup needed: this server needs users to sign in, but Bevel couldn't set
|
|
102
|
-
that up automatically.
|
|
103
|
-
|
|
115
|
+
that up automatically. Register an OAuth app with the provider, then{' '}
|
|
116
|
+
{isMcpJsonServer
|
|
117
|
+
? 'add a user-scoped variable with an OAuth sign-in under "Edit server" below'
|
|
118
|
+
: 'declare the sign-in on a user-scoped variable in the tool file'}
|
|
119
|
+
, and set its client secret here.
|
|
104
120
|
{tool.setup?.reason && <em className="mt-1 block">{tool.setup.reason}</em>}
|
|
105
|
-
{kbDirName && (
|
|
121
|
+
{kbDirName && !isMcpJsonServer && (
|
|
106
122
|
<Button
|
|
107
123
|
variant="quiet"
|
|
108
124
|
size="tiny"
|
|
@@ -143,7 +143,15 @@ export function ToolVarRow({
|
|
|
143
143
|
|
|
144
144
|
if (variable.authorized && !variable.needsReauth) {
|
|
145
145
|
description = 'Each person sets their own';
|
|
146
|
+
// Connected is not final: a provider can widen what it grants after the
|
|
147
|
+
// fact (HubSpot's MCP tools do, and answer REQUIRES_REAUTHORIZATION
|
|
148
|
+
// until the user consents again), a grant can be revoked provider-side,
|
|
149
|
+
// or the owner can rotate the client. The caller needs a way back into
|
|
150
|
+
// consent that doesn't wait for the scope check to notice.
|
|
146
151
|
meta.push(
|
|
152
|
+
<Button key="reconnect" size="tiny" variant="quiet" disabled={busy} onClick={() => void signIn()}>
|
|
153
|
+
Reconnect
|
|
154
|
+
</Button>,
|
|
147
155
|
<Badge key="chip" tone="ok">
|
|
148
156
|
Connected
|
|
149
157
|
</Badge>,
|
|
@@ -67,6 +67,28 @@ export async function getToolDetail(slug: string): Promise<ToolManualDetail> {
|
|
|
67
67
|
*/
|
|
68
68
|
export type McpTransport = 'streamable-http' | 'sse' | 'stdio';
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* A declared `${VAR}` of an mcp.json server, exactly as plugin.json stores it.
|
|
72
|
+
* `oauth` makes it a sign-in (user-scoped only): the owner's OAuth app's client
|
|
73
|
+
* id, and optionally the provider endpoints — absent, they are discovered from
|
|
74
|
+
* the server's own OAuth metadata. PKCE is on unless `pkce: false`. The client
|
|
75
|
+
* SECRET is never here; it lives in the vault, set on the tool's page.
|
|
76
|
+
*/
|
|
77
|
+
export interface McpServerVariable {
|
|
78
|
+
name: string;
|
|
79
|
+
scope: 'admin' | 'user';
|
|
80
|
+
label?: string;
|
|
81
|
+
oauth?: {
|
|
82
|
+
authorizationUrl?: string;
|
|
83
|
+
tokenUrl?: string;
|
|
84
|
+
clientId: string;
|
|
85
|
+
scopes?: string[];
|
|
86
|
+
authParams?: Record<string, string>;
|
|
87
|
+
pkce?: boolean;
|
|
88
|
+
resource?: string;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
70
92
|
export interface McpServerView {
|
|
71
93
|
name: string;
|
|
72
94
|
transport: McpTransport;
|
|
@@ -77,7 +99,7 @@ export interface McpServerView {
|
|
|
77
99
|
env?: Record<string, string>;
|
|
78
100
|
literalHeaders: Record<string, string>;
|
|
79
101
|
authHeaders: Record<string, string>;
|
|
80
|
-
variables:
|
|
102
|
+
variables: McpServerVariable[];
|
|
81
103
|
description?: string;
|
|
82
104
|
local: boolean;
|
|
83
105
|
canWrite: boolean;
|