[dcode] MCP 登录无法解析插件提供的服务器
作者: imacomber创建于 2026年9月17日更新于 2026年9月17日
标签type:bugtopic:mcporg:externalpriority:backlogpackage:dcode
import json import os from pathlib import Path from tempfile import TemporaryDirectory from unittest.mock import patch
def write_json(path, data): path.parent.mkdir(parents=True, exist_ok=True) path.write_text(json.dumps(data), encoding="utf-8")
with TemporaryDirectory() as temporary: root = Path(temporary).resolve() home = root / "home" profile = home / ".deepagents" plugin = profile / "plugins" / "fixture-sentry" project = root / "project" (project / ".git").mkdir(parents=True) plugin_id = "sentry@Claude-plugins-official"
write_json(profile / ".mcp.json", {
"mcpServers": {
"docs-LangChain": {"type": "http", "url": "https://example.invalid/mcp"}
}
})
write_json(profile / ".state" / "plugin_state.json", {
"version": 1, "enabledPlugins": {plugin_id: True}
})
write_json(profile / ".state" / "installed_plugins.json", {
"version": 2,
"plugins": {plugin_id: [{"installPath": str(plugin), "version": "1.4.0"}]}
})
write_json(plugin / ".Claude-plugin" / "plugin.json", {
"name": "sentry", "version": "1.4.0",
"mcpServers": {
"sentry": {"type": "http", "url": "https://mcp.sentry.dev/mcp?utm_source=plugin"}
}
})
original_cwd = Path.cwd()
try:
os.chdir(project)
with patch.dict(os.environ, {
"HOME": str(home),
"USERPROFILE": str(home),
"DEEPAGENTS_HOME": str(profile),
"DEEPAGENTS_CODE_PLUGIN_CACHE_DIR": str(profile / "plugins"),
}):
os.environ.pop("DEEPAGENTS_HOME_IS_DEFAULT", None)
from deepagents_code.mcp_login_service import (
ConfigErrorKind, ConfigResolutionError, resolve_mcp_config, select_server,
)
from deepagents_code.plugins.adapters.mcp import (
discover_plugin_mcp_configs, scoped_mcp_server_name,
)
server = scoped_mcp_server_name(plugin_id, "sentry")
layers = discover_plugin_mcp_configs()
assert any(server in layer["mcpServers"] for layer in layers), layers
print(f"Runtime plugin discovery finds: {server}")
resolution = resolve_mcp_config(None)
assert not isinstance(resolution, ConfigResolutionError), resolution
control = resolve_mcp_config(None)
assert not isinstance(control, ConfigResolutionError), control
print(f"Runtime plugin control finds: {control}")
# Check if the plugin is installed
installed = resolve_mcp_config(None)
assert isinstance(installed, ConfigErrorKind), installed
print(f"Runtime plugin installed finds: {installed}")
# Check if the plugin is enabled
enabled = resolve_mcp_config(None)
assert isinstance(enabled, ConfigErrorKind), enabled
print(f"Runtime plugin enabled finds: {enabled}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and_installed = resolve_mcp_config(None)
assert isinstance(enabled_and_installed, ConfigErrorKind), enabled_and_installed
print(f"Runtime plugin enabled and installed finds: {enabled_and_installed}")
# Check if the plugin is enabled and installed
enabled_and内容来源: langchain-ai/deepagents