дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
feat(agents): browse and install MCP servers from an MCP Registry (#7627)
Add an in-app MCP Registry browser to Settings › Agents › MCP Connections. It searches an open MCP Registry (v0.1, falling back to v0) — the GitHub MCP Registry by default, the official registry or a custom https URL — with infinite scroll and server icons. Servers install to Global or Project scope in one click when no input is needed, or through a dialog that asks for variables and secrets and confirms a missing local runtime. Installed servers record their registry name and URL. Agent Plugins also offers two suggested marketplaces to browse or add when they are not registered yet. Co-authored-by: dengliu <[email protected]>
Цей коміт міститься в:
1 джерело
5432d7f288
коміт
637e227efa
27 files changed
+3995
-41
No files matched your search
@@ -19,6 +19,7 @@ mod external;
|
||||
pub mod hermes;
|
||||
mod images;
|
||||
pub mod mcp;
|
||||
pub mod mcp_registry;
|
||||
pub mod memory;
|
||||
mod model;
|
||||
mod native;
|
||||
@@ -36,6 +37,10 @@ pub use automation::*;
|
||||
pub use catalogs::AgentCatalogs;
|
||||
pub use cli_update::{AgentCliInstallResult, AgentCliOffer, AgentCliUpdateResult};
|
||||
pub use external::ExternalSession;
|
||||
pub use mcp_registry::{
|
||||
DEFAULT_MCP_REGISTRY_URL, McpRegistryInputField, McpRegistryInputKind, McpRegistryInstallOption, McpRegistryPage,
|
||||
McpRegistryServer, OFFICIAL_MCP_REGISTRY_URL,
|
||||
};
|
||||
pub use model::*;
|
||||
pub use provider::{LoginLaunch, gh_authenticated_accounts, gh_login_launch};
|
||||
pub use skill_installer::{
|
||||
|
||||
@@ -70,6 +70,8 @@ fn to_mcp_server(scope: McpScope, name: &str, cfg: &AgentMcpServer) -> McpServer
|
||||
unapproved: false,
|
||||
plugin_id: None,
|
||||
plugin_name: None,
|
||||
registry_name: cfg.registry_name.clone(),
|
||||
registry_url: cfg.registry_url.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +256,28 @@ pub fn apply_save(
|
||||
if input.scope == McpScope::Workspace && !has_workspace {
|
||||
return Err("Open a project to configure workspace MCP servers".into());
|
||||
}
|
||||
let existing_meta = input.id.as_deref().and_then(parse_server_id).and_then(|(prev_scope, prev_name)| {
|
||||
let map = match prev_scope {
|
||||
McpScope::User => &*user,
|
||||
McpScope::Workspace => &*workspace,
|
||||
};
|
||||
map.get(prev_name).map(|prev| (prev.registry_name.clone(), prev.registry_url.clone()))
|
||||
});
|
||||
let registry_name = input
|
||||
.registry_name
|
||||
.as_deref()
|
||||
.map(str::trim)
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(str::to_owned)
|
||||
.or_else(|| existing_meta.as_ref().and_then(|(rn, _)| rn.clone()));
|
||||
let registry_url = input
|
||||
.registry_url
|
||||
.as_deref()
|
||||
.map(str::trim)
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(str::to_owned)
|
||||
.or_else(|| existing_meta.and_then(|(_, ru)| ru));
|
||||
|
||||
let cfg = match input.transport {
|
||||
McpTransport::Stdio => {
|
||||
let cmd = input.command.as_deref().map(str::trim).unwrap_or_default();
|
||||
@@ -277,6 +301,8 @@ pub fn apply_save(
|
||||
url: None,
|
||||
headers: BTreeMap::new(),
|
||||
agents: normalize_agents_list(input.agents),
|
||||
registry_name,
|
||||
registry_url,
|
||||
}
|
||||
}
|
||||
McpTransport::Http | McpTransport::Sse => {
|
||||
@@ -301,6 +327,8 @@ pub fn apply_save(
|
||||
url: Some(url.to_owned()),
|
||||
headers,
|
||||
agents: normalize_agents_list(input.agents),
|
||||
registry_name,
|
||||
registry_url,
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1018,6 +1046,8 @@ fn parse_one_server_def(obj: &serde_json::Map<String, Value>) -> Option<AgentMcp
|
||||
url,
|
||||
headers: parse_key_values_map(obj.get("headers")),
|
||||
agents,
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1272,6 +1302,8 @@ mod tests {
|
||||
unapproved: false,
|
||||
plugin_id: None,
|
||||
plugin_name: None,
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1327,6 +1359,8 @@ mod tests {
|
||||
url: None,
|
||||
headers: Vec::new(),
|
||||
agents: Vec::new(),
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
@@ -1347,6 +1381,8 @@ mod tests {
|
||||
url: None,
|
||||
headers: Vec::new(),
|
||||
agents: Vec::new(),
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
@@ -1367,6 +1403,8 @@ mod tests {
|
||||
url: Some("https://example.com/mcp".into()),
|
||||
headers: vec![McpKeyValue { name: "Authorization".into(), value: "Bearer secret".into() }],
|
||||
agents: vec!["claude".into()],
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1058,6 +1058,14 @@ pub struct McpServer {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional)]
|
||||
pub plugin_name: Option<String>,
|
||||
/// Canonical MCP registry server identifier when installed from an MCP registry.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional)]
|
||||
pub registry_name: Option<String>,
|
||||
/// Normalized MCP registry base URL when installed from an MCP registry.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional)]
|
||||
pub registry_url: Option<String>,
|
||||
}
|
||||
|
||||
/// Payload for creating or updating a user or workspace MCP server.
|
||||
@@ -1084,6 +1092,14 @@ pub struct McpServerInput {
|
||||
/// Agent provider ids this server is enabled for; empty means enabled for all agents.
|
||||
#[serde(default)]
|
||||
pub agents: Vec<String>,
|
||||
/// Canonical MCP registry server identifier when installed from an MCP registry.
|
||||
#[serde(default)]
|
||||
#[specta(optional)]
|
||||
pub registry_name: Option<String>,
|
||||
/// Normalized MCP registry base URL when installed from an MCP registry.
|
||||
#[serde(default)]
|
||||
#[specta(optional)]
|
||||
pub registry_url: Option<String>,
|
||||
}
|
||||
|
||||
fn default_true() -> bool {
|
||||
|
||||
@@ -1461,6 +1461,8 @@ pub fn projected_mcp_servers(
|
||||
unapproved: false,
|
||||
plugin_id: Some(state.plugin.id.clone()),
|
||||
plugin_name: Some(state.plugin.display_name.clone()),
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6366,6 +6366,8 @@ async fn per_session_mcp_overrides_filter_session_and_reload_when_idle() {
|
||||
unapproved: false,
|
||||
plugin_id: None,
|
||||
plugin_name: None,
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
},
|
||||
McpServer {
|
||||
id: "user::slack".into(),
|
||||
@@ -6382,6 +6384,8 @@ async fn per_session_mcp_overrides_filter_session_and_reload_when_idle() {
|
||||
unapproved: false,
|
||||
plugin_id: None,
|
||||
plugin_name: None,
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
},
|
||||
]
|
||||
}));
|
||||
|
||||
@@ -162,6 +162,9 @@ pub struct AgentSettings {
|
||||
#[serde(deserialize_with = "or_default")]
|
||||
#[specta(type = BTreeMap<String, AgentMcpServer>)]
|
||||
pub mcp_servers: BTreeMap<String, AgentMcpServer>,
|
||||
/// Custom MCP Registry base URL (`agents.mcpRegistryUrl`); empty = GitHub MCP Registry.
|
||||
#[serde(default, skip_serializing_if = "String::is_empty")]
|
||||
pub mcp_registry_url: String,
|
||||
/// How agent skills may run, keyed by skill name (`[agents.skills.<name>]`); `SKILL.md`
|
||||
/// files on disk are never modified.
|
||||
#[serde(deserialize_with = "or_default")]
|
||||
@@ -211,6 +214,7 @@ impl Default for AgentSettings {
|
||||
confirm_terminate_on_close: true,
|
||||
defaults: BTreeMap::new(),
|
||||
mcp_servers: BTreeMap::new(),
|
||||
mcp_registry_url: String::new(),
|
||||
skills: BTreeMap::new(),
|
||||
memory: AgentMemorySettings::default(),
|
||||
plugins: AgentPluginSettings::default(),
|
||||
@@ -253,6 +257,14 @@ pub struct AgentMcpServer {
|
||||
/// empty means enabled for all agents.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub agents: Vec<String>,
|
||||
/// Canonical MCP registry server identifier (e.g. `microsoft/playwright-mcp`) when installed from a registry.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional)]
|
||||
pub registry_name: Option<String>,
|
||||
/// Normalized MCP registry base URL (e.g. `https://api.mcp.github.com`) when installed from a registry.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[specta(optional)]
|
||||
pub registry_url: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for AgentMcpServer {
|
||||
@@ -266,6 +278,8 @@ impl Default for AgentMcpServer {
|
||||
url: None,
|
||||
headers: BTreeMap::new(),
|
||||
agents: Vec::new(),
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ use ide_agent::{
|
||||
AgentQueued, AgentRecoveryReport, AgentSkillMode, AgentSkillPolicy, AgentSkillState, AgentTask, AutoMemoryMode,
|
||||
AutomationRun, AutomationRunsPage, AutomationSnapshot, AutomationTrigger, AutomationWorkspace, CopilotAuthStatus,
|
||||
CreateAgentMemoryInput, CreateSessionScheduleInput, CustomAgentInput, ExternalSession, InstallAgentPluginRequest,
|
||||
InstallRemoteSkillRequest, Isolation, LoginLaunch, McpExternalSource, McpImportSelection, McpProbeResult, McpScope,
|
||||
McpServer, McpServerInput, McpTransport, NewAgentTask, PromoteAgentMemoryInput, RemoteSkillBrowseResult,
|
||||
RemoteSkillPreview, SaveAutomationInput, SessionSchedule, SkillsPolicy,
|
||||
InstallRemoteSkillRequest, Isolation, LoginLaunch, McpExternalSource, McpImportSelection, McpProbeResult,
|
||||
McpRegistryPage, McpScope, McpServer, McpServerInput, McpTransport, NewAgentTask, PromoteAgentMemoryInput,
|
||||
RemoteSkillBrowseResult, RemoteSkillPreview, SaveAutomationInput, SessionSchedule, SkillsPolicy,
|
||||
};
|
||||
use ide_command::command;
|
||||
use ide_core::error::ErrorKind;
|
||||
@@ -1205,6 +1205,42 @@ pub async fn agent_mcp_import_selected(
|
||||
})
|
||||
}
|
||||
|
||||
/// Searches or lists MCP servers from an open MCP Registry (`v0.1` / `v0`).
|
||||
/// When `registry_url` is omitted or blank, uses `agents.mcpRegistryUrl` or GitHub's MCP Registry.
|
||||
#[command(trust = always)]
|
||||
pub async fn agent_mcp_registry_search(
|
||||
host: &Host,
|
||||
registry_url: Option<String>,
|
||||
query: Option<String>,
|
||||
cursor: Option<String>,
|
||||
limit: Option<u32>,
|
||||
request: RequestId,
|
||||
) -> IdeResult<McpRegistryPage> {
|
||||
let effective_url =
|
||||
registry_url.as_deref().map(str::trim).filter(|s| !s.is_empty()).map(str::to_owned).or_else(|| {
|
||||
let configured = host.global_settings.effective().agents.mcp_registry_url;
|
||||
let trimmed = configured.trim();
|
||||
(!trimmed.is_empty()).then(|| trimmed.to_owned())
|
||||
});
|
||||
let cancel = host.begin_request(request);
|
||||
let search_path = ide_core::tool_path::search_path();
|
||||
let res = blocking(move || {
|
||||
let fetcher = ide_agent::mcp_registry::HttpMcpRegistryFetcher::new(&search_path)?;
|
||||
ide_agent::mcp_registry::search_registry(
|
||||
&fetcher,
|
||||
effective_url.as_deref(),
|
||||
query.as_deref(),
|
||||
cursor.as_deref(),
|
||||
limit,
|
||||
&search_path,
|
||||
&cancel,
|
||||
)
|
||||
})
|
||||
.await;
|
||||
host.end_request(request);
|
||||
res
|
||||
}
|
||||
|
||||
/// Tests an MCP server by connecting (`initialize`) and listing its tools (`tools/list`).
|
||||
#[command(trust = trusted)]
|
||||
pub async fn agent_mcp_test(host: &Host, window: &str, id: String) -> IdeResult<McpProbeResult> {
|
||||
@@ -2888,6 +2924,7 @@ ide_command::domain!(
|
||||
agent_mcp_import,
|
||||
agent_mcp_import_selected,
|
||||
agent_mcp_list,
|
||||
agent_mcp_registry_search,
|
||||
agent_mcp_remove,
|
||||
agent_mcp_save,
|
||||
agent_mcp_save_json,
|
||||
|
||||
@@ -6,8 +6,8 @@ use ide_agent::{McpScope, McpServer, McpServerInput};
|
||||
use ide_core::settings::McpTransport;
|
||||
use ide_host::Host;
|
||||
use ide_host::ops::agent::{
|
||||
agent_mcp_import as mcp_import, agent_mcp_list as mcp_list, agent_mcp_save as mcp_save,
|
||||
agent_mcp_set_enabled as mcp_set_enabled,
|
||||
agent_mcp_import as mcp_import, agent_mcp_list as mcp_list, agent_mcp_remove as mcp_remove,
|
||||
agent_mcp_save as mcp_save, agent_mcp_set_enabled as mcp_set_enabled,
|
||||
};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
@@ -58,6 +58,8 @@ async fn workspace_servers_from_the_project_file_stay_off_until_the_user_turns_t
|
||||
url: None,
|
||||
headers: vec![],
|
||||
agents: vec![],
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
@@ -69,3 +71,64 @@ async fn workspace_servers_from_the_project_file_stay_off_until_the_user_turns_t
|
||||
assert!(!enabled(&imported, "workspace::imported"));
|
||||
assert!(enabled(&imported, "workspace::mine"));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn registry_provenance_round_trips_survives_edit_and_uninstalls_cleanly() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let (host, _root) = open(tmp.path());
|
||||
|
||||
// Install from registry into User scope.
|
||||
let saved = mcp_save(
|
||||
&host,
|
||||
"main",
|
||||
McpServerInput {
|
||||
id: None,
|
||||
name: "playwright-mcp".into(),
|
||||
scope: McpScope::User,
|
||||
transport: McpTransport::Stdio,
|
||||
enabled: true,
|
||||
command: Some("npx".into()),
|
||||
args: vec!["-y".into(), "@playwright/mcp".into()],
|
||||
env: vec![],
|
||||
url: None,
|
||||
headers: vec![],
|
||||
agents: vec![],
|
||||
registry_name: Some("microsoft/playwright-mcp".into()),
|
||||
registry_url: Some("https://api.mcp.github.com".into()),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
let installed = saved.iter().find(|s| s.id == "user::playwright-mcp").expect("installed server present");
|
||||
assert_eq!(installed.registry_name.as_deref(), Some("microsoft/playwright-mcp"));
|
||||
assert_eq!(installed.registry_url.as_deref(), Some("https://api.mcp.github.com"));
|
||||
|
||||
// Updating the server without re-sending registry fields preserves provenance.
|
||||
let edited = mcp_save(
|
||||
&host,
|
||||
"main",
|
||||
McpServerInput {
|
||||
id: Some("user::playwright-mcp".into()),
|
||||
name: "playwright-mcp".into(),
|
||||
scope: McpScope::User,
|
||||
transport: McpTransport::Stdio,
|
||||
enabled: true,
|
||||
command: Some("npx".into()),
|
||||
args: vec!["-y".into(), "@playwright/mcp".into(), "--headless".into()],
|
||||
env: vec![],
|
||||
url: None,
|
||||
headers: vec![],
|
||||
agents: vec!["copilot".into()],
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
let after_edit = edited.iter().find(|s| s.id == "user::playwright-mcp").expect("edited server present");
|
||||
assert_eq!(after_edit.registry_name.as_deref(), Some("microsoft/playwright-mcp"));
|
||||
assert_eq!(after_edit.registry_url.as_deref(), Some("https://api.mcp.github.com"));
|
||||
assert_eq!(after_edit.agents, vec!["copilot"]);
|
||||
|
||||
// One-click uninstall removes the server cleanly.
|
||||
let after_remove = mcp_remove(&host, "main", "user::playwright-mcp".into()).unwrap();
|
||||
assert!(!after_remove.iter().any(|s| s.id == "user::playwright-mcp"));
|
||||
}
|
||||
@@ -46,6 +46,8 @@ fn input(name: &str, scope: McpScope) -> McpServerInput {
|
||||
url: Some("https://mcp.example/v1".into()),
|
||||
headers: vec![McpKeyValue { name: "Authorization".into(), value: format!("Bearer {VALUE}") }],
|
||||
agents: vec![],
|
||||
registry_name: None,
|
||||
registry_url: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+307
-1
@@ -4,7 +4,9 @@ import type {
|
||||
AgentTask,
|
||||
McpExternalSource,
|
||||
McpProbeResult,
|
||||
McpRegistryPage,
|
||||
McpServer,
|
||||
McpServerInput,
|
||||
} from "../src/bindings";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
@@ -359,7 +361,7 @@ test("manages multi-level MCP servers in Settings and per-session overrides via
|
||||
|
||||
if (screenshotDir) {
|
||||
await settingsDialog.screenshot({ path: `${screenshotDir}/mcp-hub-levels.png` });
|
||||
await settingsDialog.getByRole("button", { name: "More Actions" }).click();
|
||||
await settingsDialog.getByRole("button", { name: "More Actions", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "Add from JSON…" }).click();
|
||||
const addDialog = page.getByRole("dialog", { name: "Add MCP Server" });
|
||||
await expect(addDialog).toBeVisible();
|
||||
@@ -380,3 +382,307 @@ test("manages multi-level MCP servers in Settings and per-session overrides via
|
||||
await settingsDialog.getByRole("button", { name: "Import Selected (1)" }).click();
|
||||
await expect(settingsDialog.getByText("Imported 1 MCP servers into Global settings.")).toBeVisible();
|
||||
});
|
||||
|
||||
const svgDataIcon = (bg: string, label: string) =>
|
||||
`data:image/svg+xml,${encodeURIComponent(
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="6" fill="${bg}"/><text x="16" y="21" text-anchor="middle" fill="#fff" font-family="system-ui,sans-serif" font-size="14" font-weight="700">${label}</text></svg>`,
|
||||
)}`;
|
||||
|
||||
const registryPage: McpRegistryPage = {
|
||||
registryUrl: "https://api.mcp.github.com",
|
||||
total: 981,
|
||||
nextCursor: "cursor-page-2",
|
||||
servers: [
|
||||
{
|
||||
name: "microsoft/playwright-mcp",
|
||||
displayName: "Playwright MCP",
|
||||
suggestedName: "playwright-mcp",
|
||||
description: "Automate web browsers using accessibility trees for testing and data extraction.",
|
||||
version: "0.0.1-seed",
|
||||
publisher: "microsoft",
|
||||
iconUrl: svgDataIcon("#2EAD33", "PW"),
|
||||
iconDarkUrl: null,
|
||||
repositoryUrl: "https://github.com/microsoft/playwright-mcp",
|
||||
websiteUrl: null,
|
||||
license: "Apache-2.0",
|
||||
stars: 40441,
|
||||
installOptions: [
|
||||
{
|
||||
id: "pkg:0",
|
||||
label: "npm (npx)",
|
||||
transport: "stdio",
|
||||
registryType: "npm",
|
||||
packageIdentifier: "@playwright/mcp",
|
||||
command: "npx",
|
||||
args: ["-y", "@playwright/mcp"],
|
||||
url: null,
|
||||
headers: [],
|
||||
inputs: [],
|
||||
runtimeAvailable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "io.github.netdata/mcp-server",
|
||||
displayName: "Netdata",
|
||||
suggestedName: "netdata",
|
||||
description: "Real-time infrastructure monitoring with metrics, logs, alerts, and ML-based anomaly detection.",
|
||||
version: "2.13.0",
|
||||
publisher: "netdata",
|
||||
iconUrl: svgDataIcon("#00AB44", "ND"),
|
||||
iconDarkUrl: null,
|
||||
repositoryUrl: "https://github.com/netdata/netdata",
|
||||
websiteUrl: "https://www.netdata.cloud",
|
||||
license: "GPL-3.0",
|
||||
stars: 74200,
|
||||
installOptions: [
|
||||
{
|
||||
id: "remote:0",
|
||||
label: "Streamable HTTP",
|
||||
transport: "http",
|
||||
registryType: "streamable-http",
|
||||
packageIdentifier: null,
|
||||
command: null,
|
||||
args: [],
|
||||
url: "https://app.netdata.cloud/api/v1/mcp",
|
||||
headers: [{ name: "Authorization", value: "Bearer {NETDATA_CLOUD_API_TOKEN}" }],
|
||||
inputs: [
|
||||
{
|
||||
key: "header:Authorization:NETDATA_CLOUD_API_TOKEN",
|
||||
label: "NETDATA_CLOUD_API_TOKEN",
|
||||
kind: "header",
|
||||
description: "Netdata Cloud API token with scope:mcp",
|
||||
required: true,
|
||||
secret: true,
|
||||
defaultValue: null,
|
||||
placeholder: null,
|
||||
choices: [],
|
||||
headerName: "Authorization",
|
||||
flag: null,
|
||||
templateToken: "{NETDATA_CLOUD_API_TOKEN}",
|
||||
},
|
||||
],
|
||||
runtimeAvailable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "microsoft/markitdown",
|
||||
displayName: "MarkItDown",
|
||||
suggestedName: "markitdown",
|
||||
description: "Convert various file formats (PDF, Word, Excel, images, audio) to Markdown.",
|
||||
version: "1.0.0",
|
||||
publisher: "microsoft",
|
||||
iconUrl: svgDataIcon("#0078D4", "MD"),
|
||||
iconDarkUrl: null,
|
||||
repositoryUrl: "https://github.com/microsoft/markitdown",
|
||||
websiteUrl: null,
|
||||
license: "MIT License",
|
||||
stars: 199509,
|
||||
installOptions: [
|
||||
{
|
||||
id: "pkg:0",
|
||||
label: "PyPI (uvx)",
|
||||
transport: "stdio",
|
||||
registryType: "pypi",
|
||||
packageIdentifier: "markitdown-mcp",
|
||||
command: "uvx",
|
||||
args: ["markitdown-mcp==0.0.1a4"],
|
||||
url: null,
|
||||
headers: [],
|
||||
inputs: [],
|
||||
runtimeAvailable: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
...Array.from({ length: 10 }, (_, idx) => ({
|
||||
name: `io.example/demo-server-${idx + 1}`,
|
||||
displayName: `Demo Server ${idx + 1}`,
|
||||
suggestedName: `demo-server-${idx + 1}`,
|
||||
description: `Sample MCP server ${idx + 1} for scrollable registry listing.`,
|
||||
version: "1.0.0",
|
||||
publisher: "example",
|
||||
iconUrl: idx % 2 === 0 ? svgDataIcon("#5B6AE0", `S${idx + 1}`) : null,
|
||||
iconDarkUrl: null,
|
||||
repositoryUrl: null,
|
||||
websiteUrl: null,
|
||||
license: "MIT",
|
||||
stars: 100 - idx,
|
||||
installOptions: [
|
||||
{
|
||||
id: "remote:0",
|
||||
label: "Streamable HTTP",
|
||||
transport: "http" as const,
|
||||
registryType: "streamable-http",
|
||||
packageIdentifier: null,
|
||||
command: null,
|
||||
args: [],
|
||||
url: `https://demo-${idx + 1}.example.com/mcp`,
|
||||
headers: [],
|
||||
inputs: [],
|
||||
runtimeAvailable: true,
|
||||
},
|
||||
],
|
||||
})),
|
||||
],
|
||||
};
|
||||
|
||||
const registryPage2: McpRegistryPage = {
|
||||
registryUrl: "https://api.mcp.github.com",
|
||||
total: 981,
|
||||
nextCursor: null,
|
||||
servers: [
|
||||
{
|
||||
name: "upstash/context7",
|
||||
displayName: "Context7 MCP",
|
||||
suggestedName: "context7",
|
||||
description: "Up-to-date documentation and code examples for any library.",
|
||||
version: "1.0.12",
|
||||
publisher: "upstash",
|
||||
iconUrl: svgDataIcon("#00B87C", "C7"),
|
||||
iconDarkUrl: null,
|
||||
repositoryUrl: "https://github.com/upstash/context7",
|
||||
websiteUrl: null,
|
||||
license: "MIT",
|
||||
stars: 35200,
|
||||
installOptions: [
|
||||
{
|
||||
id: "pkg:0",
|
||||
label: "npm (npx)",
|
||||
transport: "stdio",
|
||||
registryType: "npm",
|
||||
packageIdentifier: "@upstash/context7-mcp",
|
||||
command: "npx",
|
||||
args: ["-y", "@upstash/context7-mcp"],
|
||||
url: null,
|
||||
headers: [],
|
||||
inputs: [],
|
||||
runtimeAvailable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
test("browses the MCP Registry with infinite scroll and performs one-click install and uninstall", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1180, height: 800 });
|
||||
await stubDesktop(page);
|
||||
|
||||
await page.evaluate(
|
||||
async ({ initialServers, registryPage, registryPage2 }) => {
|
||||
let servers = structuredClone(initialServers);
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.window_open_settings = () => {
|
||||
throw { kind: "unavailable", message: "separate settings window disabled in browser test", detail: null };
|
||||
};
|
||||
handlers.agent_mcp_list = () => servers;
|
||||
handlers.agent_mcp_discover_sources = () => [];
|
||||
handlers.agent_mcp_registry_search = ({ query, cursor }) => {
|
||||
if (cursor === "cursor-page-2") {
|
||||
return registryPage2;
|
||||
}
|
||||
const q = String(query ?? "")
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
return {
|
||||
...registryPage,
|
||||
servers: q
|
||||
? registryPage.servers.filter(
|
||||
(s) => s.displayName.toLowerCase().includes(q) || s.name.toLowerCase().includes(q),
|
||||
)
|
||||
: registryPage.servers,
|
||||
nextCursor: q ? null : registryPage.nextCursor,
|
||||
};
|
||||
};
|
||||
handlers.agent_mcp_save = ({ input }) => {
|
||||
const req = input as McpServerInput;
|
||||
const id = `${req.scope}::${req.name}`;
|
||||
servers = [
|
||||
...servers.filter((s) => s.id !== id),
|
||||
{
|
||||
id,
|
||||
name: req.name,
|
||||
scope: req.scope,
|
||||
transport: req.transport,
|
||||
enabled: req.enabled ?? true,
|
||||
command: req.command ?? null,
|
||||
args: req.args ?? [],
|
||||
env: req.env ?? [],
|
||||
url: req.url ?? null,
|
||||
headers: req.headers ?? [],
|
||||
agents: req.agents ?? [],
|
||||
unapproved: false,
|
||||
registryName: req.registryName ?? null,
|
||||
registryUrl: req.registryUrl ?? null,
|
||||
},
|
||||
];
|
||||
return servers;
|
||||
};
|
||||
handlers.agent_mcp_remove = ({ id }) => {
|
||||
servers = servers.filter((s) => s.id !== id);
|
||||
return servers;
|
||||
};
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction("file.settings", "agents.mcpServers");
|
||||
},
|
||||
{ initialServers, registryPage, registryPage2 },
|
||||
);
|
||||
|
||||
const settingsDialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await expect(settingsDialog).toBeVisible();
|
||||
await settingsDialog.getByRole("tab", { name: "Browse", exact: true }).click();
|
||||
await expect(settingsDialog.getByText("Playwright MCP", { exact: true })).toBeVisible();
|
||||
await expect(settingsDialog.getByText("Netdata", { exact: true })).toBeVisible();
|
||||
await expect(settingsDialog.getByText("Needs uvx", { exact: true })).toBeVisible();
|
||||
await expect(settingsDialog.getByRole("button", { name: "Load More" })).toHaveCount(0);
|
||||
await expect(settingsDialog.getByText("Context7 MCP", { exact: true })).toHaveCount(0);
|
||||
|
||||
const screenshotDir = process.env.CAPTURE_MCP_SCREENSHOTS;
|
||||
if (screenshotDir) {
|
||||
await settingsDialog.screenshot({ path: `${screenshotDir}/mcp-browse-light.png`, animations: "disabled" });
|
||||
}
|
||||
|
||||
// One-click install Playwright MCP.
|
||||
const pwRow = settingsDialog.getByRole("listitem").filter({ hasText: "Playwright MCP" });
|
||||
await pwRow.getByRole("button", { name: "Install", exact: true }).click();
|
||||
await expect(pwRow.getByText("Installed")).toBeVisible();
|
||||
await expect(pwRow.getByRole("button", { name: "Uninstall", exact: true })).toBeVisible();
|
||||
|
||||
if (screenshotDir) {
|
||||
await settingsDialog.screenshot({
|
||||
path: `${screenshotDir}/mcp-browse-installed-light.png`,
|
||||
animations: "disabled",
|
||||
});
|
||||
|
||||
// Open Install dialog for Netdata (required secret header).
|
||||
const ndRow = settingsDialog.getByRole("listitem").filter({ hasText: "Netdata" });
|
||||
await ndRow.getByRole("button", { name: "Install…" }).click();
|
||||
const installDlg = page.getByRole("dialog", { name: "Install MCP Server — Netdata" });
|
||||
await expect(installDlg).toBeVisible();
|
||||
await installDlg.screenshot({
|
||||
path: `${screenshotDir}/mcp-browse-install-dialog-light.png`,
|
||||
animations: "disabled",
|
||||
});
|
||||
await installDlg.getByRole("button", { name: "Cancel" }).click();
|
||||
|
||||
// Dark theme screenshot.
|
||||
await page.evaluate(async () => {
|
||||
const themePath = "/src/workbench/theme.ts";
|
||||
const { setTheme } = await import(/* @vite-ignore */ themePath);
|
||||
await setTheme("dark");
|
||||
});
|
||||
await settingsDialog.screenshot({ path: `${screenshotDir}/mcp-browse-dark.png`, animations: "disabled" });
|
||||
}
|
||||
|
||||
// One-click uninstall Playwright MCP.
|
||||
await pwRow.getByRole("button", { name: "Uninstall", exact: true }).click();
|
||||
await expect(pwRow.getByRole("button", { name: "Install", exact: true })).toBeVisible();
|
||||
|
||||
// Scroll to the bottom to trigger pageless infinite scroll automatically.
|
||||
await settingsDialog.getByTestId("mcp-registry-sentinel").scrollIntoViewIfNeeded();
|
||||
await expect(settingsDialog.getByText("Context7 MCP", { exact: true })).toBeVisible();
|
||||
await expect(settingsDialog.getByTestId("mcp-registry-sentinel")).toHaveCount(0);
|
||||
});
|
||||
@@ -43,6 +43,7 @@ agent_mcp_discover_sources always project_host bin
|
||||
agent_mcp_import always project_host bindings sync
|
||||
agent_mcp_import_selected always project_host bindings async
|
||||
agent_mcp_list always project_host bindings sync
|
||||
agent_mcp_registry_search always project_host bindings async
|
||||
agent_mcp_remove always project_host bindings sync
|
||||
agent_mcp_save always project_host bindings sync
|
||||
agent_mcp_save_json always project_host bindings sync
|
||||
|
||||
@@ -124,6 +124,11 @@ export const commands = {
|
||||
agentMcpImportSelected: (scope: McpScope, selections: McpImportSelection[], overwrite: boolean) => typedError<McpServer_Serialize[], IdeError>(__TAURI_INVOKE("agent_mcp_import_selected", { scope, selections, overwrite })),
|
||||
/** Lists configured and discovered MCP servers across User, Workspace, Plugin, and Built-In scopes. */
|
||||
agentMcpList: () => typedError<McpServer_Serialize[], IdeError>(__TAURI_INVOKE("agent_mcp_list")),
|
||||
/**
|
||||
* Searches or lists MCP servers from an open MCP Registry (`v0.1` / `v0`).
|
||||
* When `registry_url` is omitted or blank, uses `agents.mcpRegistryUrl` or GitHub's MCP Registry.
|
||||
*/
|
||||
agentMcpRegistrySearch: (registryUrl: string | null, query: string | null, cursor: string | null, limit: number | null, request: RequestId) => typedError<McpRegistryPage, IdeError>(__TAURI_INVOKE("agent_mcp_registry_search", { registryUrl, query, cursor, limit, request })),
|
||||
/** Removes a User or Workspace MCP server and returns the updated list. */
|
||||
agentMcpRemove: (id: string) => typedError<McpServer_Serialize[], IdeError>(__TAURI_INVOKE("agent_mcp_remove", { id })),
|
||||
/** Creates or updates a User or Workspace MCP server and returns the updated list. */
|
||||
@@ -3787,6 +3792,10 @@ export type AgentMcpServer_Deserialize = {
|
||||
* empty means enabled for all agents.
|
||||
*/
|
||||
agents?: string[],
|
||||
/** Canonical MCP registry server identifier (e.g. `microsoft/playwright-mcp`) when installed from a registry. */
|
||||
registryName?: string | null,
|
||||
/** Normalized MCP registry base URL (e.g. `https://api.mcp.github.com`) when installed from a registry. */
|
||||
registryUrl?: string | null,
|
||||
};
|
||||
|
||||
/** An MCP server passed to coding agents in `session/new`, `session/load` and `session/fork`. */
|
||||
@@ -3803,6 +3812,10 @@ export type AgentMcpServer_Serialize = {
|
||||
* empty means enabled for all agents.
|
||||
*/
|
||||
agents?: string[],
|
||||
/** Canonical MCP registry server identifier (e.g. `microsoft/playwright-mcp`) when installed from a registry. */
|
||||
registryName?: string | null,
|
||||
/** Normalized MCP registry base URL (e.g. `https://api.mcp.github.com`) when installed from a registry. */
|
||||
registryUrl?: string | null,
|
||||
};
|
||||
|
||||
/** Full catalog returned to Settings › Agents › Memory and the Composer `MemoryPicker`. */
|
||||
@@ -4680,6 +4693,8 @@ export type AgentSettings_Deserialize = {
|
||||
* keyed by server name (`[agents.mcpServers.<name>]`).
|
||||
*/
|
||||
mcpServers?: { [key in string]: AgentMcpServer_Deserialize },
|
||||
/** Custom MCP Registry base URL (`agents.mcpRegistryUrl`); empty = GitHub MCP Registry. */
|
||||
mcpRegistryUrl?: string,
|
||||
/**
|
||||
* How agent skills may run, keyed by skill name (`[agents.skills.<name>]`); `SKILL.md`
|
||||
* files on disk are never modified.
|
||||
@@ -4764,6 +4779,8 @@ export type AgentSettings_Serialize = {
|
||||
* keyed by server name (`[agents.mcpServers.<name>]`).
|
||||
*/
|
||||
mcpServers: { [key in string]: AgentMcpServer_Serialize },
|
||||
/** Custom MCP Registry base URL (`agents.mcpRegistryUrl`); empty = GitHub MCP Registry. */
|
||||
mcpRegistryUrl?: string,
|
||||
/**
|
||||
* How agent skills may run, keyed by skill name (`[agents.skills.<name>]`); `SKILL.md`
|
||||
* files on disk are never modified.
|
||||
@@ -12931,6 +12948,89 @@ export type McpProbeResult = {
|
||||
error: string | null,
|
||||
};
|
||||
|
||||
/** One configurable input declared by an MCP registry package or remote endpoint. */
|
||||
export type McpRegistryInputField = {
|
||||
/** Stable key unique within its install option. */
|
||||
key: string,
|
||||
/** Short display label (env var name, header name, or variable identifier). */
|
||||
label: string,
|
||||
kind: McpRegistryInputKind,
|
||||
description: string | null,
|
||||
required: boolean,
|
||||
secret: boolean,
|
||||
defaultValue: string | null,
|
||||
placeholder: string | null,
|
||||
choices: string[],
|
||||
/** Target HTTP header name when `kind == Header`. */
|
||||
headerName: string | null,
|
||||
/** Target CLI flag (e.g. `--dir`) when `kind == Arg` and the argument is appended dynamically. */
|
||||
flag: string | null,
|
||||
/** Literal placeholder token (e.g. `{region}`) to substitute in `url`, `headers`, or `args`. */
|
||||
templateToken: string | null,
|
||||
};
|
||||
|
||||
/** Kind of user-supplied input required or optional when installing an MCP server from a registry. */
|
||||
export type McpRegistryInputKind =
|
||||
/** Environment variable passed to a stdio server (`env`). */
|
||||
"env" |
|
||||
/** HTTP header value or `{var}` placeholder inside an HTTP/SSE header. */
|
||||
"header" |
|
||||
/** `{var}` placeholder inside an HTTP/SSE endpoint URL. */
|
||||
"urlVar" |
|
||||
/** CLI argument value (named flag or positional argument) or `{var}` placeholder inside `args`. */
|
||||
"arg";
|
||||
|
||||
/** One concrete way to install and launch an MCP registry server (either a local package or a remote URL). */
|
||||
export type McpRegistryInstallOption = {
|
||||
id: string,
|
||||
/** Human-readable option label (e.g. `npm (npx)`, `PyPI (uvx)`, `Docker`, `Streamable HTTP`). */
|
||||
label: string,
|
||||
transport: McpTransport,
|
||||
/** Underlying registry type (`npm`, `pypi`, `oci`, `nuget`, `streamable-http`, `sse`). */
|
||||
registryType: string,
|
||||
packageIdentifier: string | null,
|
||||
command: string | null,
|
||||
args: string[],
|
||||
url: string | null,
|
||||
/** Pre-populated or templated HTTP headers (e.g. `Authorization: Bearer {TOKEN}`). */
|
||||
headers: McpKeyValue[],
|
||||
/** Declared env vars, header tokens, URL variables, and CLI arguments. */
|
||||
inputs: McpRegistryInputField[],
|
||||
/**
|
||||
* Whether the required local runtime binary (`npx`, `uvx`, `docker`, `dnx`…) is available on `PATH`.
|
||||
* Always `true` for remote HTTP/SSE endpoints.
|
||||
*/
|
||||
runtimeAvailable: boolean,
|
||||
};
|
||||
|
||||
/** Paginated response returned to Settings › Agents › MCP Connections › Browse. */
|
||||
export type McpRegistryPage = {
|
||||
registryUrl: string,
|
||||
servers: McpRegistryServer[],
|
||||
nextCursor: string | null,
|
||||
total: number | null,
|
||||
};
|
||||
|
||||
/** One MCP server returned by an MCP registry search or listing. */
|
||||
export type McpRegistryServer = {
|
||||
/** Canonical registry server identifier (e.g. `microsoft/playwright-mcp`). */
|
||||
name: string,
|
||||
/** Human-friendly display title. */
|
||||
displayName: string,
|
||||
/** Sanitized local configuration key suggestion (e.g. `playwright-mcp`). */
|
||||
suggestedName: string,
|
||||
description: string,
|
||||
version: string,
|
||||
publisher: string | null,
|
||||
iconUrl: string | null,
|
||||
iconDarkUrl: string | null,
|
||||
repositoryUrl: string | null,
|
||||
websiteUrl: string | null,
|
||||
license: string | null,
|
||||
stars: number | null,
|
||||
installOptions: McpRegistryInstallOption[],
|
||||
};
|
||||
|
||||
/** Where an MCP server configuration is stored (`settings.toml` vs `.openidea/settings.toml`). */
|
||||
export type McpScope = "user" | "workspace";
|
||||
|
||||
@@ -12951,6 +13051,10 @@ export type McpServerInput = {
|
||||
headers?: McpKeyValue[],
|
||||
/** Agent provider ids this server is enabled for; empty means enabled for all agents. */
|
||||
agents?: string[],
|
||||
/** Canonical MCP registry server identifier when installed from an MCP registry. */
|
||||
registryName?: string | null,
|
||||
/** Normalized MCP registry base URL when installed from an MCP registry. */
|
||||
registryUrl?: string | null,
|
||||
};
|
||||
|
||||
/** Agents › MCP Server: agents use the IDE's built-in tools. */
|
||||
@@ -13097,6 +13201,10 @@ export type McpServer_Deserialize = {
|
||||
pluginId?: string | null,
|
||||
/** Display name of the parent agent plugin. */
|
||||
pluginName?: string | null,
|
||||
/** Canonical MCP registry server identifier when installed from an MCP registry. */
|
||||
registryName?: string | null,
|
||||
/** Normalized MCP registry base URL when installed from an MCP registry. */
|
||||
registryUrl?: string | null,
|
||||
};
|
||||
|
||||
/** One configured Model Context Protocol (MCP) server. */
|
||||
@@ -13119,6 +13227,10 @@ export type McpServer_Serialize = {
|
||||
pluginId?: string | null,
|
||||
/** Display name of the parent agent plugin. */
|
||||
pluginName?: string | null,
|
||||
/** Canonical MCP registry server identifier when installed from an MCP registry. */
|
||||
registryName?: string | null,
|
||||
/** Normalized MCP registry base URL when installed from an MCP registry. */
|
||||
registryUrl?: string | null,
|
||||
};
|
||||
|
||||
/** One tool advertised by an MCP server during `tools/list`. */
|
||||
|
||||
@@ -218,6 +218,10 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.chipSep {
|
||||
color: var(--fg-faint);
|
||||
}
|
||||
|
||||
.dialogBody {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -114,10 +114,27 @@ function createMockBackend(initial: AgentPluginCatalog = SAMPLE_CATALOG) {
|
||||
const calls = {
|
||||
setEnabled: [] as Array<{ id: string; scope: McpScope; enabled: boolean; approve: boolean }>,
|
||||
install: [] as InstallAgentPluginRequest[],
|
||||
addMarketplace: [] as Array<{ scope: McpScope; source: string }>,
|
||||
browsed: [] as string[],
|
||||
};
|
||||
|
||||
const backend: PluginsBackend = {
|
||||
list: async () => structuredClone(state),
|
||||
addMarketplace: async (scope, source) => {
|
||||
calls.addMarketplace.push({ scope, source });
|
||||
state = {
|
||||
...state,
|
||||
marketplaces: [
|
||||
...state.marketplaces,
|
||||
{ id: source, name: source.split("/").pop() ?? source, source, scope, discovered: false },
|
||||
],
|
||||
};
|
||||
return structuredClone(state);
|
||||
},
|
||||
removeMarketplace: async (_scope, source) => {
|
||||
state = { ...state, marketplaces: state.marketplaces.filter((m) => m.source !== source) };
|
||||
return structuredClone(state);
|
||||
},
|
||||
setEnabled: async (id, scope, enabled, approveCapabilities = false) => {
|
||||
calls.setEnabled.push({ id, scope, enabled, approve: approveCapabilities });
|
||||
state = {
|
||||
@@ -135,27 +152,30 @@ function createMockBackend(initial: AgentPluginCatalog = SAMPLE_CATALOG) {
|
||||
};
|
||||
return structuredClone(state);
|
||||
},
|
||||
browseMarketplace: async (source) => ({
|
||||
source,
|
||||
marketplaceName: "acme-mkt",
|
||||
owner: "acme",
|
||||
repo: "plugins",
|
||||
gitRef: "main",
|
||||
treeSha: "1111111111111111111111111111111111111111",
|
||||
candidates: [
|
||||
{
|
||||
name: "k8s-ops",
|
||||
displayName: "k8s-ops",
|
||||
version: "2.1.0",
|
||||
description: "Kubernetes cluster diagnostics",
|
||||
marketplace: "acme-mkt",
|
||||
sourceSpec: "acme/plugins/k8s-ops#main",
|
||||
subpath: "k8s-ops",
|
||||
alreadyInstalledUser: false,
|
||||
alreadyInstalledWorkspace: false,
|
||||
},
|
||||
],
|
||||
}),
|
||||
browseMarketplace: async (source) => {
|
||||
calls.browsed.push(source);
|
||||
return {
|
||||
source,
|
||||
marketplaceName: "acme-mkt",
|
||||
owner: "acme",
|
||||
repo: "plugins",
|
||||
gitRef: "main",
|
||||
treeSha: "1111111111111111111111111111111111111111",
|
||||
candidates: [
|
||||
{
|
||||
name: "k8s-ops",
|
||||
displayName: "k8s-ops",
|
||||
version: "2.1.0",
|
||||
description: "Kubernetes cluster diagnostics",
|
||||
marketplace: "acme-mkt",
|
||||
sourceSpec: "acme/plugins/k8s-ops#main",
|
||||
subpath: "k8s-ops",
|
||||
alreadyInstalledUser: false,
|
||||
alreadyInstalledWorkspace: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
preview: async (): Promise<AgentPluginPreview> => ({
|
||||
sourceKind: "github",
|
||||
owner: "acme",
|
||||
@@ -312,4 +332,26 @@ describe("AgentPluginsPage", () => {
|
||||
confirmWarnings: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("offers unregistered suggested plugin marketplaces for one-click browse or add", async () => {
|
||||
const { backend, calls } = createMockBackend();
|
||||
render(<AgentPluginsPage backend={backend} />);
|
||||
|
||||
// `github/awesome-copilot` is already registered in SAMPLE_CATALOG, so only Claude Official Plugins is suggested.
|
||||
expect(await screen.findByText("Claude Official Plugins")).toBeInTheDocument();
|
||||
expect(screen.queryByText("Awesome Copilot")).toBeNull();
|
||||
|
||||
// Open Marketplaces dialog and add Claude Official Plugins in one click.
|
||||
fireEvent.click(screen.getByRole("button", { name: "Marketplaces (1)…" }));
|
||||
const dialog = await screen.findByRole("dialog", { name: "Plugin Marketplaces" });
|
||||
expect(within(dialog).getByText("Suggested Marketplaces")).toBeInTheDocument();
|
||||
const suggestedRow = within(dialog).getByText("Claude Official Plugins").closest("div")?.parentElement;
|
||||
expect(suggestedRow).not.toBeNull();
|
||||
fireEvent.click(within(suggestedRow!).getByRole("button", { name: "Add" }));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(calls.addMarketplace).toEqual([{ scope: "user", source: "anthropics/claude-plugins-official" }]),
|
||||
);
|
||||
await waitFor(() => expect(within(dialog).queryByText("Suggested Marketplaces")).toBeNull());
|
||||
});
|
||||
});
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
pluginFormatLabel,
|
||||
pluginGroupPath,
|
||||
pluginGroupTitle,
|
||||
unregisteredSuggestedMarketplaces,
|
||||
usePluginsCatalog,
|
||||
type PluginsBackend,
|
||||
} from "./pluginsModel";
|
||||
@@ -150,6 +151,11 @@ export function AgentPluginsPage({ backend = defaultPluginsBackend }: { backend?
|
||||
});
|
||||
}, [catalog.plugins, query, tab]);
|
||||
|
||||
const suggestedMarketplaces = useMemo(
|
||||
() => unregisteredSuggestedMarketplaces(catalog.marketplaces),
|
||||
[catalog.marketplaces],
|
||||
);
|
||||
|
||||
const grouped = useMemo(() => {
|
||||
const order = Object.keys(PLUGIN_SOURCE_GROUPS) as AgentPluginSource[];
|
||||
const out: Array<{ source: AgentPluginSource; scope: McpScope; items: AgentPluginState[]; key: string }> = [];
|
||||
@@ -246,7 +252,7 @@ export function AgentPluginsPage({ backend = defaultPluginsBackend }: { backend?
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{catalog.marketplaces.length > 0 && (
|
||||
{(catalog.marketplaces.length > 0 || (suggestedMarketplaces.length > 0 && backend.browseMarketplace)) && (
|
||||
<div className={styles.marketplaceRow}>
|
||||
<div className={styles.marketplaceChips}>
|
||||
{catalog.marketplaces.map((m) => (
|
||||
@@ -260,6 +266,35 @@ export function AgentPluginsPage({ backend = defaultPluginsBackend }: { backend?
|
||||
)}
|
||||
</span>
|
||||
))}
|
||||
{backend.browseMarketplace &&
|
||||
suggestedMarketplaces.map((preset) => (
|
||||
<span key={preset.id} className={styles.marketplaceChip} title={tx(preset.description)}>
|
||||
<span className={page.statusDot} />
|
||||
<span>{preset.name}</span>
|
||||
<button type="button" className={page.link} onClick={() => setInstallSourceInit(preset.source)}>
|
||||
<T>Browse</T>
|
||||
</button>
|
||||
{backend.addMarketplace && (
|
||||
<>
|
||||
<span className={styles.chipSep} aria-hidden="true">
|
||||
·
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
className={page.link}
|
||||
disabled={busyKey === `add-mkt:${preset.source}`}
|
||||
onClick={() =>
|
||||
void runMutation(`add-mkt:${preset.source}`, () =>
|
||||
backend.addMarketplace!("user", preset.source),
|
||||
)
|
||||
}
|
||||
>
|
||||
<T>Add</T>
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -755,14 +790,16 @@ function MarketplacesDialog({
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const add = async () => {
|
||||
if (!backend.addMarketplace || !source.trim()) return;
|
||||
const suggested = useMemo(() => unregisteredSuggestedMarketplaces(catalog.marketplaces), [catalog.marketplaces]);
|
||||
|
||||
const addSource = async (targetSource: string) => {
|
||||
if (!backend.addMarketplace || !targetSource.trim()) return;
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
const next = await backend.addMarketplace(scope, source.trim());
|
||||
const next = await backend.addMarketplace(scope, targetSource.trim());
|
||||
onUpdated(next);
|
||||
setSource("");
|
||||
if (targetSource === source) setSource("");
|
||||
} catch (e: unknown) {
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
@@ -770,6 +807,8 @@ function MarketplacesDialog({
|
||||
}
|
||||
};
|
||||
|
||||
const add = () => addSource(source);
|
||||
|
||||
const remove = async (mScope: McpScope, mSource: string) => {
|
||||
if (!backend.removeMarketplace) return;
|
||||
setBusy(true);
|
||||
@@ -844,6 +883,37 @@ function MarketplacesDialog({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{suggested.length > 0 && (
|
||||
<div className={styles.field}>
|
||||
<span className={styles.fieldLabel}>
|
||||
<T>Suggested Marketplaces</T>
|
||||
</span>
|
||||
<div className={styles.candidateList}>
|
||||
{suggested.map((preset) => (
|
||||
<div key={preset.id} className={styles.candidateRow}>
|
||||
<div className={styles.candidateMain}>
|
||||
<span className={styles.entryTitle}>{preset.name}</span>
|
||||
<span className={styles.codeLine}>{preset.source}</span>
|
||||
</div>
|
||||
<div className={styles.controls}>
|
||||
<Button size="small" onClick={() => onBrowse(preset.source)}>
|
||||
<T>Browse</T>
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
variant="primary"
|
||||
disabled={busy}
|
||||
onClick={() => void addSource(preset.source)}
|
||||
>
|
||||
<T>Add</T>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div className={page.error} role="alert">
|
||||
<Icon name="error" size={14} />
|
||||
|
||||
@@ -0,0 +1,972 @@
|
||||
/**
|
||||
* In-app MCP Registry browser (open MCP Registry v0.1 / v0 API) with one-click install &
|
||||
* uninstall, custom registry support, runtime availability hints, and secret input prompts.
|
||||
*/
|
||||
import clsx from "clsx";
|
||||
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
||||
import type {
|
||||
McpRegistryInputField,
|
||||
McpRegistryInstallOption,
|
||||
McpRegistryServer,
|
||||
McpScope,
|
||||
McpServer,
|
||||
McpServerInput,
|
||||
} from "@/bindings";
|
||||
import { formatMessage, useTx } from "@/platform/i18n";
|
||||
import { nextRequestId } from "@/platform/ipc";
|
||||
import { openExternalUrl } from "@/platform/openUrl";
|
||||
import { useProject } from "@/platform/project";
|
||||
import { Button, Dialog, Icon, IconButton, Input, Select, Spinner, T } from "@/ui";
|
||||
import {
|
||||
MCP_REGISTRY_PRESETS,
|
||||
canOneClickInstall,
|
||||
findInstalledRegistryServer,
|
||||
formatOptionPreview,
|
||||
formatStarCount,
|
||||
initialRegistryInputValues,
|
||||
normalizeRegistryBaseUrl,
|
||||
pickDefaultInstallOption,
|
||||
resolveRegistryInstallInput,
|
||||
type McpBackend,
|
||||
} from "./mcpModel";
|
||||
import { providerIcon } from "./model";
|
||||
import page from "./SettingsPage.module.css";
|
||||
import styles from "./McpServers.module.css";
|
||||
|
||||
const CUSTOM_REGISTRY_ID = "__custom__";
|
||||
const SEARCH_DEBOUNCE_MS = 250;
|
||||
const INFINITE_SCROLL_ROOT_MARGIN = "320px 0px";
|
||||
|
||||
function findScrollParent(el: HTMLElement): HTMLElement | null {
|
||||
let cur = el.parentElement;
|
||||
while (cur) {
|
||||
const { overflowY } = window.getComputedStyle(cur);
|
||||
if (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay") {
|
||||
return cur;
|
||||
}
|
||||
cur = cur.parentElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
backend: McpBackend;
|
||||
query: string;
|
||||
servers: readonly McpServer[];
|
||||
hasProject: boolean;
|
||||
agentOptions: ReadonlyArray<{ id: string; name: string }>;
|
||||
onInstalled: (next: McpServer[], serverName: string, scope: McpScope) => void;
|
||||
onUninstalled: (next: McpServer[], serverName: string) => void;
|
||||
}
|
||||
|
||||
export function McpRegistryBrowse({
|
||||
backend,
|
||||
query,
|
||||
servers,
|
||||
hasProject,
|
||||
agentOptions,
|
||||
onInstalled,
|
||||
onUninstalled,
|
||||
}: Props) {
|
||||
const tx = useTx();
|
||||
const configuredUrl = useProject((s) => s.settings?.agents?.mcpRegistryUrl ?? "");
|
||||
const initialRegistryUrl = normalizeRegistryBaseUrl(configuredUrl);
|
||||
const initialPreset = MCP_REGISTRY_PRESETS.find((p) => p.url === initialRegistryUrl);
|
||||
|
||||
const [selectedSource, setSelectedSource] = useState<string>(initialPreset ? initialPreset.url : CUSTOM_REGISTRY_ID);
|
||||
const [customUrlDraft, setCustomUrlDraft] = useState<string>(initialPreset ? "" : initialRegistryUrl);
|
||||
const [activeRegistryUrl, setActiveRegistryUrl] = useState<string>(initialRegistryUrl);
|
||||
const [installScope, setInstallScope] = useState<McpScope>("user");
|
||||
const effectiveScope: McpScope = hasProject ? installScope : "user";
|
||||
const [items, setItems] = useState<McpRegistryServer[]>([]);
|
||||
const [resolvedUrl, setResolvedUrl] = useState<string>(initialRegistryUrl);
|
||||
const [nextCursor, setNextCursor] = useState<string | null>(null);
|
||||
const [total, setTotal] = useState<number | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [loadingMore, setLoadingMore] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [loadMoreError, setLoadMoreError] = useState<string | null>(null);
|
||||
const [busyKey, setBusyKey] = useState<string | null>(null);
|
||||
const [expanded, setExpanded] = useState<Record<string, boolean>>({});
|
||||
const [configuring, setConfiguring] = useState<{
|
||||
entry: McpRegistryServer;
|
||||
optionId?: string;
|
||||
} | null>(null);
|
||||
const [savingRegistry, setSavingRegistry] = useState(false);
|
||||
|
||||
const activeReqRef = useRef<number | null>(null);
|
||||
const generationRef = useRef(0);
|
||||
const loadMoreInFlightRef = useRef(false);
|
||||
const sentinelRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
const cancelInFlight = useCallback(() => {
|
||||
if (activeReqRef.current !== null) {
|
||||
const prev = activeReqRef.current;
|
||||
activeReqRef.current = null;
|
||||
void backend.cancelRequest?.(prev);
|
||||
}
|
||||
}, [backend]);
|
||||
|
||||
const fetchPage = useCallback(
|
||||
async (registryUrl: string, searchText: string, cursor: string | null, append: boolean): Promise<string | null> => {
|
||||
if (!backend.searchRegistry) return null;
|
||||
cancelInFlight();
|
||||
const requestId = nextRequestId();
|
||||
activeReqRef.current = requestId;
|
||||
const gen = ++generationRef.current;
|
||||
|
||||
if (append) {
|
||||
setLoadingMore(true);
|
||||
setLoadMoreError(null);
|
||||
} else {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setLoadMoreError(null);
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await backend.searchRegistry({
|
||||
registryUrl,
|
||||
query: searchText.trim() || null,
|
||||
cursor,
|
||||
limit: 30,
|
||||
requestId,
|
||||
});
|
||||
if (generationRef.current !== gen) return null;
|
||||
setResolvedUrl(res.registryUrl);
|
||||
const returnedCursor = res.nextCursor ?? null;
|
||||
// Stop auto-paging if a registry repeats the same cursor.
|
||||
setNextCursor(append && returnedCursor === cursor ? null : returnedCursor);
|
||||
setTotal(res.total ?? null);
|
||||
setItems((prev) => {
|
||||
if (!append) return res.servers;
|
||||
const seen = new Set(prev.map((s) => s.name));
|
||||
return [...prev, ...res.servers.filter((s) => !seen.has(s.name))];
|
||||
});
|
||||
return res.registryUrl;
|
||||
} catch (e: unknown) {
|
||||
if (generationRef.current !== gen) return null;
|
||||
const message = e instanceof Error ? e.message : String(e);
|
||||
if (append) {
|
||||
setLoadMoreError(message);
|
||||
} else {
|
||||
setError(message);
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
if (generationRef.current === gen) {
|
||||
activeReqRef.current = null;
|
||||
setLoading(false);
|
||||
setLoadingMore(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
[backend, cancelInFlight],
|
||||
);
|
||||
|
||||
// Debounce search text changes; fetch immediately on initial mount or registry switch.
|
||||
const prevRegistryRef = useRef<string | null>(null);
|
||||
const skipNextFetchRef = useRef(false);
|
||||
useEffect(() => {
|
||||
if (skipNextFetchRef.current) {
|
||||
skipNextFetchRef.current = false;
|
||||
prevRegistryRef.current = activeRegistryUrl;
|
||||
return;
|
||||
}
|
||||
const registryChanged = prevRegistryRef.current !== activeRegistryUrl;
|
||||
prevRegistryRef.current = activeRegistryUrl;
|
||||
const delay = registryChanged || !query.trim() ? 0 : SEARCH_DEBOUNCE_MS;
|
||||
const timer = window.setTimeout(() => {
|
||||
void fetchPage(activeRegistryUrl, query, null, false);
|
||||
}, delay);
|
||||
return () => {
|
||||
window.clearTimeout(timer);
|
||||
};
|
||||
}, [activeRegistryUrl, query, fetchPage]);
|
||||
|
||||
useEffect(() => cancelInFlight, [cancelInFlight]);
|
||||
|
||||
// Pageless infinite scroll: prefetch the next page when the bottom sentinel nears view.
|
||||
useEffect(() => {
|
||||
if (!nextCursor || loading || loadingMore || loadMoreError) return;
|
||||
if (typeof IntersectionObserver === "undefined") return;
|
||||
const el = sentinelRef.current;
|
||||
if (!el) return;
|
||||
const root = findScrollParent(el);
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
if (!entries.some((entry) => entry.isIntersecting)) return;
|
||||
if (loadMoreInFlightRef.current) return;
|
||||
loadMoreInFlightRef.current = true;
|
||||
void fetchPage(activeRegistryUrl, query, nextCursor, true).finally(() => {
|
||||
loadMoreInFlightRef.current = false;
|
||||
});
|
||||
},
|
||||
{ root, rootMargin: INFINITE_SCROLL_ROOT_MARGIN },
|
||||
);
|
||||
observer.observe(el);
|
||||
return () => observer.disconnect();
|
||||
}, [activeRegistryUrl, query, nextCursor, loading, loadingMore, loadMoreError, fetchPage]);
|
||||
|
||||
const selectRegistrySource = (val: string) => {
|
||||
setSelectedSource(val);
|
||||
if (val !== CUSTOM_REGISTRY_ID) {
|
||||
setActiveRegistryUrl(val);
|
||||
void backend.saveRegistryUrl?.(val === MCP_REGISTRY_PRESETS[0].url ? "" : val);
|
||||
}
|
||||
};
|
||||
|
||||
const applyCustomRegistry = async () => {
|
||||
const clean = customUrlDraft.trim();
|
||||
if (!clean) return;
|
||||
setSavingRegistry(true);
|
||||
setError(null);
|
||||
try {
|
||||
const verifiedUrl = await fetchPage(clean, query, null, false);
|
||||
if (verifiedUrl) {
|
||||
skipNextFetchRef.current = true;
|
||||
setActiveRegistryUrl(verifiedUrl);
|
||||
setCustomUrlDraft(verifiedUrl);
|
||||
await backend.saveRegistryUrl?.(verifiedUrl);
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
setSavingRegistry(false);
|
||||
}
|
||||
};
|
||||
|
||||
const runDirectInstall = async (entry: McpRegistryServer, option: McpRegistryInstallOption) => {
|
||||
setBusyKey(entry.name);
|
||||
setError(null);
|
||||
try {
|
||||
const input = resolveRegistryInstallInput(entry, option, initialRegistryInputValues(option), {
|
||||
scope: effectiveScope,
|
||||
registryUrl: resolvedUrl,
|
||||
});
|
||||
const next = await backend.save(input);
|
||||
onInstalled(next, input.name, input.scope);
|
||||
} catch (e: unknown) {
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
setBusyKey(null);
|
||||
}
|
||||
};
|
||||
|
||||
const runUninstall = async (entry: McpRegistryServer, installed: McpServer) => {
|
||||
setBusyKey(entry.name);
|
||||
setError(null);
|
||||
try {
|
||||
const next = await backend.remove(installed.id);
|
||||
onUninstalled(next, installed.name);
|
||||
} catch (e: unknown) {
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
setBusyKey(null);
|
||||
}
|
||||
};
|
||||
|
||||
const registrySelectOptions = useMemo(
|
||||
() => [
|
||||
...MCP_REGISTRY_PRESETS.map((p) => ({ value: p.url, label: tx(p.label) })),
|
||||
{ value: CUSTOM_REGISTRY_ID, label: tx("Custom Registry…") },
|
||||
],
|
||||
[tx],
|
||||
);
|
||||
|
||||
const scopeOptions = useMemo(
|
||||
() => [
|
||||
{ value: "user", label: tx("Install to Global (settings.toml)") },
|
||||
...(hasProject ? [{ value: "workspace", label: tx("Install to Project (.openidea/settings.toml)") }] : []),
|
||||
],
|
||||
[hasProject, tx],
|
||||
);
|
||||
|
||||
if (!backend.searchRegistry) {
|
||||
return (
|
||||
<div className={page.emptyBox}>
|
||||
<T>MCP Registry browsing is unavailable in this environment.</T>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={page.sections}>
|
||||
<div className={styles.importToolbar}>
|
||||
<div className={styles.importControls}>
|
||||
<Select
|
||||
aria-label={tx("MCP registry source")}
|
||||
value={selectedSource}
|
||||
options={registrySelectOptions}
|
||||
onChange={selectRegistrySource}
|
||||
/>
|
||||
<Select
|
||||
aria-label={tx("Install target scope")}
|
||||
value={effectiveScope}
|
||||
options={scopeOptions}
|
||||
onChange={(v) => setInstallScope(v as McpScope)}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.importControls}>
|
||||
{total !== null && !loading && (
|
||||
<span className={styles.registryCount}>{formatMessage(tx("{count} servers"), { count: total })}</span>
|
||||
)}
|
||||
<IconButton
|
||||
icon="refresh"
|
||||
size="small"
|
||||
disabled={loading}
|
||||
title={tx("Refresh registry")}
|
||||
aria-label={tx("Refresh registry")}
|
||||
onClick={() => void fetchPage(activeRegistryUrl, query, null, false)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{selectedSource === CUSTOM_REGISTRY_ID && (
|
||||
<div className={styles.customRegistryBar}>
|
||||
<Input
|
||||
className={page.search}
|
||||
aria-label={tx("Custom MCP registry URL")}
|
||||
placeholder="https://registry.example.com"
|
||||
value={customUrlDraft}
|
||||
onChange={(e) => setCustomUrlDraft(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
void applyCustomRegistry();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
size="small"
|
||||
variant="primary"
|
||||
disabled={savingRegistry || !customUrlDraft.trim()}
|
||||
onClick={() => void applyCustomRegistry()}
|
||||
>
|
||||
<T>Use Registry</T>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div className={page.error} role="alert">
|
||||
<Icon name="error" size={14} />
|
||||
<span>{error}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{loading && items.length === 0 ? (
|
||||
<div className={styles.loadingRow}>
|
||||
<Spinner size={14} />
|
||||
<span>
|
||||
<T>Loading MCP registry…</T>
|
||||
</span>
|
||||
</div>
|
||||
) : items.length === 0 && !error ? (
|
||||
<div className={page.emptyBox}>
|
||||
{query.trim() ? (
|
||||
formatMessage(tx("No MCP servers matching “{query}”."), { query: query.trim() })
|
||||
) : (
|
||||
<T>No MCP servers found in this registry.</T>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className={page.sectionBody} role="list" aria-label={tx("MCP Registry servers")}>
|
||||
{items.map((entry) => {
|
||||
const installed = findInstalledRegistryServer(servers, entry, effectiveScope);
|
||||
const primaryOption = pickDefaultInstallOption(entry);
|
||||
const oneClick = canOneClickInstall(entry);
|
||||
const isBusy = busyKey === entry.name;
|
||||
const isExpanded = !!expanded[entry.name];
|
||||
const previewText = primaryOption ? formatOptionPreview(primaryOption) : null;
|
||||
|
||||
return (
|
||||
<div key={entry.name} role="listitem" className={page.card}>
|
||||
<div className={page.cardHeader}>
|
||||
<button
|
||||
type="button"
|
||||
className={clsx(page.cardExpandBtn, styles.registryExpandBtn)}
|
||||
aria-expanded={isExpanded}
|
||||
onClick={() => setExpanded((prev) => ({ ...prev, [entry.name]: !prev[entry.name] }))}
|
||||
>
|
||||
<Icon name={isExpanded ? "chevron-down" : "chevron-right"} size={13} className={page.chevron} />
|
||||
<McpRegistryIcon iconUrl={entry.iconUrl} iconDarkUrl={entry.iconDarkUrl} />
|
||||
<div className={page.cardMain}>
|
||||
<div className={page.cardTitleRow}>
|
||||
<span className={styles.serverName}>{entry.displayName}</span>
|
||||
{primaryOption && <span className={page.tag}>{primaryOption.transport.toUpperCase()}</span>}
|
||||
{entry.version && <span className={page.tag}>v{entry.version}</span>}
|
||||
{entry.stars != null && entry.stars > 0 && (
|
||||
<span
|
||||
className={page.tag}
|
||||
title={formatMessage(tx("{count} GitHub stars"), { count: entry.stars })}
|
||||
>
|
||||
<Icon name="star" size={11} />
|
||||
{formatStarCount(entry.stars)}
|
||||
</span>
|
||||
)}
|
||||
{installed && (
|
||||
<span className={clsx(page.tag, styles.tagSuccess)}>
|
||||
{installed.scope === "workspace" ? tx("Installed (Project)") : tx("Installed")}
|
||||
</span>
|
||||
)}
|
||||
{primaryOption && !primaryOption.runtimeAvailable && primaryOption.command && (
|
||||
<span className={clsx(page.tag, page.tagWarning)}>
|
||||
{formatMessage(tx("Needs {cmd}"), { cmd: primaryOption.command })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{entry.description && (
|
||||
<span className={styles.registryDesc} title={entry.description}>
|
||||
{entry.description}
|
||||
</span>
|
||||
)}
|
||||
{previewText && (
|
||||
<span className={styles.subtitle} title={previewText}>
|
||||
{previewText}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<div className={page.rowActions}>
|
||||
{installed ? (
|
||||
<Button size="small" disabled={isBusy} onClick={() => void runUninstall(entry, installed)}>
|
||||
<T>Uninstall</T>
|
||||
</Button>
|
||||
) : primaryOption ? (
|
||||
oneClick ? (
|
||||
<Button
|
||||
size="small"
|
||||
variant="primary"
|
||||
disabled={isBusy}
|
||||
onClick={() => void runDirectInstall(entry, primaryOption)}
|
||||
>
|
||||
<T>Install</T>
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
size="small"
|
||||
variant="primary"
|
||||
disabled={isBusy}
|
||||
onClick={() => setConfiguring({ entry, optionId: primaryOption.id })}
|
||||
>
|
||||
<T>Install…</T>
|
||||
</Button>
|
||||
)
|
||||
) : (
|
||||
<span className={page.tag}>
|
||||
<T>Manual setup</T>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isExpanded && (
|
||||
<div className={page.cardDrawer}>
|
||||
<div className={page.metaGrid}>
|
||||
<span className={page.metaLabel}>
|
||||
<T>Registry ID</T>
|
||||
</span>
|
||||
<span className={page.metaValue}>{entry.name}</span>
|
||||
{entry.publisher && (
|
||||
<>
|
||||
<span className={page.metaLabel}>
|
||||
<T>Publisher</T>
|
||||
</span>
|
||||
<span className={page.metaValue}>{entry.publisher}</span>
|
||||
</>
|
||||
)}
|
||||
{entry.license && (
|
||||
<>
|
||||
<span className={page.metaLabel}>
|
||||
<T>License</T>
|
||||
</span>
|
||||
<span className={page.metaValue}>{entry.license}</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{entry.installOptions.length > 0 && (
|
||||
<div className={styles.registryOptions}>
|
||||
{entry.installOptions.map((opt) => (
|
||||
<div key={opt.id} className={styles.registryOptionRow}>
|
||||
<div className={styles.registryOptionInfo}>
|
||||
<div className={page.cardTitleRow}>
|
||||
<span className={styles.optionLabel}>{opt.label}</span>
|
||||
{!opt.runtimeAvailable && opt.command && (
|
||||
<span className={clsx(page.tag, page.tagWarning)}>
|
||||
{formatMessage(tx("Missing {cmd} on PATH"), { cmd: opt.command })}
|
||||
</span>
|
||||
)}
|
||||
{opt.inputs.length > 0 && (
|
||||
<span className={page.tag}>
|
||||
{formatMessage(tx("{count} inputs"), { count: opt.inputs.length })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<span className={styles.subtitle}>{formatOptionPreview(opt)}</span>
|
||||
</div>
|
||||
{!installed && (
|
||||
<Button
|
||||
size="small"
|
||||
disabled={isBusy}
|
||||
onClick={() => {
|
||||
if (opt.runtimeAvailable && opt.inputs.every((f) => !f.required)) {
|
||||
void runDirectInstall(entry, opt);
|
||||
} else {
|
||||
setConfiguring({ entry, optionId: opt.id });
|
||||
}
|
||||
}}
|
||||
>
|
||||
{opt.inputs.some((f) => f.required) ? (
|
||||
<T>Configure & Install…</T>
|
||||
) : opt.runtimeAvailable ? (
|
||||
<T>Install</T>
|
||||
) : (
|
||||
<T>Install…</T>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={page.drawerFooter}>
|
||||
<div className={page.drawerButtons}>
|
||||
{entry.repositoryUrl && (
|
||||
<Button size="small" onClick={() => void openExternalUrl(entry.repositoryUrl!)}>
|
||||
<Icon name="external-link" size={12} /> <T>Repository</T>
|
||||
</Button>
|
||||
)}
|
||||
{entry.websiteUrl && (
|
||||
<Button size="small" onClick={() => void openExternalUrl(entry.websiteUrl!)}>
|
||||
<Icon name="external-link" size={12} /> <T>Website</T>
|
||||
</Button>
|
||||
)}
|
||||
{!installed && primaryOption && (
|
||||
<Button
|
||||
size="small"
|
||||
disabled={isBusy}
|
||||
onClick={() => setConfiguring({ entry, optionId: primaryOption.id })}
|
||||
>
|
||||
<T>Customize Install…</T>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{nextCursor && (
|
||||
<div ref={sentinelRef} className={styles.scrollSentinel} data-testid="mcp-registry-sentinel">
|
||||
{loadingMore && (
|
||||
<div className={styles.loadingMoreRow} role="status">
|
||||
<Spinner size={12} />
|
||||
<span>
|
||||
<T>Loading more servers…</T>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{loadMoreError && !loadingMore && (
|
||||
<div className={clsx(page.error, styles.loadMoreError)} role="alert">
|
||||
<Icon name="error" size={14} />
|
||||
<span className={styles.loadMoreErrorText}>{loadMoreError}</span>
|
||||
<Button size="small" onClick={() => void fetchPage(activeRegistryUrl, query, nextCursor, true)}>
|
||||
<T>Retry</T>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{configuring && (
|
||||
<McpRegistryInstallDialog
|
||||
backend={backend}
|
||||
entry={configuring.entry}
|
||||
initialOptionId={configuring.optionId}
|
||||
initialScope={effectiveScope}
|
||||
hasProject={hasProject}
|
||||
registryUrl={resolvedUrl}
|
||||
agentOptions={agentOptions}
|
||||
onClose={() => setConfiguring(null)}
|
||||
onInstalled={(next, name, scope) => {
|
||||
setConfiguring(null);
|
||||
onInstalled(next, name, scope);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function McpRegistryIcon({ iconUrl, iconDarkUrl }: { iconUrl?: string | null; iconDarkUrl?: string | null }) {
|
||||
const [failedLightUrl, setFailedLightUrl] = useState<string | null>(null);
|
||||
const [failedDarkUrl, setFailedDarkUrl] = useState<string | null>(null);
|
||||
|
||||
const light = iconUrl && failedLightUrl !== iconUrl ? iconUrl : null;
|
||||
const dark = iconDarkUrl && failedDarkUrl !== iconDarkUrl ? iconDarkUrl : null;
|
||||
const effLight = light ?? dark;
|
||||
const effDark = dark ?? light;
|
||||
|
||||
if (!effLight) {
|
||||
return (
|
||||
<span className={styles.registryIconBox} aria-hidden="true">
|
||||
<Icon name="plugin" size={16} className={styles.registryIconFallback} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (effDark && effDark !== effLight) {
|
||||
return (
|
||||
<span className={styles.registryIconBox} aria-hidden="true">
|
||||
<img
|
||||
src={effLight}
|
||||
alt=""
|
||||
width={28}
|
||||
height={28}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
referrerPolicy="no-referrer"
|
||||
className={clsx(styles.registryIconImg, styles.registryIconLight)}
|
||||
onError={() => setFailedLightUrl(effLight)}
|
||||
/>
|
||||
<img
|
||||
src={effDark}
|
||||
alt=""
|
||||
width={28}
|
||||
height={28}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
referrerPolicy="no-referrer"
|
||||
className={clsx(styles.registryIconImg, styles.registryIconDark)}
|
||||
onError={() => setFailedDarkUrl(effDark)}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<span className={styles.registryIconBox} aria-hidden="true">
|
||||
<img
|
||||
src={effLight}
|
||||
alt=""
|
||||
width={28}
|
||||
height={28}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
referrerPolicy="no-referrer"
|
||||
className={styles.registryIconImg}
|
||||
onError={() => {
|
||||
if (effLight === iconUrl) setFailedLightUrl(effLight);
|
||||
else setFailedDarkUrl(effLight);
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function McpRegistryInstallDialog({
|
||||
backend,
|
||||
entry,
|
||||
initialOptionId,
|
||||
initialScope,
|
||||
hasProject,
|
||||
registryUrl,
|
||||
agentOptions,
|
||||
onClose,
|
||||
onInstalled,
|
||||
}: {
|
||||
backend: McpBackend;
|
||||
entry: McpRegistryServer;
|
||||
initialOptionId?: string;
|
||||
initialScope: McpScope;
|
||||
hasProject: boolean;
|
||||
registryUrl: string;
|
||||
agentOptions: ReadonlyArray<{ id: string; name: string }>;
|
||||
onClose: () => void;
|
||||
onInstalled: (next: McpServer[], serverName: string, scope: McpScope) => void;
|
||||
}) {
|
||||
const tx = useTx();
|
||||
const baseId = useId();
|
||||
const initialOpt =
|
||||
entry.installOptions.find((o) => o.id === initialOptionId) ??
|
||||
pickDefaultInstallOption(entry) ??
|
||||
entry.installOptions[0]!;
|
||||
|
||||
const [optionId, setOptionId] = useState(initialOpt.id);
|
||||
const option = entry.installOptions.find((o) => o.id === optionId) ?? initialOpt;
|
||||
|
||||
const [scope, setScope] = useState<McpScope>(hasProject ? initialScope : "user");
|
||||
const [serverName, setServerName] = useState(entry.suggestedName);
|
||||
const [valuesByOpt, setValuesByOpt] = useState<Record<string, Record<string, string>>>(() => ({
|
||||
[initialOpt.id]: initialRegistryInputValues(initialOpt),
|
||||
}));
|
||||
const [selectedAgents, setSelectedAgents] = useState<string[]>([]);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const values = useMemo(() => valuesByOpt[option.id] ?? initialRegistryInputValues(option), [valuesByOpt, option]);
|
||||
|
||||
const setFieldValue = (key: string, value: string) => {
|
||||
setValuesByOpt((prev) => ({
|
||||
...prev,
|
||||
[option.id]: {
|
||||
...(prev[option.id] ?? initialRegistryInputValues(option)),
|
||||
[key]: value,
|
||||
},
|
||||
}));
|
||||
};
|
||||
|
||||
const sortedInputs = useMemo(
|
||||
() => [...option.inputs].sort((a, b) => Number(b.required) - Number(a.required)),
|
||||
[option.inputs],
|
||||
);
|
||||
|
||||
const previewInput: McpServerInput = useMemo(
|
||||
() =>
|
||||
resolveRegistryInstallInput(entry, option, values, {
|
||||
scope,
|
||||
name: serverName,
|
||||
agents: selectedAgents,
|
||||
registryUrl,
|
||||
maskSecrets: true,
|
||||
}),
|
||||
[entry, option, values, scope, serverName, selectedAgents, registryUrl],
|
||||
);
|
||||
|
||||
const previewSummary =
|
||||
previewInput.transport === "stdio"
|
||||
? [previewInput.command, ...(previewInput.args ?? [])].filter(Boolean).join(" ")
|
||||
: `${previewInput.transport.toUpperCase()} · ${previewInput.url ?? ""}`;
|
||||
|
||||
const missingRequired = useMemo(
|
||||
() => sortedInputs.filter((f) => f.required && !(values[f.key] ?? "").trim()),
|
||||
[sortedInputs, values],
|
||||
);
|
||||
|
||||
const toggleAgent = (id: string) => {
|
||||
setSelectedAgents((prev) => (prev.includes(id) ? prev.filter((a) => a !== id) : [...prev, id]));
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
if (!serverName.trim()) {
|
||||
setError(tx("Server name is required"));
|
||||
return;
|
||||
}
|
||||
if (missingRequired.length > 0) {
|
||||
setError(formatMessage(tx("Required field missing: {name}"), { name: missingRequired[0]!.label }));
|
||||
return;
|
||||
}
|
||||
setSaving(true);
|
||||
setError(null);
|
||||
try {
|
||||
const input = resolveRegistryInstallInput(entry, option, values, {
|
||||
scope,
|
||||
name: serverName,
|
||||
agents: selectedAgents,
|
||||
registryUrl,
|
||||
});
|
||||
const next = await backend.save(input);
|
||||
onInstalled(next, input.name, input.scope);
|
||||
} catch (e: unknown) {
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
const fieldId = (suffix: string) => `${baseId}-${suffix}`;
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open
|
||||
title={formatMessage(tx("Install MCP Server — {name}"), { name: entry.displayName })}
|
||||
onClose={onClose}
|
||||
footer={
|
||||
<>
|
||||
<Button onClick={onClose}>
|
||||
<T>Cancel</T>
|
||||
</Button>
|
||||
<Button variant="primary" disabled={saving} onClick={() => void submit()}>
|
||||
<T>Install</T>
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<form
|
||||
className={styles.form}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
void submit();
|
||||
}}
|
||||
>
|
||||
<label className={styles.formLabel} htmlFor={fieldId("name")}>
|
||||
<T>Name</T>
|
||||
</label>
|
||||
<div className={styles.formControl}>
|
||||
<Input
|
||||
id={fieldId("name")}
|
||||
value={serverName}
|
||||
onChange={(e) => setServerName(e.target.value)}
|
||||
placeholder={entry.suggestedName}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<label className={styles.formLabel} htmlFor={fieldId("scope")}>
|
||||
<T>Scope</T>
|
||||
</label>
|
||||
<div className={styles.formControl}>
|
||||
<Select
|
||||
id={fieldId("scope")}
|
||||
value={scope}
|
||||
options={[
|
||||
{ value: "user", label: tx("Global (settings.toml)") },
|
||||
...(hasProject ? [{ value: "workspace", label: tx("Project (.openidea/settings.toml)") }] : []),
|
||||
]}
|
||||
onChange={(v) => setScope(v as McpScope)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{entry.installOptions.length > 1 && (
|
||||
<>
|
||||
<label className={styles.formLabel} htmlFor={fieldId("method")}>
|
||||
<T>Method</T>
|
||||
</label>
|
||||
<div className={styles.formControl}>
|
||||
<Select
|
||||
id={fieldId("method")}
|
||||
value={option.id}
|
||||
options={entry.installOptions.map((o) => ({
|
||||
value: o.id,
|
||||
label: o.runtimeAvailable ? o.label : `${o.label} (${tx("runtime missing")})`,
|
||||
}))}
|
||||
onChange={setOptionId}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<span className={styles.formLabel}>
|
||||
<T>Preview</T>
|
||||
</span>
|
||||
<div className={styles.formControl}>
|
||||
<div className={styles.previewBox}>{previewSummary}</div>
|
||||
{!option.runtimeAvailable && option.command && (
|
||||
<span className={styles.runtimeWarn}>
|
||||
{formatMessage(tx("`{cmd}` was not found on PATH. Install it before using this server."), {
|
||||
cmd: option.command,
|
||||
})}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{sortedInputs.length > 0 && <hr className={styles.formDivider} />}
|
||||
|
||||
{sortedInputs.map((field: McpRegistryInputField) => (
|
||||
<RegistryInputRow
|
||||
key={field.key}
|
||||
id={fieldId(field.key)}
|
||||
field={field}
|
||||
value={values[field.key] ?? ""}
|
||||
scope={scope}
|
||||
onChange={(val) => setFieldValue(field.key, val)}
|
||||
/>
|
||||
))}
|
||||
|
||||
<hr className={styles.formDivider} />
|
||||
|
||||
<span className={styles.formLabel}>
|
||||
<T>Agents</T>
|
||||
</span>
|
||||
<div className={styles.formControl}>
|
||||
<div className={styles.agentPicker}>
|
||||
{agentOptions.map((agent) => {
|
||||
const active = selectedAgents.includes(agent.id);
|
||||
return (
|
||||
<button
|
||||
key={agent.id}
|
||||
type="button"
|
||||
aria-pressed={active}
|
||||
className={clsx(styles.agentChip, active && styles.agentChipSelected)}
|
||||
onClick={() => toggleAgent(agent.id)}
|
||||
>
|
||||
<Icon name={providerIcon(agent.id)} size={12} />
|
||||
<span>{agent.name}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<span className={styles.hint}>
|
||||
<T>Leave all unselected to enable this server for every agent.</T>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className={clsx(page.error, styles.formWide)} role="alert">
|
||||
<Icon name="error" size={14} />
|
||||
<span>{error}</span>
|
||||
</div>
|
||||
)}
|
||||
</form>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
function RegistryInputRow({
|
||||
id,
|
||||
field,
|
||||
value,
|
||||
scope,
|
||||
onChange,
|
||||
}: {
|
||||
id: string;
|
||||
field: McpRegistryInputField;
|
||||
value: string;
|
||||
scope: McpScope;
|
||||
onChange: (value: string) => void;
|
||||
}) {
|
||||
const tx = useTx();
|
||||
return (
|
||||
<>
|
||||
<label className={styles.formLabel} htmlFor={id}>
|
||||
{field.label}
|
||||
{field.required && <span className={styles.requiredMark}> *</span>}
|
||||
</label>
|
||||
<div className={styles.formControl}>
|
||||
{field.choices.length > 0 ? (
|
||||
<Select
|
||||
id={id}
|
||||
value={value}
|
||||
options={[
|
||||
...(!field.required ? [{ value: "", label: tx("None") }] : []),
|
||||
...field.choices.map((c) => ({ value: c, label: c })),
|
||||
]}
|
||||
onChange={onChange}
|
||||
/>
|
||||
) : (
|
||||
<Input
|
||||
id={id}
|
||||
type={field.secret ? "password" : "text"}
|
||||
value={value}
|
||||
placeholder={field.placeholder ?? (field.defaultValue ? field.defaultValue : undefined)}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
/>
|
||||
)}
|
||||
{(field.description || (field.secret && scope === "user")) && (
|
||||
<span className={styles.hint}>
|
||||
{field.description}
|
||||
{field.description && field.secret && scope === "user" ? " · " : ""}
|
||||
{field.secret && scope === "user" ? tx("Stored in OS Keychain") : ""}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -349,3 +349,161 @@
|
||||
color: var(--fg-muted);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* MCP Registry browser. */
|
||||
.registryExpandBtn {
|
||||
align-items: flex-start;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.registryExpandBtn > svg {
|
||||
margin-top: 9px;
|
||||
}
|
||||
|
||||
.registryIconBox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-top: 1px;
|
||||
border-radius: var(--radius-control);
|
||||
background: var(--bg-elev);
|
||||
box-shadow: inset 0 0 0 1px var(--border);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.registryIconImg {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
object-fit: contain;
|
||||
border-radius: var(--radius-small);
|
||||
}
|
||||
|
||||
.registryIconFallback {
|
||||
color: var(--fg-muted);
|
||||
}
|
||||
|
||||
.registryIconDark {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:global(:root[data-theme^="dark"]) .registryIconLight {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:global(:root[data-theme^="dark"]) .registryIconDark {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.registryCount {
|
||||
color: var(--fg-muted);
|
||||
font-size: var(--fs-small);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.customRegistryBar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1-5);
|
||||
}
|
||||
|
||||
.loadingRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: 12px 14px;
|
||||
border-radius: var(--radius-control);
|
||||
background: var(--bg-elev);
|
||||
box-shadow: inset 0 0 0 1px var(--border);
|
||||
color: var(--fg-muted);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
|
||||
.registryDesc {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
color: var(--fg-secondary);
|
||||
font-size: var(--fs-small);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.registryOptions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1-5);
|
||||
padding-top: var(--space-1);
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.registryOptionRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-2);
|
||||
padding: 6px 8px;
|
||||
border-radius: var(--radius-small);
|
||||
background: var(--bg-elev);
|
||||
box-shadow: inset 0 0 0 1px var(--border);
|
||||
}
|
||||
|
||||
.registryOptionInfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-0-5);
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.optionLabel {
|
||||
font-weight: 600;
|
||||
font-size: var(--fs-small);
|
||||
color: var(--fg-strong);
|
||||
}
|
||||
|
||||
.scrollSentinel {
|
||||
min-height: 1px;
|
||||
}
|
||||
|
||||
.loadingMoreRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-1-5);
|
||||
padding: var(--space-2) 0;
|
||||
color: var(--fg-muted);
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
|
||||
.loadMoreError {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.loadMoreErrorText {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.previewBox {
|
||||
padding: 6px 8px;
|
||||
border-radius: var(--radius-small);
|
||||
background: var(--bg-elev);
|
||||
box-shadow: inset 0 0 0 1px var(--border);
|
||||
color: var(--fg-strong);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--fs-small);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.runtimeWarn {
|
||||
color: var(--warning);
|
||||
font-size: var(--fs-small);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.requiredMark {
|
||||
color: var(--danger);
|
||||
}
|
||||
@@ -50,6 +50,7 @@ import {
|
||||
useMcpCatalog,
|
||||
type McpBackend,
|
||||
} from "./mcpModel";
|
||||
import { McpRegistryBrowse } from "./McpRegistryBrowse";
|
||||
import { AGENT_PLUGINS_PAGE, providerIcon } from "./model";
|
||||
import { useAgents } from "./store";
|
||||
import page from "./SettingsPage.module.css";
|
||||
@@ -58,9 +59,8 @@ import styles from "./McpServers.module.css";
|
||||
export { defaultMcpBackend, type McpBackend };
|
||||
|
||||
const MCP_DOCS_URL = "https://modelcontextprotocol.io";
|
||||
const MCP_BROWSE_URL = "https://github.com/modelcontextprotocol/servers";
|
||||
|
||||
type LevelTab = "all" | "user" | "workspace" | "discovered";
|
||||
type LevelTab = "all" | "user" | "workspace" | "discovered" | "browse";
|
||||
|
||||
interface SectionSpec {
|
||||
scope: McpScope;
|
||||
@@ -731,6 +731,15 @@ export function McpServersPage({ backend = defaultMcpBackend }: { backend?: McpB
|
||||
</span>
|
||||
) : undefined,
|
||||
},
|
||||
...(backend.searchRegistry
|
||||
? [
|
||||
{
|
||||
id: "browse",
|
||||
label: tx("Browse"),
|
||||
text: tx("Browse"),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
@@ -740,8 +749,8 @@ export function McpServersPage({ backend = defaultMcpBackend }: { backend?: McpB
|
||||
className={page.search}
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
placeholder={tx("Type to search...")}
|
||||
aria-label={tx("Search MCP servers")}
|
||||
placeholder={tab === "browse" ? tx("Search MCP registry...") : tx("Type to search...")}
|
||||
aria-label={tab === "browse" ? tx("Search MCP registry") : tx("Search MCP servers")}
|
||||
/>
|
||||
<Button
|
||||
onClick={() =>
|
||||
@@ -1194,6 +1203,33 @@ export function McpServersPage({ backend = defaultMcpBackend }: { backend?: McpB
|
||||
/>
|
||||
)}
|
||||
|
||||
{tab === "browse" && backend.searchRegistry && (
|
||||
<McpRegistryBrowse
|
||||
backend={backend}
|
||||
query={query}
|
||||
servers={servers}
|
||||
hasProject={hasProject}
|
||||
agentOptions={agentOptions}
|
||||
onInstalled={(next, serverName, scope) => {
|
||||
syncCatalog(next);
|
||||
setNotice(
|
||||
formatMessage(
|
||||
tx(
|
||||
scope === "workspace"
|
||||
? "Installed {name} into Project MCP servers."
|
||||
: "Installed {name} into Global MCP servers.",
|
||||
),
|
||||
{ name: serverName },
|
||||
),
|
||||
);
|
||||
}}
|
||||
onUninstalled={(next, serverName) => {
|
||||
syncCatalog(next);
|
||||
setNotice(formatMessage(tx("Uninstalled {name}."), { name: serverName }));
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{addMenu && (
|
||||
<Menu
|
||||
open
|
||||
@@ -1220,8 +1256,9 @@ export function McpServersPage({ backend = defaultMcpBackend }: { backend?: McpB
|
||||
disabled: importing,
|
||||
run: () => void importFromProject(),
|
||||
},
|
||||
{ kind: "separator" as const },
|
||||
{ label: tx("Browse MCP Servers"), run: () => void openExternalUrl(MCP_BROWSE_URL) },
|
||||
...(backend.searchRegistry
|
||||
? [{ kind: "separator" as const }, { label: tx("Browse MCP Servers"), run: () => setTab("browse") }]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -31,6 +31,7 @@ export const AGENT_SETTINGS_DEFAULTS: ResolvedAgentSettings = {
|
||||
confirmTerminateOnClose: true,
|
||||
defaults: {},
|
||||
mcpServers: {},
|
||||
mcpRegistryUrl: "",
|
||||
skills: {},
|
||||
memory: {
|
||||
autoMemory: "inherit",
|
||||
|
||||
@@ -8,19 +8,37 @@ import type {
|
||||
McpDiscoveredServer,
|
||||
McpExternalSource,
|
||||
McpImportSelection,
|
||||
McpKeyValue,
|
||||
McpProbeResult,
|
||||
McpRegistryInputField,
|
||||
McpRegistryInstallOption,
|
||||
McpRegistryPage,
|
||||
McpRegistryServer,
|
||||
McpScope,
|
||||
McpServer,
|
||||
McpServerInput,
|
||||
McpServerStatus,
|
||||
} from "@/bindings";
|
||||
import { call, commands, isTauri, onIdeEvent } from "@/platform/ipc";
|
||||
import { call, commands, isTauri, nextRequestId, onIdeEvent } from "@/platform/ipc";
|
||||
import { useProject } from "@/platform/project";
|
||||
|
||||
export const BUILTIN_MCP_NAME = "openidea";
|
||||
export const BUILTIN_MCP_ID = "builtin::openidea";
|
||||
export const IDE_MCP_SETTINGS_PAGE = "agents.mcpServer";
|
||||
|
||||
export const MCP_REGISTRY_PRESETS = [
|
||||
{ id: "github", label: "GitHub MCP Registry", url: "https://api.mcp.github.com" },
|
||||
{ id: "official", label: "Official MCP Registry", url: "https://registry.modelcontextprotocol.io" },
|
||||
] as const;
|
||||
|
||||
export interface McpRegistrySearchParams {
|
||||
registryUrl?: string | null;
|
||||
query?: string | null;
|
||||
cursor?: string | null;
|
||||
limit?: number | null;
|
||||
requestId?: number;
|
||||
}
|
||||
|
||||
export interface McpBackend {
|
||||
list(): Promise<McpServer[]>;
|
||||
save(input: McpServerInput): Promise<McpServer[]>;
|
||||
@@ -33,6 +51,9 @@ export interface McpBackend {
|
||||
testServer?(id: string): Promise<McpProbeResult>;
|
||||
listBuiltinTools?(): Promise<McpProbeResult>;
|
||||
builtinStatus?(): Promise<McpServerStatus | null>;
|
||||
searchRegistry?(params: McpRegistrySearchParams): Promise<McpRegistryPage>;
|
||||
cancelRequest?(requestId: number): Promise<void>;
|
||||
saveRegistryUrl?(url: string): Promise<void>;
|
||||
}
|
||||
|
||||
export const defaultMcpBackend: McpBackend = {
|
||||
@@ -65,8 +86,182 @@ export const defaultMcpBackend: McpBackend = {
|
||||
typeof commands.mcpServerStatus === "function"
|
||||
? call(commands.mcpServerStatus()).catch(() => null)
|
||||
: Promise.resolve(null),
|
||||
searchRegistry: ({ registryUrl = null, query = null, cursor = null, limit = 30, requestId = nextRequestId() }) =>
|
||||
call(commands.agentMcpRegistrySearch(registryUrl, query, cursor, limit, requestId)),
|
||||
cancelRequest: (requestId) =>
|
||||
typeof commands.cancelRequest === "function"
|
||||
? commands.cancelRequest(requestId).catch(() => undefined)
|
||||
: Promise.resolve(),
|
||||
saveRegistryUrl: async (url) => {
|
||||
if (isTauri() && typeof commands.settingsSet === "function") {
|
||||
await call(commands.settingsSet("global", "agents.mcpRegistryUrl", JSON.stringify(url.trim())));
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export function normalizeRegistryBaseUrl(url: string | null | undefined): string {
|
||||
const trimmed = (url ?? "").trim().replace(/\/+$/, "");
|
||||
return trimmed || MCP_REGISTRY_PRESETS[0].url;
|
||||
}
|
||||
|
||||
export function formatStarCount(stars: number): string {
|
||||
if (stars >= 1_000_000) return `${(stars / 1_000_000).toFixed(1).replace(/\.0$/, "")}M`;
|
||||
if (stars >= 1_000) return `${(stars / 1_000).toFixed(1).replace(/\.0$/, "")}k`;
|
||||
return String(stars);
|
||||
}
|
||||
|
||||
export function formatOptionPreview(option: McpRegistryInstallOption): string {
|
||||
if (option.transport === "stdio") {
|
||||
return [option.command, ...option.args].filter(Boolean).join(" ");
|
||||
}
|
||||
return `${option.transport.toUpperCase()} · ${option.url ?? ""}`;
|
||||
}
|
||||
|
||||
/** True when a server has a single install method whose runtime is available and requires no inputs. */
|
||||
export function canOneClickInstall(server: McpRegistryServer): boolean {
|
||||
if (server.installOptions.length !== 1) return false;
|
||||
const opt = server.installOptions[0]!;
|
||||
return opt.runtimeAvailable && opt.inputs.every((field) => !field.required);
|
||||
}
|
||||
|
||||
/** Picks the best default install option (preferring available runtimes, then remote HTTP). */
|
||||
export function pickDefaultInstallOption(server: McpRegistryServer): McpRegistryInstallOption | null {
|
||||
if (server.installOptions.length === 0) return null;
|
||||
return server.installOptions.find((o) => o.runtimeAvailable) ?? server.installOptions[0] ?? null;
|
||||
}
|
||||
|
||||
/** Finds an installed standalone (non-plugin) MCP server corresponding to a registry entry. */
|
||||
export function findInstalledRegistryServer(
|
||||
servers: readonly McpServer[],
|
||||
entry: McpRegistryServer,
|
||||
preferredScope?: McpScope,
|
||||
): McpServer | undefined {
|
||||
const standalone = servers.filter((s) => !s.pluginId);
|
||||
const byScope = preferredScope
|
||||
? [...standalone.filter((s) => s.scope === preferredScope), ...standalone.filter((s) => s.scope !== preferredScope)]
|
||||
: standalone;
|
||||
|
||||
const byRegistry = byScope.find((s) => s.registryName === entry.name);
|
||||
if (byRegistry) return byRegistry;
|
||||
|
||||
const byName = byScope.find((s) => s.name === entry.suggestedName || s.name === entry.name);
|
||||
if (byName) return byName;
|
||||
|
||||
for (const opt of entry.installOptions) {
|
||||
if (opt.transport === "stdio" && opt.command) {
|
||||
const targetArgs = opt.args.join("\0");
|
||||
const matched = byScope.find(
|
||||
(s) => s.transport === "stdio" && s.command === opt.command && s.args.join("\0") === targetArgs,
|
||||
);
|
||||
if (matched) return matched;
|
||||
} else if (opt.url && !opt.url.includes("{")) {
|
||||
const matched = byScope.find((s) => s.transport === opt.transport && s.url === opt.url);
|
||||
if (matched) return matched;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function initialRegistryInputValues(option: McpRegistryInstallOption): Record<string, string> {
|
||||
const out: Record<string, string> = {};
|
||||
for (const field of option.inputs) {
|
||||
out[field.key] = field.defaultValue ?? "";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function replaceToken(text: string, token: string, value: string): string {
|
||||
return token ? text.split(token).join(value) : text;
|
||||
}
|
||||
|
||||
/** Builds a concrete `McpServerInput` from a registry install option and user-entered values. */
|
||||
export function resolveRegistryInstallInput(
|
||||
entry: McpRegistryServer,
|
||||
option: McpRegistryInstallOption,
|
||||
values: Readonly<Record<string, string>>,
|
||||
opts: {
|
||||
scope: McpScope;
|
||||
name?: string;
|
||||
agents?: string[];
|
||||
registryUrl: string;
|
||||
maskSecrets?: boolean;
|
||||
},
|
||||
): McpServerInput {
|
||||
const getVal = (field: McpRegistryInputField): string => {
|
||||
const raw = (values[field.key] ?? field.defaultValue ?? "").trim();
|
||||
if (opts.maskSecrets && field.secret && raw) return "•••";
|
||||
return raw;
|
||||
};
|
||||
|
||||
let url = option.url ?? null;
|
||||
const args = [...option.args];
|
||||
const env: McpKeyValue[] = [];
|
||||
const headerMap = new Map<string, string>();
|
||||
for (const h of option.headers) {
|
||||
headerMap.set(h.name, h.value);
|
||||
}
|
||||
|
||||
for (const field of option.inputs) {
|
||||
const val = getVal(field);
|
||||
switch (field.kind) {
|
||||
case "env":
|
||||
if (val) env.push({ name: field.label, value: val });
|
||||
break;
|
||||
case "urlVar":
|
||||
if (url && field.templateToken && val) {
|
||||
url = replaceToken(url, field.templateToken, val);
|
||||
}
|
||||
break;
|
||||
case "header": {
|
||||
const headerName = field.headerName ?? field.label;
|
||||
if (field.templateToken) {
|
||||
const current = headerMap.get(headerName) ?? "";
|
||||
if (val) {
|
||||
headerMap.set(headerName, replaceToken(current, field.templateToken, val));
|
||||
} else if (!field.required && current.includes(field.templateToken)) {
|
||||
headerMap.delete(headerName);
|
||||
}
|
||||
} else if (val) {
|
||||
headerMap.set(headerName, val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "arg":
|
||||
if (field.templateToken) {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i]!.includes(field.templateToken) && val) {
|
||||
args[i] = replaceToken(args[i]!, field.templateToken, val);
|
||||
}
|
||||
}
|
||||
} else if (val) {
|
||||
if (field.flag) args.push(field.flag);
|
||||
args.push(val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const headers: McpKeyValue[] = [...headerMap.entries()]
|
||||
.filter(([, value]) => value.trim().length > 0)
|
||||
.map(([name, value]) => ({ name, value }));
|
||||
|
||||
return {
|
||||
id: null,
|
||||
name: (opts.name ?? entry.suggestedName).trim() || entry.suggestedName,
|
||||
scope: opts.scope,
|
||||
transport: option.transport,
|
||||
enabled: true,
|
||||
command: option.transport === "stdio" ? (option.command ?? null) : null,
|
||||
args: option.transport === "stdio" ? args : [],
|
||||
env: option.transport === "stdio" ? env : [],
|
||||
url: option.transport === "stdio" ? null : url,
|
||||
headers: option.transport === "stdio" ? [] : headers,
|
||||
agents: opts.agents ?? [],
|
||||
registryName: entry.name,
|
||||
registryUrl: normalizeRegistryBaseUrl(opts.registryUrl),
|
||||
};
|
||||
}
|
||||
|
||||
export const normalizeProviderId = (id: string): string => (id.endsWith("-acp") ? id.slice(0, -4) : id);
|
||||
|
||||
export function matchesAgentProvider(agents: readonly string[] | undefined, provider: string): boolean {
|
||||
|
||||
@@ -4,12 +4,14 @@ import type {
|
||||
McpExternalSource,
|
||||
McpImportSelection,
|
||||
McpProbeResult,
|
||||
McpRegistryPage,
|
||||
McpScope,
|
||||
McpServer,
|
||||
McpServerInput,
|
||||
McpServerStatus,
|
||||
} from "@/bindings";
|
||||
import { McpServersPage, type McpBackend } from "./McpServersPage";
|
||||
import { resolveRegistryInstallInput, type McpRegistrySearchParams } from "./mcpModel";
|
||||
|
||||
const server = (partial: Partial<McpServer> & Pick<McpServer, "id" | "name" | "scope">): McpServer => ({
|
||||
enabled: true,
|
||||
@@ -60,6 +62,124 @@ const INITIAL_SOURCES: McpExternalSource[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const SAMPLE_REGISTRY_PAGE_1: McpRegistryPage = {
|
||||
registryUrl: "https://api.mcp.github.com",
|
||||
total: 2,
|
||||
nextCursor: "cursor-2",
|
||||
servers: [
|
||||
{
|
||||
name: "microsoft/playwright-mcp",
|
||||
displayName: "Playwright MCP",
|
||||
suggestedName: "playwright-mcp",
|
||||
description: "Automate web browsers using accessibility trees.",
|
||||
version: "0.0.1-seed",
|
||||
publisher: "microsoft",
|
||||
iconUrl: "https://avatars.githubusercontent.com/u/6154722?v=4",
|
||||
iconDarkUrl: null,
|
||||
repositoryUrl: "https://github.com/microsoft/playwright-mcp",
|
||||
websiteUrl: null,
|
||||
license: "Apache-2.0",
|
||||
stars: 40441,
|
||||
installOptions: [
|
||||
{
|
||||
id: "pkg:0",
|
||||
label: "npm (npx)",
|
||||
transport: "stdio",
|
||||
registryType: "npm",
|
||||
packageIdentifier: "@playwright/mcp",
|
||||
command: "npx",
|
||||
args: ["-y", "@playwright/mcp"],
|
||||
url: null,
|
||||
headers: [],
|
||||
inputs: [],
|
||||
runtimeAvailable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "io.github.netdata/mcp-server",
|
||||
displayName: "Netdata",
|
||||
suggestedName: "netdata",
|
||||
description: "Real-time infrastructure monitoring.",
|
||||
version: "2.13.0",
|
||||
publisher: "netdata",
|
||||
iconUrl: "https://cdn.example.com/netdata-light.png",
|
||||
iconDarkUrl: "https://cdn.example.com/netdata-dark.png",
|
||||
repositoryUrl: "https://github.com/netdata/netdata",
|
||||
websiteUrl: "https://www.netdata.cloud",
|
||||
license: "GPL-3.0",
|
||||
stars: 74200,
|
||||
installOptions: [
|
||||
{
|
||||
id: "remote:0",
|
||||
label: "Streamable HTTP",
|
||||
transport: "http",
|
||||
registryType: "streamable-http",
|
||||
packageIdentifier: null,
|
||||
command: null,
|
||||
args: [],
|
||||
url: "https://app.netdata.cloud/api/v1/mcp",
|
||||
headers: [{ name: "Authorization", value: "Bearer {NETDATA_CLOUD_API_TOKEN}" }],
|
||||
inputs: [
|
||||
{
|
||||
key: "header:Authorization:NETDATA_CLOUD_API_TOKEN",
|
||||
label: "NETDATA_CLOUD_API_TOKEN",
|
||||
kind: "header",
|
||||
description: "Netdata Cloud API token",
|
||||
required: true,
|
||||
secret: true,
|
||||
defaultValue: null,
|
||||
placeholder: null,
|
||||
choices: [],
|
||||
headerName: "Authorization",
|
||||
flag: null,
|
||||
templateToken: "{NETDATA_CLOUD_API_TOKEN}",
|
||||
},
|
||||
],
|
||||
runtimeAvailable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const SAMPLE_REGISTRY_PAGE_2: McpRegistryPage = {
|
||||
registryUrl: "https://api.mcp.github.com",
|
||||
total: 3,
|
||||
nextCursor: null,
|
||||
servers: [
|
||||
{
|
||||
name: "microsoft/markitdown",
|
||||
displayName: "MarkItDown",
|
||||
suggestedName: "markitdown",
|
||||
description: "Convert files and office documents to Markdown.",
|
||||
version: "1.0.0",
|
||||
publisher: "microsoft",
|
||||
iconUrl: null,
|
||||
iconDarkUrl: null,
|
||||
repositoryUrl: "https://github.com/microsoft/markitdown",
|
||||
websiteUrl: null,
|
||||
license: "MIT",
|
||||
stars: 199509,
|
||||
installOptions: [
|
||||
{
|
||||
id: "pkg:0",
|
||||
label: "PyPI (uvx)",
|
||||
transport: "stdio",
|
||||
registryType: "pypi",
|
||||
packageIdentifier: "markitdown-mcp",
|
||||
command: "uvx",
|
||||
args: ["markitdown-mcp==0.0.1a4"],
|
||||
url: null,
|
||||
headers: [],
|
||||
inputs: [],
|
||||
runtimeAvailable: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
class FakeMcpBackend implements McpBackend {
|
||||
servers: McpServer[] = [...INITIAL_SERVERS];
|
||||
sources: McpExternalSource[] = [...INITIAL_SOURCES];
|
||||
@@ -69,6 +189,8 @@ class FakeMcpBackend implements McpBackend {
|
||||
importedSelected: Array<{ scope: McpScope; selections: McpImportSelection[]; overwrite: boolean }> = [];
|
||||
removed: string[] = [];
|
||||
imported = 0;
|
||||
registrySearches: McpRegistrySearchParams[] = [];
|
||||
savedRegistryUrls: string[] = [];
|
||||
|
||||
list = vi.fn(async () => this.servers);
|
||||
|
||||
@@ -94,11 +216,37 @@ class FakeMcpBackend implements McpBackend {
|
||||
env: input.env ?? [],
|
||||
headers: input.headers ?? [],
|
||||
agents: input.agents ?? [],
|
||||
registryName: input.registryName ?? null,
|
||||
registryUrl: input.registryUrl ?? null,
|
||||
});
|
||||
this.servers = [...this.servers.filter((s) => s.id !== (input.id ?? id)), next];
|
||||
return this.servers;
|
||||
});
|
||||
|
||||
searchRegistry = vi.fn(async (params: McpRegistrySearchParams): Promise<McpRegistryPage> => {
|
||||
this.registrySearches.push(params);
|
||||
const registryUrl = params.registryUrl ?? "https://api.mcp.github.com";
|
||||
if (params.cursor === "cursor-2") {
|
||||
return { ...SAMPLE_REGISTRY_PAGE_2, registryUrl };
|
||||
}
|
||||
const q = (params.query ?? "").trim().toLowerCase();
|
||||
const servers = q
|
||||
? SAMPLE_REGISTRY_PAGE_1.servers.filter(
|
||||
(s) => s.name.toLowerCase().includes(q) || s.displayName.toLowerCase().includes(q),
|
||||
)
|
||||
: SAMPLE_REGISTRY_PAGE_1.servers;
|
||||
return {
|
||||
...SAMPLE_REGISTRY_PAGE_1,
|
||||
registryUrl,
|
||||
servers,
|
||||
nextCursor: q ? null : SAMPLE_REGISTRY_PAGE_1.nextCursor,
|
||||
};
|
||||
});
|
||||
|
||||
saveRegistryUrl = vi.fn(async (url: string) => {
|
||||
this.savedRegistryUrls.push(url);
|
||||
});
|
||||
|
||||
saveJson = vi.fn(async (scope: McpScope, rawJson: string, _fallback: string | null, agents: string[]) => {
|
||||
this.savedJson.push({ scope, rawJson, agents });
|
||||
const parsed = JSON.parse(rawJson) as { mcpServers?: Record<string, { command?: string; args?: string[] }> };
|
||||
@@ -402,4 +550,280 @@ describe("McpServersPage", () => {
|
||||
expect(screen.getByText("dengliu_kubernetes__get_pod_logs")).toBeInTheDocument();
|
||||
expect(screen.queryByText("check_files")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("browses the MCP registry and supports one-click install and uninstall", async () => {
|
||||
const backend = new FakeMcpBackend();
|
||||
render(<McpServersPage backend={backend} />);
|
||||
|
||||
await waitFor(() => expect(screen.getByText("slack-official")).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Browse" }));
|
||||
|
||||
expect(await screen.findByText("Playwright MCP")).toBeInTheDocument();
|
||||
expect(screen.getByText("npx -y @playwright/mcp")).toBeInTheDocument();
|
||||
expect(screen.getByText("40.4k")).toBeInTheDocument();
|
||||
|
||||
// Registry icon renders with `no-referrer` and falls back cleanly on load error.
|
||||
const pwRow = screen.getByText("Playwright MCP").closest('[role="listitem"]') as HTMLElement;
|
||||
const pwImg = pwRow.querySelector("img");
|
||||
expect(pwImg).not.toBeNull();
|
||||
expect(pwImg).toHaveAttribute("src", "https://avatars.githubusercontent.com/u/6154722?v=4");
|
||||
expect(pwImg).toHaveAttribute("referrerpolicy", "no-referrer");
|
||||
fireEvent.error(pwImg!);
|
||||
expect(pwRow.querySelector("img")).toBeNull();
|
||||
|
||||
// Zero-input server installs in one click.
|
||||
fireEvent.click(screen.getByRole("button", { name: "Install" }));
|
||||
|
||||
await waitFor(() => expect(backend.saved).toHaveLength(1));
|
||||
expect(backend.saved[0]).toMatchObject({
|
||||
name: "playwright-mcp",
|
||||
scope: "user",
|
||||
transport: "stdio",
|
||||
command: "npx",
|
||||
args: ["-y", "@playwright/mcp"],
|
||||
registryName: "microsoft/playwright-mcp",
|
||||
registryUrl: "https://api.mcp.github.com",
|
||||
});
|
||||
|
||||
// Installed badge and one-click Uninstall appear immediately.
|
||||
expect(await screen.findByText("Installed")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Uninstall" }));
|
||||
|
||||
await waitFor(() => expect(backend.removed).toEqual(["user::playwright-mcp"]));
|
||||
expect(await screen.findByRole("button", { name: "Install" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("prompts for required secret headers before installing a remote registry server", async () => {
|
||||
const backend = new FakeMcpBackend();
|
||||
render(<McpServersPage backend={backend} />);
|
||||
|
||||
await waitFor(() => expect(screen.getByText("slack-official")).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Browse" }));
|
||||
|
||||
expect(await screen.findByText("Netdata")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Install…" }));
|
||||
|
||||
const dialog = await screen.findByRole("dialog", { name: "Install MCP Server — Netdata" });
|
||||
// Submitting with a missing required secret shows an error without saving.
|
||||
fireEvent.click(within(dialog).getByRole("button", { name: "Install" }));
|
||||
expect(await within(dialog).findByRole("alert")).toHaveTextContent(
|
||||
"Required field missing: NETDATA_CLOUD_API_TOKEN",
|
||||
);
|
||||
expect(backend.saved).toHaveLength(0);
|
||||
|
||||
fireEvent.change(within(dialog).getByLabelText(/NETDATA_CLOUD_API_TOKEN/), {
|
||||
target: { value: "nd-secret-123" },
|
||||
});
|
||||
fireEvent.click(within(dialog).getByRole("button", { name: "Install" }));
|
||||
|
||||
await waitFor(() => expect(backend.saved).toHaveLength(1));
|
||||
expect(backend.saved[0]).toMatchObject({
|
||||
name: "netdata",
|
||||
scope: "user",
|
||||
transport: "http",
|
||||
url: "https://app.netdata.cloud/api/v1/mcp",
|
||||
headers: [{ name: "Authorization", value: "Bearer nd-secret-123" }],
|
||||
registryName: "io.github.netdata/mcp-server",
|
||||
});
|
||||
});
|
||||
|
||||
function stubIntersectionObserver() {
|
||||
const observers: Array<{ callback: IntersectionObserverCallback; targets: Set<Element> }> = [];
|
||||
class FakeIntersectionObserver {
|
||||
readonly targets = new Set<Element>();
|
||||
constructor(callback: IntersectionObserverCallback) {
|
||||
observers.push({ callback, targets: this.targets });
|
||||
}
|
||||
observe(target: Element) {
|
||||
this.targets.add(target);
|
||||
}
|
||||
unobserve(target: Element) {
|
||||
this.targets.delete(target);
|
||||
}
|
||||
disconnect() {
|
||||
this.targets.clear();
|
||||
}
|
||||
}
|
||||
vi.stubGlobal("IntersectionObserver", FakeIntersectionObserver);
|
||||
return {
|
||||
trigger(target: Element, isIntersecting: boolean) {
|
||||
for (const observer of observers) {
|
||||
if (observer.targets.has(target)) {
|
||||
observer.callback(
|
||||
[{ target, isIntersecting } as unknown as IntersectionObserverEntry],
|
||||
{} as IntersectionObserver,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
isObserving(target: Element) {
|
||||
return observers.some((o) => o.targets.has(target));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
it("loads more results automatically via infinite scroll and opens confirmation when local runtime is missing", async () => {
|
||||
const io = stubIntersectionObserver();
|
||||
try {
|
||||
const backend = new FakeMcpBackend();
|
||||
render(<McpServersPage backend={backend} />);
|
||||
|
||||
await waitFor(() => expect(screen.getByText("slack-official")).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Browse" }));
|
||||
|
||||
expect(await screen.findByText("Playwright MCP")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Load More" })).toBeNull();
|
||||
const sentinel = screen.getByTestId("mcp-registry-sentinel");
|
||||
await waitFor(() => expect(io.isObserving(sentinel)).toBe(true));
|
||||
|
||||
io.trigger(sentinel, true);
|
||||
|
||||
expect(await screen.findByText("MarkItDown")).toBeInTheDocument();
|
||||
expect(screen.getByText("Needs uvx")).toBeInTheDocument();
|
||||
expect(screen.queryByTestId("mcp-registry-sentinel")).not.toBeInTheDocument();
|
||||
|
||||
// Missing runtime opens the Install dialog showing the PATH warning instead of installing blindly.
|
||||
const markitdownRow = screen.getByText("MarkItDown").closest('[role="listitem"]') as HTMLElement;
|
||||
fireEvent.click(within(markitdownRow).getByRole("button", { name: "Install…" }));
|
||||
const dialog = await screen.findByRole("dialog", { name: "Install MCP Server — MarkItDown" });
|
||||
expect(within(dialog).getByText(/`uvx` was not found on PATH/)).toBeInTheDocument();
|
||||
fireEvent.click(within(dialog).getByRole("button", { name: "Cancel" }));
|
||||
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
|
||||
|
||||
// The install method rows in the expanded card confirm a missing runtime the same way.
|
||||
fireEvent.click(within(markitdownRow).getByRole("button", { name: /MarkItDown/ }));
|
||||
expect(within(markitdownRow).getByText("PyPI (uvx)")).toBeInTheDocument();
|
||||
const installButtons = within(markitdownRow).getAllByRole("button", { name: "Install…" });
|
||||
expect(installButtons).toHaveLength(2);
|
||||
fireEvent.click(installButtons[1]!);
|
||||
expect(await screen.findByRole("dialog", { name: "Install MCP Server — MarkItDown" })).toBeInTheDocument();
|
||||
expect(backend.saved).toHaveLength(0);
|
||||
} finally {
|
||||
vi.unstubAllGlobals();
|
||||
}
|
||||
});
|
||||
|
||||
it("pauses infinite scroll on append error and recovers via Retry", async () => {
|
||||
const io = stubIntersectionObserver();
|
||||
try {
|
||||
const backend = new FakeMcpBackend();
|
||||
const baseSearch = backend.searchRegistry;
|
||||
let failOnce = true;
|
||||
backend.searchRegistry = vi.fn(async (params: McpRegistrySearchParams) => {
|
||||
if (params.cursor === "cursor-2" && failOnce) {
|
||||
failOnce = false;
|
||||
throw new Error("Registry temporarily unavailable");
|
||||
}
|
||||
return baseSearch(params);
|
||||
});
|
||||
|
||||
render(<McpServersPage backend={backend} />);
|
||||
await waitFor(() => expect(screen.getByText("slack-official")).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Browse" }));
|
||||
expect(await screen.findByText("Playwright MCP")).toBeInTheDocument();
|
||||
|
||||
const sentinel = screen.getByTestId("mcp-registry-sentinel");
|
||||
await waitFor(() => expect(io.isObserving(sentinel)).toBe(true));
|
||||
io.trigger(sentinel, true);
|
||||
|
||||
expect(await screen.findByRole("alert")).toHaveTextContent("Registry temporarily unavailable");
|
||||
// Existing page 1 items remain visible while retry is offered inline.
|
||||
expect(screen.getByText("Playwright MCP")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Retry" }));
|
||||
expect(await screen.findByText("MarkItDown")).toBeInTheDocument();
|
||||
} finally {
|
||||
vi.unstubAllGlobals();
|
||||
}
|
||||
});
|
||||
|
||||
it("switches to a custom MCP registry only when validated by the backend", async () => {
|
||||
const backend = new FakeMcpBackend();
|
||||
const baseSearch = backend.searchRegistry;
|
||||
backend.searchRegistry = vi.fn(async (params: McpRegistrySearchParams) => {
|
||||
if (params.registryUrl === "http://insecure.example") {
|
||||
throw new Error("Only https:// MCP registries are allowed");
|
||||
}
|
||||
return baseSearch(params);
|
||||
});
|
||||
|
||||
render(<McpServersPage backend={backend} />);
|
||||
await waitFor(() => expect(screen.getByText("slack-official")).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Browse" }));
|
||||
await screen.findByText("Playwright MCP");
|
||||
|
||||
fireEvent.click(screen.getByLabelText("MCP registry source"));
|
||||
const listbox = await screen.findByRole("listbox", { name: "MCP registry source" });
|
||||
fireEvent.click(within(listbox).getByText("Custom Registry…"));
|
||||
|
||||
const input = await screen.findByLabelText("Custom MCP registry URL");
|
||||
fireEvent.change(input, { target: { value: "http://insecure.example" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Use Registry" }));
|
||||
expect(await screen.findByRole("alert")).toHaveTextContent("Only https:// MCP registries are allowed");
|
||||
expect(backend.savedRegistryUrls).toEqual([]);
|
||||
|
||||
fireEvent.change(input, { target: { value: "https://mcp.corp.example" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Use Registry" }));
|
||||
await waitFor(() => expect(backend.savedRegistryUrls).toEqual(["https://mcp.corp.example"]));
|
||||
});
|
||||
|
||||
it("resolves URL variables, env vars, named CLI args, and masked previews", () => {
|
||||
const entry = SAMPLE_REGISTRY_PAGE_1.servers[0]!;
|
||||
const resolved = resolveRegistryInstallInput(
|
||||
entry,
|
||||
{
|
||||
id: "pkg:0",
|
||||
label: "Docker (docker)",
|
||||
transport: "stdio",
|
||||
registryType: "oci",
|
||||
packageIdentifier: "ghcr.io/example/tool",
|
||||
command: "docker",
|
||||
args: ["run", "-i", "--rm", "ghcr.io/example/tool:1.0.0"],
|
||||
url: null,
|
||||
headers: [],
|
||||
runtimeAvailable: true,
|
||||
inputs: [
|
||||
{
|
||||
key: "env:API_KEY",
|
||||
label: "API_KEY",
|
||||
kind: "env",
|
||||
description: null,
|
||||
required: true,
|
||||
secret: true,
|
||||
defaultValue: null,
|
||||
placeholder: null,
|
||||
choices: [],
|
||||
headerName: null,
|
||||
flag: null,
|
||||
templateToken: null,
|
||||
},
|
||||
{
|
||||
key: "arg:0:--root",
|
||||
label: "root",
|
||||
kind: "arg",
|
||||
description: null,
|
||||
required: true,
|
||||
secret: false,
|
||||
defaultValue: null,
|
||||
placeholder: null,
|
||||
choices: [],
|
||||
headerName: null,
|
||||
flag: "--root",
|
||||
templateToken: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
{ "env:API_KEY": "top-secret", "arg:0:--root": "/tmp/ws" },
|
||||
{ scope: "user", registryUrl: "https://api.mcp.github.com" },
|
||||
);
|
||||
expect(resolved.env).toEqual([{ name: "API_KEY", value: "top-secret" }]);
|
||||
expect(resolved.args).toEqual(["run", "-i", "--rm", "ghcr.io/example/tool:1.0.0", "--root", "/tmp/ws"]);
|
||||
|
||||
const masked = resolveRegistryInstallInput(
|
||||
SAMPLE_REGISTRY_PAGE_1.servers[1]!,
|
||||
SAMPLE_REGISTRY_PAGE_1.servers[1]!.installOptions[0]!,
|
||||
{ "header:Authorization:NETDATA_CLOUD_API_TOKEN": "top-secret" },
|
||||
{ scope: "user", registryUrl: "https://api.mcp.github.com", maskSecrets: true },
|
||||
);
|
||||
expect(masked.headers).toEqual([{ name: "Authorization", value: "Bearer •••" }]);
|
||||
});
|
||||
});
|
||||
@@ -133,6 +133,42 @@ export function pluginFormatLabel(fmt: AgentPluginFormat): string {
|
||||
}
|
||||
}
|
||||
|
||||
export interface SuggestedPluginMarketplace {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly source: string;
|
||||
readonly description: string;
|
||||
}
|
||||
|
||||
export const SUGGESTED_PLUGIN_MARKETPLACES: readonly SuggestedPluginMarketplace[] = [
|
||||
{
|
||||
id: "awesome-copilot",
|
||||
name: "Awesome Copilot",
|
||||
source: "github/awesome-copilot#marketplace",
|
||||
description: "Official GitHub Copilot plugins marketplace",
|
||||
},
|
||||
{
|
||||
id: "claude-plugins-official",
|
||||
name: "Claude Official Plugins",
|
||||
source: "anthropics/claude-plugins-official",
|
||||
description: "Official Anthropic Claude plugins marketplace",
|
||||
},
|
||||
];
|
||||
|
||||
function canonicalMarketplaceKey(source: string): string {
|
||||
const trimmed = source.trim().toLowerCase();
|
||||
const withoutHost = trimmed.replace(/^https?:\/\/github\.com\//, "");
|
||||
const withoutRef = withoutHost.split("#")[0] ?? withoutHost;
|
||||
return withoutRef.replace(/\.git$/, "").replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
export function unregisteredSuggestedMarketplaces(
|
||||
registered: readonly { source: string }[],
|
||||
): SuggestedPluginMarketplace[] {
|
||||
const existing = new Set(registered.map((m) => canonicalMarketplaceKey(m.source)));
|
||||
return SUGGESTED_PLUGIN_MARKETPLACES.filter((preset) => !existing.has(canonicalMarketplaceKey(preset.source)));
|
||||
}
|
||||
|
||||
interface PluginsCatalogState {
|
||||
catalog: AgentPluginCatalog;
|
||||
loaded: boolean;
|
||||
|
||||
@@ -29,6 +29,7 @@ describe("agent chat settings", () => {
|
||||
codeFontSize: 13,
|
||||
defaults: {},
|
||||
mcpServers: {},
|
||||
mcpRegistryUrl: "",
|
||||
skills: {},
|
||||
memory: {
|
||||
autoMemory: "inherit",
|
||||
|
||||
@@ -309,6 +309,7 @@ export const DEFAULT_SETTINGS: ValidSettings = {
|
||||
confirmTerminateOnClose: true,
|
||||
defaults: {},
|
||||
mcpServers: {},
|
||||
mcpRegistryUrl: "",
|
||||
skills: {},
|
||||
memory: {
|
||||
autoMemory: "inherit",
|
||||
@@ -383,6 +384,8 @@ function agentMcpServers(v: unknown): Required<AgentSettings>["mcpServers"] {
|
||||
const url = typeof s.url === "string" && s.url.trim() ? s.url.trim() : null;
|
||||
const headers = stringMap(s.headers);
|
||||
const agents = stringList(s.agents);
|
||||
const registryName = typeof s.registryName === "string" && s.registryName.trim() ? s.registryName.trim() : null;
|
||||
const registryUrl = typeof s.registryUrl === "string" && s.registryUrl.trim() ? s.registryUrl.trim() : null;
|
||||
out[name] = {
|
||||
transport,
|
||||
enabled,
|
||||
@@ -392,6 +395,8 @@ function agentMcpServers(v: unknown): Required<AgentSettings>["mcpServers"] {
|
||||
...(url ? { url } : {}),
|
||||
...(Object.keys(headers).length ? { headers } : {}),
|
||||
...(agents.length ? { agents } : {}),
|
||||
...(registryName ? { registryName } : {}),
|
||||
...(registryUrl ? { registryUrl } : {}),
|
||||
};
|
||||
}
|
||||
return out;
|
||||
@@ -634,6 +639,7 @@ export function validateSettings(raw: Settings | unknown): ValidSettings {
|
||||
confirmTerminateOnClose: bool(agents.confirmTerminateOnClose, d.agents.confirmTerminateOnClose),
|
||||
defaults: agentDefaults(agents.defaults),
|
||||
mcpServers: agentMcpServers(agents.mcpServers),
|
||||
mcpRegistryUrl: typeof agents.mcpRegistryUrl === "string" ? agents.mcpRegistryUrl.trim() : "",
|
||||
skills: agentSkillPolicies(agents.skills),
|
||||
memory: agentMemorySettings(agents.memory),
|
||||
plugins: agentPluginSettings(agents.plugins),
|
||||
|
||||
@@ -5366,5 +5366,50 @@
|
||||
"Select Service Item": "Select Service Item",
|
||||
"Tomcat did not confirm the deployment change for {name}.": "Tomcat did not confirm the deployment change for {name}.",
|
||||
"Next line / next suggestion": "Next line / next suggestion",
|
||||
"Previous line / previous suggestion": "Previous line / previous suggestion"
|
||||
"Previous line / previous suggestion": "Previous line / previous suggestion",
|
||||
"Suggested Marketplaces": "Suggested Marketplaces",
|
||||
"Custom Registry…": "Custom Registry…",
|
||||
"Install to Global (settings.toml)": "Install to Global (settings.toml)",
|
||||
"Install to Project (.openidea/settings.toml)": "Install to Project (.openidea/settings.toml)",
|
||||
"MCP Registry browsing is unavailable in this environment.": "MCP Registry browsing is unavailable in this environment.",
|
||||
"MCP registry source": "MCP registry source",
|
||||
"Install target scope": "Install target scope",
|
||||
"{count} servers": "{count} servers",
|
||||
"Refresh registry": "Refresh registry",
|
||||
"Custom MCP registry URL": "Custom MCP registry URL",
|
||||
"Use Registry": "Use Registry",
|
||||
"Loading MCP registry…": "Loading MCP registry…",
|
||||
"No MCP servers matching “{query}”.": "No MCP servers matching “{query}”.",
|
||||
"No MCP servers found in this registry.": "No MCP servers found in this registry.",
|
||||
"MCP Registry servers": "MCP Registry servers",
|
||||
"{count} GitHub stars": "{count} GitHub stars",
|
||||
"Installed (Project)": "Installed (Project)",
|
||||
"Needs {cmd}": "Needs {cmd}",
|
||||
"Manual setup": "Manual setup",
|
||||
"Registry ID": "Registry ID",
|
||||
"Publisher": "Publisher",
|
||||
"License": "License",
|
||||
"Missing {cmd} on PATH": "Missing {cmd} on PATH",
|
||||
"{count} inputs": "{count} inputs",
|
||||
"Configure & Install…": "Configure & Install…",
|
||||
"Customize Install…": "Customize Install…",
|
||||
"Loading more servers…": "Loading more servers…",
|
||||
"Server name is required": "Server name is required",
|
||||
"Required field missing: {name}": "Required field missing: {name}",
|
||||
"Install MCP Server — {name}": "Install MCP Server — {name}",
|
||||
"Global (settings.toml)": "Global (settings.toml)",
|
||||
"Project (.openidea/settings.toml)": "Project (.openidea/settings.toml)",
|
||||
"runtime missing": "runtime missing",
|
||||
"`{cmd}` was not found on PATH. Install it before using this server.": "`{cmd}` was not found on PATH. Install it before using this server.",
|
||||
"Leave all unselected to enable this server for every agent.": "Leave all unselected to enable this server for every agent.",
|
||||
"Stored in OS Keychain": "Stored in OS Keychain",
|
||||
"Search MCP registry...": "Search MCP registry...",
|
||||
"Search MCP registry": "Search MCP registry",
|
||||
"Installed {name} into Project MCP servers.": "Installed {name} into Project MCP servers.",
|
||||
"Installed {name} into Global MCP servers.": "Installed {name} into Global MCP servers.",
|
||||
"Uninstalled {name}.": "Uninstalled {name}.",
|
||||
"GitHub MCP Registry": "GitHub MCP Registry",
|
||||
"Official MCP Registry": "Official MCP Registry",
|
||||
"Official GitHub Copilot plugins marketplace": "Official GitHub Copilot plugins marketplace",
|
||||
"Official Anthropic Claude plugins marketplace": "Official Anthropic Claude plugins marketplace"
|
||||
}
|
||||
@@ -12260,5 +12260,50 @@
|
||||
"Select Service Item": "选择服务项",
|
||||
"Tomcat did not confirm the deployment change for {name}.": "Tomcat 未确认 {name} 的部署变更。",
|
||||
"Next line / next suggestion": "下一行 / 下一个建议",
|
||||
"Previous line / previous suggestion": "上一行 / 上一个建议"
|
||||
"Previous line / previous suggestion": "上一行 / 上一个建议",
|
||||
"Suggested Marketplaces": "推荐市场",
|
||||
"Custom Registry…": "自定义注册表…",
|
||||
"Install to Global (settings.toml)": "安装到全局 (settings.toml)",
|
||||
"Install to Project (.openidea/settings.toml)": "安装到项目 (.openidea/settings.toml)",
|
||||
"MCP Registry browsing is unavailable in this environment.": "当前环境不可浏览 MCP 注册表。",
|
||||
"MCP registry source": "MCP 注册表源",
|
||||
"Install target scope": "安装目标范围",
|
||||
"{count} servers": "{count} 个服务器",
|
||||
"Refresh registry": "刷新注册表",
|
||||
"Custom MCP registry URL": "自定义 MCP 注册表 URL",
|
||||
"Use Registry": "使用注册表",
|
||||
"Loading MCP registry…": "正在加载 MCP 注册表…",
|
||||
"No MCP servers matching “{query}”.": "未找到匹配“{query}”的 MCP 服务器。",
|
||||
"No MCP servers found in this registry.": "此注册表中未找到 MCP 服务器。",
|
||||
"MCP Registry servers": "MCP 注册表服务器",
|
||||
"{count} GitHub stars": "{count} 个 GitHub 星标",
|
||||
"Installed (Project)": "已安装(项目)",
|
||||
"Needs {cmd}": "需要 {cmd}",
|
||||
"Manual setup": "手动配置",
|
||||
"Registry ID": "注册表 ID",
|
||||
"Publisher": "发布者",
|
||||
"License": "许可证",
|
||||
"Missing {cmd} on PATH": "PATH 中未找到 {cmd}",
|
||||
"{count} inputs": "{count} 个参数",
|
||||
"Configure & Install…": "配置并安装…",
|
||||
"Customize Install…": "自定义安装…",
|
||||
"Loading more servers…": "正在加载更多服务器…",
|
||||
"Server name is required": "需要填写服务器名称",
|
||||
"Required field missing: {name}": "缺少必填项:{name}",
|
||||
"Install MCP Server — {name}": "安装 MCP 服务器 — {name}",
|
||||
"Global (settings.toml)": "全局 (settings.toml)",
|
||||
"Project (.openidea/settings.toml)": "项目 (.openidea/settings.toml)",
|
||||
"runtime missing": "缺少运行时",
|
||||
"`{cmd}` was not found on PATH. Install it before using this server.": "未在 PATH 中找到 `{cmd}`。请先安装再使用此服务器。",
|
||||
"Leave all unselected to enable this server for every agent.": "全部不选则为所有代理启用此服务器。",
|
||||
"Stored in OS Keychain": "存储在系统钥匙串中",
|
||||
"Search MCP registry...": "搜索 MCP 注册表...",
|
||||
"Search MCP registry": "搜索 MCP 注册表",
|
||||
"Installed {name} into Project MCP servers.": "已将 {name} 安装到项目 MCP 服务器。",
|
||||
"Installed {name} into Global MCP servers.": "已将 {name} 安装到全局 MCP 服务器。",
|
||||
"Uninstalled {name}.": "已卸载 {name}。",
|
||||
"GitHub MCP Registry": "GitHub MCP 注册表",
|
||||
"Official MCP Registry": "官方 MCP 注册表",
|
||||
"Official GitHub Copilot plugins marketplace": "GitHub Copilot 官方插件市场",
|
||||
"Official Anthropic Claude plugins marketplace": "Anthropic Claude 官方插件市场"
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача