Refactor MCP server configuration structure in E2E tests and agent management

- Change the MCP server configuration from a map to a slice in both the E2E test helper functions and the agent management code, improving consistency in data representation.
- Update the test cases to reflect the new server structure, ensuring compatibility with the modified MCP configuration.
This commit is contained in:
Max 2026-03-03 09:33:39 +08:00
parent 38abd0e95b
commit b4a9132dae
3 changed files with 14 additions and 14 deletions

View file

@ -583,9 +583,9 @@ func TestScanDependencies(t *testing.T) {
os.WriteFile(filepath.Join(assistantDir, "package.yao"), []byte(`{
"name":"test-scan",
"mcp": {
"servers": {
"rag": {"server_id": "yao.rag-tools"}
}
"servers": [
{"server_id": "yao.rag-tools"}
]
}
}`), 0644)
@ -610,9 +610,9 @@ func TestScanDependenciesSkipUnscoped(t *testing.T) {
os.WriteFile(filepath.Join(assistantDir, "package.yao"), []byte(`{
"name":"test-local",
"mcp": {
"servers": {
"echo": {"server_id": "echo"}
}
"servers": [
{"server_id": "echo"}
]
}
}`), 0644)

View file

@ -19,7 +19,7 @@ type packageYao struct {
}
type mcpConfig struct {
Servers map[string]mcpServerEntry `json:"servers,omitempty"`
Servers []mcpServerEntry `json:"servers,omitempty"`
}
type mcpServerEntry struct {

View file

@ -178,9 +178,9 @@ func buildV2AgentApp(t *testing.T) string {
"options": { "temperature": 0.5 },
"public": false,
"mcp": {
"servers": {
"registry-mcp": { "server_id": "`+testScope+`.registry-mcp" }
}
"servers": [
{ "server_id": "`+testScope+`.registry-mcp" }
]
},
"tags": ["Test", "Registry", "V2"],
"sort": 999,
@ -309,10 +309,10 @@ func buildV2AnalyticsApp(t *testing.T) string {
"options": { "temperature": 0.2 },
"public": false,
"mcp": {
"servers": {
"registry-mcp": { "server_id": "`+testScope+`.registry-mcp" },
"data-tools": { "server_id": "`+testScope+`.data-tools" }
}
"servers": [
{ "server_id": "`+testScope+`.registry-mcp" },
{ "server_id": "`+testScope+`.data-tools" }
]
},
"tags": ["Test", "Registry", "Analytics", "V2"],
"sort": 998,