@theia/ai-mcp 1.73.0-next.7 → 1.73.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/README.md +22 -1
- package/lib/browser/install-mcp-uri-handler.d.ts +6 -0
- package/lib/browser/install-mcp-uri-handler.d.ts.map +1 -1
- package/lib/browser/install-mcp-uri-handler.js +12 -0
- package/lib/browser/install-mcp-uri-handler.js.map +1 -1
- package/lib/browser/install-mcp-uri-handler.spec.js +39 -7
- package/lib/browser/install-mcp-uri-handler.spec.js.map +1 -1
- package/lib/browser/mcp-configuration-widget.d.ts +8 -2
- package/lib/browser/mcp-configuration-widget.d.ts.map +1 -1
- package/lib/browser/mcp-configuration-widget.js +122 -7
- package/lib/browser/mcp-configuration-widget.js.map +1 -1
- package/lib/browser/mcp-configuration-widget.spec.d.ts +2 -0
- package/lib/browser/mcp-configuration-widget.spec.d.ts.map +1 -0
- package/lib/browser/mcp-configuration-widget.spec.js +345 -0
- package/lib/browser/mcp-configuration-widget.spec.js.map +1 -0
- package/lib/browser/mcp-frontend-application-contribution.d.ts +27 -5
- package/lib/browser/mcp-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/mcp-frontend-application-contribution.js +129 -29
- package/lib/browser/mcp-frontend-application-contribution.js.map +1 -1
- package/lib/browser/mcp-frontend-application-contribution.spec.js +376 -16
- package/lib/browser/mcp-frontend-application-contribution.spec.js.map +1 -1
- package/lib/browser/mcp-frontend-module.d.ts.map +1 -1
- package/lib/browser/mcp-frontend-module.js +12 -4
- package/lib/browser/mcp-frontend-module.js.map +1 -1
- package/lib/browser/mcp-frontend-service.d.ts +16 -1
- package/lib/browser/mcp-frontend-service.d.ts.map +1 -1
- package/lib/browser/mcp-frontend-service.js +75 -7
- package/lib/browser/mcp-frontend-service.js.map +1 -1
- package/lib/browser/mcp-frontend-service.spec.d.ts +2 -0
- package/lib/browser/mcp-frontend-service.spec.d.ts.map +1 -0
- package/lib/browser/mcp-frontend-service.spec.js +210 -0
- package/lib/browser/mcp-frontend-service.spec.js.map +1 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.d.ts +15 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.d.ts.map +1 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.js +87 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.js.map +1 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.spec.d.ts +2 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.spec.d.ts.map +1 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.spec.js +155 -0
- package/lib/browser/mcp-oauth-frontend-delegate-client.spec.js.map +1 -0
- package/lib/browser/mcp-server-edit-dialog.d.ts +20 -3
- package/lib/browser/mcp-server-edit-dialog.d.ts.map +1 -1
- package/lib/browser/mcp-server-edit-dialog.js +128 -21
- package/lib/browser/mcp-server-edit-dialog.js.map +1 -1
- package/lib/browser/mcp-server-editor.d.ts +4 -0
- package/lib/browser/mcp-server-editor.d.ts.map +1 -1
- package/lib/browser/mcp-server-editor.js +64 -11
- package/lib/browser/mcp-server-editor.js.map +1 -1
- package/lib/browser/mcp-server-editor.spec.js +199 -0
- package/lib/browser/mcp-server-editor.spec.js.map +1 -1
- package/lib/browser/mcp-server-install-dialog.d.ts +38 -5
- package/lib/browser/mcp-server-install-dialog.d.ts.map +1 -1
- package/lib/browser/mcp-server-install-dialog.js +113 -5
- package/lib/browser/mcp-server-install-dialog.js.map +1 -1
- package/lib/browser/mcp-server-install-dialog.spec.js +17 -1
- package/lib/browser/mcp-server-install-dialog.spec.js.map +1 -1
- package/lib/browser/mcp-server-manager-server-client.d.ts +2 -0
- package/lib/browser/mcp-server-manager-server-client.d.ts.map +1 -1
- package/lib/browser/mcp-server-manager-server-client.js +7 -1
- package/lib/browser/mcp-server-manager-server-client.js.map +1 -1
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +2 -0
- package/lib/common/index.js.map +1 -1
- package/lib/common/mcp-oauth.d.ts +42 -0
- package/lib/common/mcp-oauth.d.ts.map +1 -0
- package/lib/common/mcp-oauth.js +23 -0
- package/lib/common/mcp-oauth.js.map +1 -0
- package/lib/common/mcp-preferences.d.ts.map +1 -1
- package/lib/common/mcp-preferences.js +67 -4
- package/lib/common/mcp-preferences.js.map +1 -1
- package/lib/common/mcp-protocol.d.ts +1 -0
- package/lib/common/mcp-protocol.d.ts.map +1 -1
- package/lib/common/mcp-protocol.js.map +1 -1
- package/lib/common/mcp-server-manager.d.ts +73 -18
- package/lib/common/mcp-server-manager.d.ts.map +1 -1
- package/lib/common/mcp-server-manager.js +5 -4
- package/lib/common/mcp-server-manager.js.map +1 -1
- package/lib/common/{mcp-servers-preference.d.ts → mcp-server-preference-validator.d.ts} +13 -9
- package/lib/common/mcp-server-preference-validator.d.ts.map +1 -0
- package/lib/common/mcp-server-preference-validator.js +196 -0
- package/lib/common/mcp-server-preference-validator.js.map +1 -0
- package/lib/common/mcp-server-preference-validator.spec.d.ts +2 -0
- package/lib/common/mcp-server-preference-validator.spec.d.ts.map +1 -0
- package/lib/common/mcp-server-preference-validator.spec.js +187 -0
- package/lib/common/mcp-server-preference-validator.spec.js.map +1 -0
- package/lib/electron-node/mcp-electron-node-module.d.ts +11 -0
- package/lib/electron-node/mcp-electron-node-module.d.ts.map +1 -0
- package/lib/electron-node/mcp-electron-node-module.js +34 -0
- package/lib/electron-node/mcp-electron-node-module.js.map +1 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.d.ts +38 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.d.ts.map +1 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.js +120 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.js.map +1 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.spec.d.ts +2 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.spec.d.ts.map +1 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.spec.js +126 -0
- package/lib/electron-node/mcp-oauth-loopback-callback-server.spec.js.map +1 -0
- package/lib/node/mcp-backend-module.d.ts.map +1 -1
- package/lib/node/mcp-backend-module.js +23 -0
- package/lib/node/mcp-backend-module.js.map +1 -1
- package/lib/node/mcp-oauth-callback-backend-contribution.d.ts +21 -0
- package/lib/node/mcp-oauth-callback-backend-contribution.d.ts.map +1 -0
- package/lib/node/mcp-oauth-callback-backend-contribution.js +65 -0
- package/lib/node/mcp-oauth-callback-backend-contribution.js.map +1 -0
- package/lib/node/mcp-oauth-callback-backend-contribution.spec.d.ts +2 -0
- package/lib/node/mcp-oauth-callback-backend-contribution.spec.d.ts.map +1 -0
- package/lib/node/mcp-oauth-callback-backend-contribution.spec.js +99 -0
- package/lib/node/mcp-oauth-callback-backend-contribution.spec.js.map +1 -0
- package/lib/node/mcp-oauth-callback-endpoint.d.ts +13 -0
- package/lib/node/mcp-oauth-callback-endpoint.d.ts.map +1 -0
- package/lib/node/mcp-oauth-callback-endpoint.js +20 -0
- package/lib/node/mcp-oauth-callback-endpoint.js.map +1 -0
- package/lib/node/mcp-oauth-callback-responder.d.ts +30 -0
- package/lib/node/mcp-oauth-callback-responder.d.ts.map +1 -0
- package/lib/node/mcp-oauth-callback-responder.js +116 -0
- package/lib/node/mcp-oauth-callback-responder.js.map +1 -0
- package/lib/node/mcp-oauth-callback-responder.spec.d.ts +2 -0
- package/lib/node/mcp-oauth-callback-responder.spec.d.ts.map +1 -0
- package/lib/node/mcp-oauth-callback-responder.spec.js +89 -0
- package/lib/node/mcp-oauth-callback-responder.spec.js.map +1 -0
- package/lib/node/mcp-oauth-callback-service.d.ts +66 -0
- package/lib/node/mcp-oauth-callback-service.d.ts.map +1 -0
- package/lib/node/mcp-oauth-callback-service.js +221 -0
- package/lib/node/mcp-oauth-callback-service.js.map +1 -0
- package/lib/node/mcp-oauth-callback-service.spec.d.ts +2 -0
- package/lib/node/mcp-oauth-callback-service.spec.d.ts.map +1 -0
- package/lib/node/mcp-oauth-callback-service.spec.js +109 -0
- package/lib/node/mcp-oauth-callback-service.spec.js.map +1 -0
- package/lib/node/mcp-oauth-client-provider-factory.d.ts +21 -0
- package/lib/node/mcp-oauth-client-provider-factory.d.ts.map +1 -0
- package/lib/node/mcp-oauth-client-provider-factory.js +80 -0
- package/lib/node/mcp-oauth-client-provider-factory.js.map +1 -0
- package/lib/node/mcp-oauth-client-provider-factory.spec.d.ts +2 -0
- package/lib/node/mcp-oauth-client-provider-factory.spec.d.ts.map +1 -0
- package/lib/node/mcp-oauth-client-provider-factory.spec.js +51 -0
- package/lib/node/mcp-oauth-client-provider-factory.spec.js.map +1 -0
- package/lib/node/mcp-oauth-client-provider.d.ts +79 -0
- package/lib/node/mcp-oauth-client-provider.d.ts.map +1 -0
- package/lib/node/mcp-oauth-client-provider.js +283 -0
- package/lib/node/mcp-oauth-client-provider.js.map +1 -0
- package/lib/node/mcp-oauth-client-provider.spec.d.ts +2 -0
- package/lib/node/mcp-oauth-client-provider.spec.d.ts.map +1 -0
- package/lib/node/mcp-oauth-client-provider.spec.js +485 -0
- package/lib/node/mcp-oauth-client-provider.spec.js.map +1 -0
- package/lib/node/mcp-oauth-credential-store.d.ts +15 -0
- package/lib/node/mcp-oauth-credential-store.d.ts.map +1 -0
- package/lib/node/mcp-oauth-credential-store.js +82 -0
- package/lib/node/mcp-oauth-credential-store.js.map +1 -0
- package/lib/node/mcp-oauth-errors.d.ts +21 -0
- package/lib/node/mcp-oauth-errors.d.ts.map +1 -0
- package/lib/node/mcp-oauth-errors.js +46 -0
- package/lib/node/mcp-oauth-errors.js.map +1 -0
- package/lib/node/mcp-oauth-frontend-delegate.d.ts +18 -0
- package/lib/node/mcp-oauth-frontend-delegate.d.ts.map +1 -0
- package/lib/node/mcp-oauth-frontend-delegate.js +65 -0
- package/lib/node/mcp-oauth-frontend-delegate.js.map +1 -0
- package/lib/node/mcp-oauth-frontend-delegate.spec.d.ts +2 -0
- package/lib/node/mcp-oauth-frontend-delegate.spec.d.ts.map +1 -0
- package/lib/node/mcp-oauth-frontend-delegate.spec.js +96 -0
- package/lib/node/mcp-oauth-frontend-delegate.spec.js.map +1 -0
- package/lib/node/mcp-oauth-keystore.d.ts +27 -0
- package/lib/node/mcp-oauth-keystore.d.ts.map +1 -0
- package/lib/node/mcp-oauth-keystore.js +63 -0
- package/lib/node/mcp-oauth-keystore.js.map +1 -0
- package/lib/node/mcp-server-manager-impl.d.ts +27 -5
- package/lib/node/mcp-server-manager-impl.d.ts.map +1 -1
- package/lib/node/mcp-server-manager-impl.js +176 -24
- package/lib/node/mcp-server-manager-impl.js.map +1 -1
- package/lib/node/mcp-server-manager-impl.spec.d.ts +2 -0
- package/lib/node/mcp-server-manager-impl.spec.d.ts.map +1 -0
- package/lib/node/mcp-server-manager-impl.spec.js +503 -0
- package/lib/node/mcp-server-manager-impl.spec.js.map +1 -0
- package/lib/node/mcp-server-manager-server.d.ts +2 -1
- package/lib/node/mcp-server-manager-server.d.ts.map +1 -1
- package/lib/node/mcp-server-manager-server.js +17 -4
- package/lib/node/mcp-server-manager-server.js.map +1 -1
- package/lib/node/mcp-server.d.ts +67 -10
- package/lib/node/mcp-server.d.ts.map +1 -1
- package/lib/node/mcp-server.js +384 -114
- package/lib/node/mcp-server.js.map +1 -1
- package/lib/node/mcp-server.spec.d.ts +2 -0
- package/lib/node/mcp-server.spec.d.ts.map +1 -0
- package/lib/node/mcp-server.spec.js +678 -0
- package/lib/node/mcp-server.spec.js.map +1 -0
- package/package.json +9 -6
- package/src/browser/install-mcp-uri-handler.spec.ts +50 -8
- package/src/browser/install-mcp-uri-handler.ts +11 -0
- package/src/browser/mcp-configuration-widget.spec.tsx +417 -0
- package/src/browser/mcp-configuration-widget.tsx +147 -7
- package/src/browser/mcp-frontend-application-contribution.spec.ts +443 -19
- package/src/browser/mcp-frontend-application-contribution.ts +138 -34
- package/src/browser/mcp-frontend-module.ts +19 -6
- package/src/browser/mcp-frontend-service.spec.ts +249 -0
- package/src/browser/mcp-frontend-service.ts +81 -9
- package/src/browser/mcp-oauth-frontend-delegate-client.spec.ts +189 -0
- package/src/browser/mcp-oauth-frontend-delegate-client.ts +80 -0
- package/src/browser/mcp-server-edit-dialog.tsx +226 -35
- package/src/browser/mcp-server-editor.spec.ts +229 -1
- package/src/browser/mcp-server-editor.ts +71 -11
- package/src/browser/mcp-server-install-dialog.spec.ts +19 -1
- package/src/browser/mcp-server-install-dialog.tsx +174 -6
- package/src/browser/mcp-server-manager-server-client.ts +6 -2
- package/src/browser/style/mcp-server-dialog.css +46 -0
- package/src/common/index.ts +2 -0
- package/src/common/mcp-oauth.ts +64 -0
- package/src/common/mcp-preferences.ts +74 -4
- package/src/common/mcp-protocol.ts +2 -1
- package/src/common/mcp-server-manager.ts +75 -25
- package/src/common/mcp-server-preference-validator.spec.ts +219 -0
- package/src/common/mcp-server-preference-validator.ts +225 -0
- package/src/electron-node/mcp-electron-node-module.ts +33 -0
- package/src/electron-node/mcp-oauth-loopback-callback-server.spec.ts +157 -0
- package/src/electron-node/mcp-oauth-loopback-callback-server.ts +130 -0
- package/src/node/mcp-backend-module.ts +25 -0
- package/src/node/mcp-oauth-callback-backend-contribution.spec.ts +119 -0
- package/src/node/mcp-oauth-callback-backend-contribution.ts +63 -0
- package/src/node/mcp-oauth-callback-endpoint.ts +29 -0
- package/src/node/mcp-oauth-callback-responder.spec.ts +110 -0
- package/src/node/mcp-oauth-callback-responder.ts +131 -0
- package/src/node/mcp-oauth-callback-service.spec.ts +130 -0
- package/src/node/mcp-oauth-callback-service.ts +240 -0
- package/src/node/mcp-oauth-client-provider-factory.spec.ts +61 -0
- package/src/node/mcp-oauth-client-provider-factory.ts +75 -0
- package/src/node/mcp-oauth-client-provider.spec.ts +589 -0
- package/src/node/mcp-oauth-client-provider.ts +351 -0
- package/src/node/mcp-oauth-credential-store.ts +88 -0
- package/src/node/mcp-oauth-errors.ts +47 -0
- package/src/node/mcp-oauth-frontend-delegate.spec.ts +113 -0
- package/src/node/mcp-oauth-frontend-delegate.ts +72 -0
- package/src/node/mcp-oauth-keystore.ts +67 -0
- package/src/node/mcp-server-manager-impl.spec.ts +560 -0
- package/src/node/mcp-server-manager-impl.ts +197 -29
- package/src/node/mcp-server-manager-server.ts +20 -5
- package/src/node/mcp-server.spec.ts +818 -0
- package/src/node/mcp-server.ts +422 -130
- package/lib/common/mcp-servers-preference.d.ts.map +0 -1
- package/lib/common/mcp-servers-preference.js +0 -55
- package/lib/common/mcp-servers-preference.js.map +0 -1
- package/src/common/mcp-servers-preference.ts +0 -84
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ The AI MCP package provides an integration that allows users to start and use MC
|
|
|
21
21
|
|
|
22
22
|
### Commands
|
|
23
23
|
|
|
24
|
-
- Include `@theia/ai-mcp-ui` to gain access to the start and
|
|
24
|
+
- Include `@theia/ai-mcp-ui` to gain access to the MCP server commands: start, stop, sign in to and sign out from OAuth-enabled servers, and `"MCP: Get MCP OAuth Redirect URL"`.
|
|
25
25
|
|
|
26
26
|
### Configuration
|
|
27
27
|
|
|
@@ -31,6 +31,18 @@ Afterwards, open the preferences and add entries to the `MCP Servers Configurati
|
|
|
31
31
|
|
|
32
32
|
`"autostart"` (true by default) will automatically start the respective MCP server whenever you restart your Theia application. In your current session, however, you'll still need to **manually start it** using the `"MCP: Start MCP Server"` command.
|
|
33
33
|
|
|
34
|
+
MCP servers managed by a frontend connection are stopped when that connection disconnects, including local stdio child processes. In browser deployments, refreshing or closing the browser tab therefore terminates the running servers; autostart-tagged servers will start again on reconnect, but manually-started servers will need to be restarted via the `"MCP: Start MCP Server"` command.
|
|
35
|
+
|
|
36
|
+
Remote MCP servers that require OAuth 2.1 authorization can be configured with an `oauth` object. The presence of the `oauth` object enables OAuth for the server (remove it to disable OAuth) and lets Theia open the authorization page in the user's browser, receive the redirect on `<theia-origin>/mcp/oauth/callback`, store OAuth tokens, dynamically registered client information, and discovery state in Theia's credential store, and refresh tokens through the MCP SDK. Theia uses public OAuth clients with PKCE; optional static `clientId` values are stored in preferences and can be used when an authorization server does not allow dynamic public-client registration.
|
|
37
|
+
|
|
38
|
+
Theia's credential store relies on the OS keychain (Keychain on macOS, Credential Manager on Windows, libsecret/gnome-keyring on Linux). On Linux without libsecret available, the store silently falls back to an in-memory provider; OAuth tokens then do not survive a backend restart and autostart of OAuth-enabled servers is skipped after a restart. Install `libsecret`/`gnome-keyring` to make OAuth credentials persistent on Linux.
|
|
39
|
+
|
|
40
|
+
The configured `resource` is interpreted as an RFC 8707 resource indicator and checked against the MCP server URL with the SDK's `checkResourceAllowed` helper. The matcher is origin-based, so a configured `resource` of `https://mcp.example.com` is considered to cover requests for `https://mcp.example.com/mcp`. When `resource` is configured without a path, the returned resource URL is the configured value with no path; when `resource` is not configured at all, the returned resource URL is the MCP server URL with its fragment stripped (the path is preserved). MCP OAuth does not provide per-path resource scoping.
|
|
41
|
+
|
|
42
|
+
OAuth credentials are keyed by MCP server name and server URL/resource in the system credential store. Workspaces using the same server name and URL/resource share the stored session, and renaming a server requires signing in again on the new name. Deleting the old server entry (or renaming it via preference edit, which Theia treats as a delete-and-re-add) wipes the previous credentials automatically; no manual sign-out step is required. In hosted deployments where multiple human users share one backend and one OS credential store, configure separate server names/resources per user or provide an isolated credential store to avoid sharing OAuth sessions between users. The OAuth callback service that routes redirects to in-flight authorizations is also process-global; its active/rejected callback caps are shared across frontends on the same backend, so deploy one backend per user when multi-user isolation is required. Use `"MCP: Sign Out from MCP Server"` to clear stored OAuth credentials. Browser popup blockers can prevent OAuth sign-in; allow popups for the Theia origin if the authorization page does not open. In Electron deployments, sign-in launches in the user's system default browser instead of an in-app popup; the OAuth callback is delivered to a dedicated loopback HTTP server bound to `http://127.0.0.1:28932/mcp/oauth/callback` (the RFC 8252 native-app loopback redirect), separate from the cookie-protected backend server. The port defaults to `28932` and can be overridden by setting the `THEIA_MCP_OAUTH_CALLBACK_PORT` environment variable on the backend process if it conflicts with another service on the host.
|
|
43
|
+
|
|
44
|
+
In browser/hosted deployments, the callback URL is computed as `<theia-origin>/mcp/oauth/callback` at runtime; in Electron it is the fixed loopback URL `http://127.0.0.1:<port>/mcp/oauth/callback` described above. The two authorization-server paths handle it differently. With **dynamic client registration** (the default, when `oauth.clientId` is not set), Theia advertises the callback URL to the authorization server in `redirect_uris` during the registration request; no separate console step is required. With a **static `oauth.clientId`** (the registration-skipped path), the redirect URI registered with the OAuth provider's developer console must exactly match the callback URL (`<theia-origin>/mcp/oauth/callback` in browser/hosted, or `http://127.0.0.1:<port>/mcp/oauth/callback` with the configured port in Electron), otherwise the authorization server will reject the callback with `redirect_uri_mismatch`. The Add/Edit MCP Server dialog displays the effective redirect URL of the running deployment when the `Remote (OAuth)` server type is selected, so it can be copied directly when registering a static client; the `"MCP: Get MCP OAuth Redirect URL"` command shows the same URL with a copy action without opening the dialog. If Theia is served behind a reverse proxy, make sure the proxy forwards this callback path to the Theia backend, including deployments served below a base path such as `/theia/`; if the frontend is exposed under a base path, the proxy must strip that prefix or otherwise route the generated callback URL to the backend route. The current callback URL is computed from the frontend URL; browser deployments should therefore expose the frontend and backend on the same public origin and route prefix. Callback page strings are rendered by the backend and use the backend locale. Authorization `code` and `state` values appear in callback query strings and may be captured by browser history or access logs; avoid sharing those logs while callbacks are still valid. OAuth state validation with a random UUID prevents callback poisoning.
|
|
45
|
+
|
|
34
46
|
Example Configuration:
|
|
35
47
|
|
|
36
48
|
```json
|
|
@@ -78,6 +90,15 @@ Example Configuration:
|
|
|
78
90
|
"--repository",
|
|
79
91
|
"/path/to/otherrepo"
|
|
80
92
|
]
|
|
93
|
+
},
|
|
94
|
+
"remote-oauth": {
|
|
95
|
+
"serverUrl": "https://mcp.example.com/mcp",
|
|
96
|
+
"oauth": {
|
|
97
|
+
"clientId": "OPTIONAL_STATIC_CLIENT_ID",
|
|
98
|
+
"scopes": ["mcp.read", "mcp.write"],
|
|
99
|
+
"authorizationServer": "https://auth.example.com",
|
|
100
|
+
"resource": "https://mcp.example.com"
|
|
101
|
+
}
|
|
81
102
|
}
|
|
82
103
|
}
|
|
83
104
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MessageService, PreferenceService } from '@theia/core';
|
|
2
2
|
import URI from '@theia/core/lib/common/uri';
|
|
3
3
|
import { OpenHandler } from '@theia/core/lib/browser/opener-service';
|
|
4
|
+
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
4
5
|
import { MCPServerEditor } from './mcp-server-editor';
|
|
5
6
|
import { MCPInstallUriConfiguration } from './mcp-install-uri-configuration';
|
|
6
7
|
import { MCPRegistryUiBridge } from './mcp-registry-ui-bridge';
|
|
@@ -11,6 +12,10 @@ import { MCPServerInstallDialogFactory } from './mcp-server-install-dialog';
|
|
|
11
12
|
* read from the configured AI registry by id. This guarantees the user installs exactly
|
|
12
13
|
* what the registry currently publishes and keeps install links short and stable.
|
|
13
14
|
*
|
|
15
|
+
* Opening such a link brings the IDE window to the foreground, reveals the AI registry
|
|
16
|
+
* (Extensions) view with the `serverId` searched so the entry is in focus, and then opens
|
|
17
|
+
* the install dialog for that entry.
|
|
18
|
+
*
|
|
14
19
|
* Lives in `@theia/ai-mcp` so products without the registry package still receive the
|
|
15
20
|
* URL - but installation only succeeds when an `MCPRegistryUiBridge` is bound and the
|
|
16
21
|
* id exists in the registry. The bridge is consulted via `@optional()`.
|
|
@@ -20,6 +25,7 @@ export declare class InstallMcpUriHandler implements OpenHandler {
|
|
|
20
25
|
protected readonly configuration: MCPInstallUriConfiguration;
|
|
21
26
|
protected readonly editor: MCPServerEditor;
|
|
22
27
|
protected readonly messageService: MessageService;
|
|
28
|
+
protected readonly windowService: WindowService;
|
|
23
29
|
protected readonly preferenceService: PreferenceService;
|
|
24
30
|
protected readonly registryBridge?: MCPRegistryUiBridge;
|
|
25
31
|
protected readonly installDialogFactory: MCPServerInstallDialogFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-mcp-uri-handler.d.ts","sourceRoot":"","sources":["../../src/browser/install-mcp-uri-handler.ts"],"names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GAAG,MAAM;IASrB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA0DjD,kFAAkF;IAClF,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKxD;;;;OAIG;cACa,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAcrE,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS;CAG1D"}
|
|
@@ -19,6 +19,7 @@ exports.InstallMcpUriHandler = void 0;
|
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
20
|
const core_1 = require("@theia/core");
|
|
21
21
|
const dialogs_1 = require("@theia/core/lib/browser/dialogs");
|
|
22
|
+
const window_service_1 = require("@theia/core/lib/browser/window/window-service");
|
|
22
23
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
23
24
|
const mcp_preferences_1 = require("../common/mcp-preferences");
|
|
24
25
|
const mcp_server_editor_1 = require("./mcp-server-editor");
|
|
@@ -32,6 +33,10 @@ const ID_PARAM = 'id';
|
|
|
32
33
|
* read from the configured AI registry by id. This guarantees the user installs exactly
|
|
33
34
|
* what the registry currently publishes and keeps install links short and stable.
|
|
34
35
|
*
|
|
36
|
+
* Opening such a link brings the IDE window to the foreground, reveals the AI registry
|
|
37
|
+
* (Extensions) view with the `serverId` searched so the entry is in focus, and then opens
|
|
38
|
+
* the install dialog for that entry.
|
|
39
|
+
*
|
|
35
40
|
* Lives in `@theia/ai-mcp` so products without the registry package still receive the
|
|
36
41
|
* URL - but installation only succeeds when an `MCPRegistryUiBridge` is bound and the
|
|
37
42
|
* id exists in the registry. The bridge is consulted via `@optional()`.
|
|
@@ -50,6 +55,7 @@ let InstallMcpUriHandler = class InstallMcpUriHandler {
|
|
|
50
55
|
}
|
|
51
56
|
async open(uri) {
|
|
52
57
|
const serverId = this.extractServerId(uri);
|
|
58
|
+
this.windowService.focus();
|
|
53
59
|
if (!serverId) {
|
|
54
60
|
this.messageService.error(core_1.nls.localize('theia/ai-mcp/installUri/missingId', 'Install link is missing the required "id" parameter.'));
|
|
55
61
|
return undefined;
|
|
@@ -66,6 +72,7 @@ let InstallMcpUriHandler = class InstallMcpUriHandler {
|
|
|
66
72
|
this.messageService.error(core_1.nls.localize('theia/ai-mcp/installUri/unknownId', 'MCP server "{0}" is not listed in your AI registry.', serverId));
|
|
67
73
|
return undefined;
|
|
68
74
|
}
|
|
75
|
+
await this.registryBridge.openRegistry(serverId);
|
|
69
76
|
if (this.isAlreadyInstalled(entry.localName) && !await this.confirmOverwrite(entry.localName)) {
|
|
70
77
|
return undefined;
|
|
71
78
|
}
|
|
@@ -73,6 +80,7 @@ let InstallMcpUriHandler = class InstallMcpUriHandler {
|
|
|
73
80
|
name: entry.localName,
|
|
74
81
|
autostart: true,
|
|
75
82
|
requireAuthToken: 'serverAuthToken' in entry.config,
|
|
83
|
+
requireOAuth: 'oauth' in entry.config,
|
|
76
84
|
// Bridge already resolved this id, so trust is always "verified" here.
|
|
77
85
|
trust: { status: 'verified', serverId }
|
|
78
86
|
});
|
|
@@ -123,6 +131,10 @@ tslib_1.__decorate([
|
|
|
123
131
|
(0, inversify_1.inject)(core_1.MessageService),
|
|
124
132
|
tslib_1.__metadata("design:type", core_1.MessageService)
|
|
125
133
|
], InstallMcpUriHandler.prototype, "messageService", void 0);
|
|
134
|
+
tslib_1.__decorate([
|
|
135
|
+
(0, inversify_1.inject)(window_service_1.WindowService),
|
|
136
|
+
tslib_1.__metadata("design:type", Object)
|
|
137
|
+
], InstallMcpUriHandler.prototype, "windowService", void 0);
|
|
126
138
|
tslib_1.__decorate([
|
|
127
139
|
(0, inversify_1.inject)(core_1.PreferenceService),
|
|
128
140
|
tslib_1.__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-mcp-uri-handler.js","sourceRoot":"","sources":["../../src/browser/install-mcp-uri-handler.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,sCAAqE;AAErE,6DAAgE;AAEhE,4DAA4E;AAC5E,+DAA6D;AAC7D,2DAAsD;AACtD,mFAA6E;AAC7E,qEAA+D;AAC/D,2EAAmG;AAEnG,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB
|
|
1
|
+
{"version":3,"file":"install-mcp-uri-handler.js","sourceRoot":"","sources":["../../src/browser/install-mcp-uri-handler.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,sCAAqE;AAErE,6DAAgE;AAEhE,kFAA8E;AAC9E,4DAA4E;AAC5E,+DAA6D;AAC7D,2DAAsD;AACtD,mFAA6E;AAC7E,qEAA+D;AAC/D,2EAAmG;AAEnG,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB;;;;;;;;;;;;;GAaG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QAEM,OAAE,GAAG,yBAAyB,CAAC;IAsH5C,CAAC;IA/FG,SAAS,CAAC,GAAQ;QACd,oFAAoF;QACpF,gEAAgE;QAChE,OAAO,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE;eAC7C,GAAG,CAAC,SAAS,KAAK,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;YACtD,CAAC,CAAC,GAAG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AAC;YACrC,MAAM,EAAE,UAAG,CAAC,iBAAiB,CAAC,QAAQ,CAAC;SAC1C,CAAC,CAAC;QACH,OAAO,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAES,eAAe,CAAC,GAAQ;QAC9B,OAAO,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAC7E,CAAC;CACJ,CAAA;AAxHY,oDAAoB;AAKV;IADlB,IAAA,kBAAM,EAAC,0DAA0B,CAAC;sCACD,0DAA0B;2DAAC;AAG1C;IADlB,IAAA,kBAAM,EAAC,mCAAe,CAAC;;oDACmB;AAGxB;IADlB,IAAA,kBAAM,EAAC,qBAAc,CAAC;sCACY,qBAAc;4DAAC;AAG/B;IADlB,IAAA,kBAAM,EAAC,8BAAa,CAAC;;2DAC0B;AAG7B;IADlB,IAAA,kBAAM,EAAC,wBAAiB,CAAC;;+DAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,4CAAmB,CAAC;IAAE,IAAA,oBAAQ,GAAE;;4DACgB;AAGrC;IADlB,IAAA,kBAAM,EAAC,yDAA6B,CAAC;;kEACiC;+BAvB9D,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAwHhC"}
|
|
@@ -29,6 +29,7 @@ catch {
|
|
|
29
29
|
const chai_1 = require("chai");
|
|
30
30
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
31
|
const core_1 = require("@theia/core");
|
|
32
|
+
const window_service_1 = require("@theia/core/lib/browser/window/window-service");
|
|
32
33
|
const uri_1 = require("@theia/core/lib/common/uri");
|
|
33
34
|
const mcp_preferences_1 = require("../common/mcp-preferences");
|
|
34
35
|
const mcp_server_manager_1 = require("../common/mcp-server-manager");
|
|
@@ -61,10 +62,19 @@ class FakeMessageService {
|
|
|
61
62
|
this.infos.push(message);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
65
|
+
class FakeWindowService {
|
|
66
|
+
constructor() {
|
|
67
|
+
this.focusCount = 0;
|
|
68
|
+
}
|
|
69
|
+
focus() {
|
|
70
|
+
this.focusCount++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
64
73
|
class FakeRegistryBridge {
|
|
65
74
|
constructor() {
|
|
66
75
|
this.onDidChange = () => ({ dispose: () => undefined });
|
|
67
76
|
this.entries = new Map();
|
|
77
|
+
this.openedServerIds = [];
|
|
68
78
|
}
|
|
69
79
|
setEntry(serverId, entry) {
|
|
70
80
|
this.entries.set(serverId, entry);
|
|
@@ -76,7 +86,9 @@ class FakeRegistryBridge {
|
|
|
76
86
|
getInstallEntry(serverId) {
|
|
77
87
|
return this.entries.get(serverId);
|
|
78
88
|
}
|
|
79
|
-
async openRegistry() {
|
|
89
|
+
async openRegistry(serverId) {
|
|
90
|
+
this.openedServerIds.push(serverId);
|
|
91
|
+
}
|
|
80
92
|
}
|
|
81
93
|
class FakeConfiguration extends mcp_install_uri_configuration_1.MCPInstallUriConfiguration {
|
|
82
94
|
constructor(scheme, authority = 'install-mcp') {
|
|
@@ -91,16 +103,19 @@ function buildHandler(options = {}) {
|
|
|
91
103
|
const container = new inversify_1.Container();
|
|
92
104
|
const prefs = options.prefs ?? new FakePreferenceService();
|
|
93
105
|
const messages = options.messages ?? new FakeMessageService();
|
|
106
|
+
const windowService = options.windowService ?? new FakeWindowService();
|
|
94
107
|
container.bind(core_1.PreferenceService).toConstantValue(prefs);
|
|
95
108
|
container.bind(core_1.MessageService).toConstantValue(messages);
|
|
109
|
+
container.bind(window_service_1.WindowService).toConstantValue(windowService);
|
|
96
110
|
container.bind(mcp_server_manager_1.MCPFrontendService).toConstantValue({});
|
|
97
|
-
// The error-path tests never open a dialog; bind
|
|
111
|
+
// The error-path tests never open a dialog; bind a factory that fails loudly if used,
|
|
112
|
+
// unless a test supplies its own.
|
|
98
113
|
container.bind(mcp_server_editor_1.MCPServerEditDialogFactory).toConstantValue(() => {
|
|
99
114
|
throw new Error('MCPServerEditDialogFactory should not be invoked in these tests');
|
|
100
115
|
});
|
|
101
|
-
container.bind(mcp_server_install_dialog_1.MCPServerInstallDialogFactory).toConstantValue(() => {
|
|
116
|
+
container.bind(mcp_server_install_dialog_1.MCPServerInstallDialogFactory).toConstantValue(options.installDialogFactory ?? (() => {
|
|
102
117
|
throw new Error('MCPServerInstallDialogFactory should not be invoked in these tests');
|
|
103
|
-
});
|
|
118
|
+
}));
|
|
104
119
|
container.bind(mcp_server_editor_1.MCPServerEditorImpl).toSelf().inSingletonScope();
|
|
105
120
|
container.bind(mcp_server_editor_1.MCPServerEditor).toService(mcp_server_editor_1.MCPServerEditorImpl);
|
|
106
121
|
container.bind(mcp_install_uri_configuration_1.MCPInstallUriConfiguration).toConstantValue(new FakeConfiguration(options.scheme ?? 'theia'));
|
|
@@ -108,7 +123,7 @@ function buildHandler(options = {}) {
|
|
|
108
123
|
container.bind(mcp_registry_ui_bridge_1.MCPRegistryUiBridge).toConstantValue(options.bridge);
|
|
109
124
|
}
|
|
110
125
|
container.bind(install_mcp_uri_handler_1.InstallMcpUriHandler).toSelf().inSingletonScope();
|
|
111
|
-
return { handler: container.get(install_mcp_uri_handler_1.InstallMcpUriHandler), messages, prefs, bridge: options.bridge };
|
|
126
|
+
return { handler: container.get(install_mcp_uri_handler_1.InstallMcpUriHandler), messages, prefs, windowService, bridge: options.bridge };
|
|
112
127
|
}
|
|
113
128
|
describe('InstallMcpUriHandler.canHandle', () => {
|
|
114
129
|
it('claims URIs whose scheme and authority both match the configuration', () => {
|
|
@@ -126,9 +141,10 @@ describe('InstallMcpUriHandler.canHandle', () => {
|
|
|
126
141
|
});
|
|
127
142
|
});
|
|
128
143
|
describe('InstallMcpUriHandler.open', () => {
|
|
129
|
-
it('reports an error and does not write the preference when the URI carries no id', async () => {
|
|
130
|
-
const { handler, messages, prefs } = buildHandler({ bridge: new FakeRegistryBridge() });
|
|
144
|
+
it('focuses the window and reports an error and does not write the preference when the URI carries no id', async () => {
|
|
145
|
+
const { handler, messages, prefs, windowService } = buildHandler({ bridge: new FakeRegistryBridge() });
|
|
131
146
|
await handler.open(new uri_1.default('theia://install-mcp'));
|
|
147
|
+
(0, chai_1.expect)(windowService.focusCount).to.equal(1);
|
|
132
148
|
(0, chai_1.expect)(messages.errors).to.have.length(1);
|
|
133
149
|
(0, chai_1.expect)(messages.errors[0]).to.match(/missing the required "id"/i);
|
|
134
150
|
(0, chai_1.expect)(prefs.get(mcp_preferences_1.MCP_SERVERS_PREF)).to.be.undefined;
|
|
@@ -146,11 +162,27 @@ describe('InstallMcpUriHandler.open', () => {
|
|
|
146
162
|
await handler.open(new uri_1.default('theia://install-mcp?id=io.example/unknown'));
|
|
147
163
|
(0, chai_1.expect)(messages.errors).to.have.length(1);
|
|
148
164
|
(0, chai_1.expect)(messages.errors[0]).to.match(/is not listed in your AI registry/i);
|
|
165
|
+
(0, chai_1.expect)(bridge.openedServerIds).to.be.empty;
|
|
149
166
|
});
|
|
150
167
|
it('trims whitespace around the id parameter and treats an empty id as missing', async () => {
|
|
151
168
|
const { handler, messages } = buildHandler({ bridge: new FakeRegistryBridge() });
|
|
152
169
|
await handler.open(new uri_1.default('theia://install-mcp?id=%20%20'));
|
|
153
170
|
(0, chai_1.expect)(messages.errors[0]).to.match(/missing the required "id"/i);
|
|
154
171
|
});
|
|
172
|
+
it('focuses the window, reveals the registry search for the id, then opens the install dialog for a known id', async () => {
|
|
173
|
+
const bridge = new FakeRegistryBridge();
|
|
174
|
+
bridge.setEntry('io.example/foo', { localName: 'foo', config: { command: 'npx', args: [] }, serverId: 'io.example/foo' });
|
|
175
|
+
let dialogOpened = false;
|
|
176
|
+
// Cancel the dialog (open resolves undefined) so the test stops before the actual install.
|
|
177
|
+
const installDialogFactory = (() => ({
|
|
178
|
+
open: async () => { dialogOpened = true; return undefined; }
|
|
179
|
+
}));
|
|
180
|
+
const { handler, windowService } = buildHandler({ bridge, installDialogFactory });
|
|
181
|
+
await handler.open(new uri_1.default('theia://install-mcp?id=io.example/foo'));
|
|
182
|
+
(0, chai_1.expect)(windowService.focusCount).to.equal(1);
|
|
183
|
+
// The registry view is revealed and the id searched before the install dialog opens.
|
|
184
|
+
(0, chai_1.expect)(bridge.openedServerIds).to.deep.equal(['io.example/foo']);
|
|
185
|
+
(0, chai_1.expect)(dialogOpened).to.be.true;
|
|
186
|
+
});
|
|
155
187
|
});
|
|
156
188
|
//# sourceMappingURL=install-mcp-uri-handler.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-mcp-uri-handler.spec.js","sourceRoot":"","sources":["../../src/browser/install-mcp-uri-handler.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,uHAAiH;AACjH,8DAAiE;AACjE,MAAM,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AACnC,uFAAuF;AACvF,wEAAwE;AACxE,IAAI,CAAC;IACD,wEAAiC,CAAC,GAAG,EAAE,CAAC;AAC5C,CAAC;AAAC,MAAM,CAAC;IACL,wEAAiC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,+BAA8B;AAC9B,4DAAyD;AACzD,sCAAgE;AAChE,oDAA6C;AAC7C,+DAA6D;AAC7D,qEAAkE;AAClE,2DAAwH;AACxH,2EAA4E;AAC5E,mFAA6E;AAC7E,qEAA+D;AAC/D,uEAAiE;AAEjE,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;AAE5B,MAAM,qBAAqB;IAA3B;QACqB,UAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;IAOxD,CAAC;IANG,GAAG,CAAI,GAAW,EAAE,YAAgB;QAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAkB,CAAC;IACvF,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAc;QACjC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACJ;AAED,MAAM,kBAAkB;IAAxB;QACW,WAAM,GAAa,EAAE,CAAC;QACtB,UAAK,GAAa,EAAE,CAAC;IAOhC,CAAC;IANG,KAAK,CAAC,OAAe;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,CAAC,OAAe;QAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACJ;AAED,MAAM,kBAAkB;IAAxB;QACa,gBAAW,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAC3C,YAAO,GAAG,IAAI,GAAG,EAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"install-mcp-uri-handler.spec.js","sourceRoot":"","sources":["../../src/browser/install-mcp-uri-handler.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,uHAAiH;AACjH,8DAAiE;AACjE,MAAM,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AACnC,uFAAuF;AACvF,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,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAC1H,IAAI,YAAY,GAAG,KAAK,CAAC;QACzB,2FAA2F;QAC3F,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;YACjC,IAAI,EAAE,KAAK,IAAI,EAAE,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;SAC/D,CAAC,CAA6C,CAAC;QAChD,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAElF,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,aAAG,CAAC,uCAAuC,CAAC,CAAC,CAAC;QAErE,IAAA,aAAM,EAAC,aAAa,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7C,qFAAqF;QACrF,IAAA,aAAM,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACjE,IAAA,aAAM,EAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACpC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -10,6 +10,7 @@ export declare class AIMCPConfigurationWidget extends ReactWidget {
|
|
|
10
10
|
static readonly LABEL: string;
|
|
11
11
|
protected servers: MCPServerDescription[];
|
|
12
12
|
protected expandedTools: Record<string, boolean>;
|
|
13
|
+
protected oauthCredentialStates: Record<string, boolean>;
|
|
13
14
|
protected readonly mcpFrontendService: MCPFrontendService;
|
|
14
15
|
protected readonly mcpFrontendNotificationService: MCPFrontendNotificationService;
|
|
15
16
|
protected readonly hoverService: HoverService;
|
|
@@ -27,10 +28,13 @@ export declare class AIMCPConfigurationWidget extends ReactWidget {
|
|
|
27
28
|
bg: string;
|
|
28
29
|
fg: string;
|
|
29
30
|
};
|
|
30
|
-
protected showErrorHover(spanRef: React.RefObject<HTMLSpanElement>, error: string): void;
|
|
31
|
+
protected showErrorHover(spanRef: React.RefObject<HTMLSpanElement | null>, error: string): void;
|
|
31
32
|
protected hideErrorHover(): void;
|
|
32
|
-
protected handleStartServer(
|
|
33
|
+
protected handleStartServer(server: MCPServerDescription): Promise<void>;
|
|
33
34
|
protected handleStopServer(serverName: string): Promise<void>;
|
|
35
|
+
protected handleSignInServer(serverName: string): Promise<void>;
|
|
36
|
+
protected handleSignOutServer(serverName: string): Promise<void>;
|
|
37
|
+
protected confirmSignOut(serverName: string): Promise<boolean>;
|
|
34
38
|
protected renderButton(text: React.ReactNode, title: string, onClick: React.MouseEventHandler<HTMLButtonElement>, className?: string, style?: React.CSSProperties): React.ReactNode;
|
|
35
39
|
protected renderStatusBadge(server: MCPServerDescription): React.ReactNode;
|
|
36
40
|
protected renderServerHeader(server: MCPServerDescription): React.ReactNode;
|
|
@@ -41,7 +45,9 @@ export declare class AIMCPConfigurationWidget extends ReactWidget {
|
|
|
41
45
|
protected renderServerAuthTokenHeaderSection(server: MCPServerDescription): React.ReactNode;
|
|
42
46
|
protected renderServerAuthTokenSection(server: MCPServerDescription): React.ReactNode;
|
|
43
47
|
protected renderServerHeadersSection(server: MCPServerDescription): React.ReactNode;
|
|
48
|
+
protected renderOAuthSection(server: MCPServerDescription): React.ReactNode;
|
|
44
49
|
protected renderAutostartSection(server: MCPServerDescription): React.ReactNode;
|
|
50
|
+
protected renderDeferLoadingSection(server: MCPServerDescription): React.ReactNode;
|
|
45
51
|
protected renderToolsSection(server: MCPServerDescription): React.ReactNode;
|
|
46
52
|
protected toggleTools(serverName: string): void;
|
|
47
53
|
protected renderServerCard(server: MCPServerDescription): React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-configuration-widget.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-configuration-widget.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAA0B,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAGH,8BAA8B,EAC9B,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAwB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBACa,wBAAyB,SAAQ,WAAW;IAErD,MAAM,CAAC,QAAQ,CAAC,EAAE,2CAA2C;IAC7D,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAwC;IAE7D,SAAS,CAAC,OAAO,EAAE,oBAAoB,EAAE,CAAM;IAC/C,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;
|
|
1
|
+
{"version":3,"file":"mcp-configuration-widget.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-configuration-widget.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAA0B,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAGH,8BAA8B,EAC9B,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAwB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBACa,w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BAAoB,GAAG,KAAK,CAAC,SAAS;IAsC3E,SAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS;IAa/E,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS;IAclF,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS;IAkF3E,SAAS,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAK/C,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS;IAqBzE,SAAS,CAAC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9C,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;cAI3D,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBrE;;;;;;OAMG;IACH,SAAS,CAAC,wBAAwB,CAAC,MAAM,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS;IAmBjF,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS;CAgCtC"}
|
|
@@ -33,6 +33,7 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
33
33
|
super(...arguments);
|
|
34
34
|
this.servers = [];
|
|
35
35
|
this.expandedTools = {};
|
|
36
|
+
this.oauthCredentialStates = {};
|
|
36
37
|
}
|
|
37
38
|
static { AIMCPConfigurationWidget_1 = this; }
|
|
38
39
|
static { this.ID = 'ai-mcp-configuration-container-widget'; }
|
|
@@ -50,6 +51,12 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
50
51
|
const serverNames = (await this.mcpFrontendService.getServerNames()).sort((a, b) => a.localeCompare(b));
|
|
51
52
|
const descriptions = await Promise.all(serverNames.map(name => this.mcpFrontendService.getServerDescription(name)));
|
|
52
53
|
this.servers = descriptions.filter((desc) => desc !== undefined);
|
|
54
|
+
this.oauthCredentialStates = Object.fromEntries(await Promise.all(this.servers.map(async (server) => [
|
|
55
|
+
server.name,
|
|
56
|
+
(0, mcp_server_manager_1.isRemoteMCPServerDescription)(server) && server.oauth
|
|
57
|
+
? await this.mcpFrontendService.hasStoredOAuthCredentials(server.name)
|
|
58
|
+
: false
|
|
59
|
+
])));
|
|
53
60
|
this.update();
|
|
54
61
|
}
|
|
55
62
|
getStatusColor(status) {
|
|
@@ -62,6 +69,7 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
62
69
|
return { bg: 'var(--theia-successBackground)', fg: 'var(--theia-successForeground)' };
|
|
63
70
|
case mcp_server_manager_1.MCPServerStatus.Starting:
|
|
64
71
|
case mcp_server_manager_1.MCPServerStatus.Connecting:
|
|
72
|
+
case mcp_server_manager_1.MCPServerStatus.AuthenticationRequired:
|
|
65
73
|
return { bg: 'var(--theia-warningBackground)', fg: 'var(--theia-warningForeground)' };
|
|
66
74
|
case mcp_server_manager_1.MCPServerStatus.Errored:
|
|
67
75
|
return { bg: 'var(--theia-errorBackground)', fg: 'var(--theia-errorForeground)' };
|
|
@@ -77,11 +85,67 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
77
85
|
hideErrorHover() {
|
|
78
86
|
this.hoverService.cancelHover();
|
|
79
87
|
}
|
|
80
|
-
async handleStartServer(
|
|
81
|
-
|
|
88
|
+
async handleStartServer(server) {
|
|
89
|
+
// `startServerInteractive` sets the manager's `interactive` flag, which is what permits the OAuth
|
|
90
|
+
// provider to open the browser; no OAuth-specific handling is needed at this layer.
|
|
91
|
+
try {
|
|
92
|
+
if (server.status === mcp_server_manager_1.MCPServerStatus.AuthenticationRequired) {
|
|
93
|
+
// A start in `AuthenticationRequired` would join the pending OAuth flow and do nothing;
|
|
94
|
+
// stop first to cancel it so the server restarts with a fresh authorization attempt.
|
|
95
|
+
await this.mcpFrontendService.stopServer(server.name);
|
|
96
|
+
}
|
|
97
|
+
await this.mcpFrontendService.startServerInteractive(server.name);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
// Surface pre-terminal failures (e.g. RPC channel drops) that would otherwise be unhandled
|
|
101
|
+
// rejections; terminal states already surface via the status badge.
|
|
102
|
+
console.error(`Failed to start MCP server "${server.name}"`, error);
|
|
103
|
+
this.messageService.warn(core_1.nls.localize('theia/ai/mcpConfiguration/startServerFailed', 'Failed to start MCP server "{0}".', server.name));
|
|
104
|
+
}
|
|
82
105
|
}
|
|
83
106
|
async handleStopServer(serverName) {
|
|
84
|
-
|
|
107
|
+
try {
|
|
108
|
+
await this.mcpFrontendService.stopServer(serverName);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
console.error(`Failed to stop MCP server "${serverName}"`, error);
|
|
112
|
+
this.messageService.warn(core_1.nls.localize('theia/ai/mcpConfiguration/stopServerFailed', 'Failed to stop MCP server "{0}".', serverName));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async handleSignInServer(serverName) {
|
|
116
|
+
try {
|
|
117
|
+
const signedIn = await this.mcpFrontendService.signIn(serverName);
|
|
118
|
+
if (signedIn) {
|
|
119
|
+
this.messageService.info(core_1.nls.localize('theia/ai/mcpConfiguration/signInServerSucceeded', 'Signed in to MCP server "{0}".', serverName));
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.messageService.warn(core_1.nls.localize('theia/ai/mcpConfiguration/signInServerNotCompleted', 'Sign-in to MCP server "{0}" was not completed.', serverName));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error(`Failed to sign in to MCP server "${serverName}"`, error);
|
|
127
|
+
this.messageService.warn(core_1.nls.localize('theia/ai/mcpConfiguration/signInServerFailed', 'Failed to sign in to MCP server "{0}".', serverName));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async handleSignOutServer(serverName) {
|
|
131
|
+
if (await this.confirmSignOut(serverName)) {
|
|
132
|
+
try {
|
|
133
|
+
await this.mcpFrontendService.signOut(serverName);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.error(`Failed to sign out from MCP server "${serverName}"`, error);
|
|
137
|
+
this.messageService.warn(core_1.nls.localize('theia/ai/mcpConfiguration/signOutServerFailed', 'Failed to sign out from MCP server "{0}".', serverName));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async confirmSignOut(serverName) {
|
|
142
|
+
const dialog = new browser_1.ConfirmDialog({
|
|
143
|
+
title: core_1.nls.localize('theia/ai/mcpConfiguration/signOutServerDialogTitle', 'Sign Out from MCP Server'),
|
|
144
|
+
msg: core_1.nls.localize('theia/ai/mcpConfiguration/signOutServerDialogMsg', 'Are you sure you want to sign out from the server "{0}"? This deletes the stored OAuth tokens for this server.', serverName),
|
|
145
|
+
ok: core_1.nls.localizeByDefault('Sign Out'),
|
|
146
|
+
cancel: core_1.nls.localizeByDefault('Cancel')
|
|
147
|
+
});
|
|
148
|
+
return (await dialog.open()) === true;
|
|
85
149
|
}
|
|
86
150
|
renderButton(text, title, onClick, className, style) {
|
|
87
151
|
return (React.createElement("button", { className: className, title: title, onClick: onClick, style: style }, text));
|
|
@@ -103,18 +167,21 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
103
167
|
}
|
|
104
168
|
renderServerHeader(server) {
|
|
105
169
|
const isStoppable = server.status === mcp_server_manager_1.MCPServerStatus.Running
|
|
106
|
-
|| server.status === mcp_server_manager_1.MCPServerStatus.Connected
|
|
170
|
+
|| server.status === mcp_server_manager_1.MCPServerStatus.Connected
|
|
171
|
+
|| server.status === mcp_server_manager_1.MCPServerStatus.AuthenticationRequired;
|
|
107
172
|
const isStarting = server.status === mcp_server_manager_1.MCPServerStatus.Starting
|
|
108
173
|
|| server.status === mcp_server_manager_1.MCPServerStatus.Connecting;
|
|
109
174
|
const isStartable = server.status === mcp_server_manager_1.MCPServerStatus.NotRunning
|
|
110
175
|
|| server.status === mcp_server_manager_1.MCPServerStatus.NotConnected
|
|
176
|
+
|| server.status === mcp_server_manager_1.MCPServerStatus.AuthenticationRequired
|
|
111
177
|
|| server.status === mcp_server_manager_1.MCPServerStatus.Errored;
|
|
112
178
|
const isRemote = (0, mcp_server_manager_1.isRemoteMCPServerDescription)(server);
|
|
179
|
+
const isOAuthEnabled = isRemote && !!server.oauth;
|
|
113
180
|
const startIcon = isRemote ? 'plug' : 'play';
|
|
114
181
|
const startingIcon = 'loading';
|
|
115
182
|
const stopIcon = isRemote ? 'debug-disconnect' : 'debug-stop';
|
|
116
183
|
const startLabel = isRemote
|
|
117
|
-
? core_1.nls.
|
|
184
|
+
? core_1.nls.localizeByDefault('Connect')
|
|
118
185
|
: core_1.nls.localizeByDefault('Start Server');
|
|
119
186
|
const startingLabel = isRemote
|
|
120
187
|
? core_1.nls.localize('theia/ai/mcpConfiguration/connectingServer', 'Connecting...')
|
|
@@ -128,9 +195,11 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
128
195
|
this.renderRegistryAffordance(server)),
|
|
129
196
|
React.createElement("div", { className: "mcp-server-header-controls" },
|
|
130
197
|
this.renderStatusBadge(server),
|
|
131
|
-
isStartable && (React.createElement("button", { className: `mcp-action-button ${(0, browser_1.codicon)(startIcon)}`, onClick: () => this.handleStartServer(server
|
|
198
|
+
isStartable && (React.createElement("button", { className: `mcp-action-button ${(0, browser_1.codicon)(startIcon)}`, onClick: () => this.handleStartServer(server), title: startLabel })),
|
|
132
199
|
isStarting && (React.createElement("button", { className: `mcp-action-button ${(0, browser_1.codicon)(startingIcon)} theia-animation-spin`, disabled: true, title: startingLabel })),
|
|
133
200
|
isStoppable && (React.createElement("button", { className: `mcp-action-button ${(0, browser_1.codicon)(stopIcon)}`, onClick: () => this.handleStopServer(server.name), title: stopLabel })),
|
|
201
|
+
isOAuthEnabled && isStartable && (React.createElement("button", { className: `mcp-action-button ${(0, browser_1.codicon)('sign-in')}`, onClick: () => this.handleSignInServer(server.name), title: core_1.nls.localizeByDefault('Sign In') })),
|
|
202
|
+
isOAuthEnabled && this.oauthCredentialStates[server.name] && (React.createElement("button", { className: `mcp-action-button ${(0, browser_1.codicon)('sign-out')}`, onClick: () => this.handleSignOutServer(server.name), title: core_1.nls.localizeByDefault('Sign Out') })),
|
|
134
203
|
React.createElement("button", { className: `mcp-action-button ${(0, browser_1.codicon)('edit')}`, onClick: () => this.openEditServerDialog(server), title: core_1.nls.localize('theia/ai/mcpConfiguration/editServer', 'Edit Server') }),
|
|
135
204
|
React.createElement("button", { className: `mcp-action-button mcp-delete-button ${(0, browser_1.codicon)('trash')}`, onClick: () => this.handleDeleteServer(server.name), title: core_1.nls.localize('theia/ai/mcpConfiguration/deleteServer', 'Delete Server') }))));
|
|
136
205
|
}
|
|
@@ -212,6 +281,40 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
212
281
|
"=",
|
|
213
282
|
(key.toLowerCase().includes('token') || key.toLowerCase().includes('authorization')) ? '******' : String(value))))))));
|
|
214
283
|
}
|
|
284
|
+
renderOAuthSection(server) {
|
|
285
|
+
if (!(0, mcp_server_manager_1.isRemoteMCPServerDescription)(server) || !server.oauth) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
return (React.createElement("div", { className: "mcp-property-row" },
|
|
289
|
+
React.createElement("span", { className: "mcp-property-label" },
|
|
290
|
+
core_1.nls.localize('theia/ai/mcpConfiguration/oauth', 'OAuth'),
|
|
291
|
+
":"),
|
|
292
|
+
React.createElement("div", { className: "mcp-property-value" },
|
|
293
|
+
server.oauth.clientId && (React.createElement("div", { className: "mcp-env-entry" },
|
|
294
|
+
React.createElement("code", null,
|
|
295
|
+
core_1.nls.localize('theia/ai/mcpConfiguration/oauthClientId', 'OAuth Client ID'),
|
|
296
|
+
"=",
|
|
297
|
+
server.oauth.clientId))),
|
|
298
|
+
server.oauth.clientSecret && (React.createElement("div", { className: "mcp-env-entry" },
|
|
299
|
+
React.createElement("code", null,
|
|
300
|
+
core_1.nls.localize('theia/ai/mcpConfiguration/oauthClientSecret', 'OAuth Client Secret'),
|
|
301
|
+
"=******"))),
|
|
302
|
+
server.oauth.scopes && server.oauth.scopes.length > 0 && (React.createElement("div", { className: "mcp-env-entry" },
|
|
303
|
+
React.createElement("code", null,
|
|
304
|
+
core_1.nls.localize('theia/ai/mcpConfiguration/oauthScopes', 'OAuth Scopes'),
|
|
305
|
+
"=",
|
|
306
|
+
server.oauth.scopes.join(' ')))),
|
|
307
|
+
server.oauth.authorizationServer && (React.createElement("div", { className: "mcp-env-entry" },
|
|
308
|
+
React.createElement("code", null,
|
|
309
|
+
core_1.nls.localize('theia/ai/mcpConfiguration/oauthAuthorizationServer', 'Authorization Server'),
|
|
310
|
+
"=",
|
|
311
|
+
server.oauth.authorizationServer))),
|
|
312
|
+
server.oauth.resource && (React.createElement("div", { className: "mcp-env-entry" },
|
|
313
|
+
React.createElement("code", null,
|
|
314
|
+
core_1.nls.localize('theia/ai/mcpConfiguration/oauthResource', 'OAuth Resource'),
|
|
315
|
+
"=",
|
|
316
|
+
server.oauth.resource))))));
|
|
317
|
+
}
|
|
215
318
|
renderAutostartSection(server) {
|
|
216
319
|
return (React.createElement("div", { className: "mcp-property-row" },
|
|
217
320
|
React.createElement("span", { className: "mcp-property-label" },
|
|
@@ -221,6 +324,16 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
221
324
|
color: server.autostart ? 'var(--theia-successForeground)' : 'var(--theia-errorForeground)',
|
|
222
325
|
} }, server.autostart ? core_1.nls.localizeByDefault('Enabled') : core_1.nls.localizeByDefault('Disabled'))));
|
|
223
326
|
}
|
|
327
|
+
renderDeferLoadingSection(server) {
|
|
328
|
+
if (!server.deferLoading) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
return (React.createElement("div", { className: "mcp-property-row" },
|
|
332
|
+
React.createElement("span", { className: "mcp-property-label" },
|
|
333
|
+
core_1.nls.localize('theia/ai/mcpConfiguration/deferLoading', 'Defer tool loading'),
|
|
334
|
+
":"),
|
|
335
|
+
React.createElement("span", { className: "mcp-autostart-badge", style: { color: 'var(--theia-successForeground)' } }, core_1.nls.localizeByDefault('Enabled'))));
|
|
336
|
+
}
|
|
224
337
|
renderToolsSection(server) {
|
|
225
338
|
if (!server.tools || server.tools.length === 0) {
|
|
226
339
|
return;
|
|
@@ -282,7 +395,9 @@ let AIMCPConfigurationWidget = class AIMCPConfigurationWidget extends browser_1.
|
|
|
282
395
|
this.renderServerAuthTokenHeaderSection(server),
|
|
283
396
|
this.renderServerAuthTokenSection(server),
|
|
284
397
|
this.renderServerHeadersSection(server),
|
|
285
|
-
this.
|
|
398
|
+
this.renderOAuthSection(server),
|
|
399
|
+
this.renderAutostartSection(server),
|
|
400
|
+
this.renderDeferLoadingSection(server)),
|
|
286
401
|
this.renderToolsSection(server)));
|
|
287
402
|
}
|
|
288
403
|
openAddServerDialog() {
|