Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/shared/types/app_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type AppManifest struct {
Workflows map[string]Workflow `json:"workflows,omitempty" yaml:"workflows,flow,omitempty"`
OutgoingDomains *[]string `json:"outgoing_domains,omitempty" yaml:"outgoing_domains,flow,omitempty"`
ExternalAuthProviders *ManifestAuthProviders `json:"external_auth_providers,omitempty" yaml:"external_auth_providers,flow,omitempty"`
MCPServers map[string]MCPServer `json:"mcp_servers,omitempty" yaml:"mcp_servers,flow,omitempty"`
}

type ManifestMetadata struct {
Expand Down Expand Up @@ -157,6 +158,13 @@ type ManifestAuthProviders struct {
OAuth2 map[string]*RawJSON `json:"oauth2" yaml:"oauth2"`
}

// MCPServer defines the configuration of an MCP server in the app manifest.
type MCPServer struct {
URL string `json:"url" yaml:"url"`
AuthProviderKey string `json:"auth_provider_key,omitempty" yaml:"auth_provider_key,omitempty"`
AuthType string `json:"auth_type,omitempty" yaml:"auth_type,omitempty"`
}

type RawJSON struct {
Data *yaml.MapSlice
JSONData *json.RawMessage
Expand Down
70 changes: 70 additions & 0 deletions internal/shared/types/app_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,76 @@ func Test_AppManifest_OAuthConfig_Scopes(t *testing.T) {
}
}

func Test_AppManifest_MCPServers(t *testing.T) {
tests := map[string]struct {
manifest AppManifest
expectedJSON string
}{
"undefined mcp_servers are omitted": {
manifest: AppManifest{},
expectedJSON: `{"display_information":{"name":""}}`,
},
"nil mcp_servers are omitted": {
manifest: AppManifest{MCPServers: nil},
expectedJSON: `{"display_information":{"name":""}}`,
},
"mcp_servers with url only": {
manifest: AppManifest{MCPServers: map[string]MCPServer{
"acme": {URL: "https://mcp.acme.com/mcp"},
}},
expectedJSON: `{"display_information":{"name":""},"mcp_servers":{"acme":{"url":"https://mcp.acme.com/mcp"}}}`,
},
"mcp_servers with auth_provider_key": {
manifest: AppManifest{MCPServers: map[string]MCPServer{
"acme": {
URL: "https://mcp.acme.com/mcp",
AuthProviderKey: "acme",
},
}},
expectedJSON: `{"display_information":{"name":""},"mcp_servers":{"acme":{"url":"https://mcp.acme.com/mcp","auth_provider_key":"acme"}}}`,
},
"mcp_servers with auth_type": {
manifest: AppManifest{MCPServers: map[string]MCPServer{
"acme": {
URL: "https://mcp.acme.com/mcp",
AuthType: "dynamic_client_registration",
},
}},
expectedJSON: `{"display_information":{"name":""},"mcp_servers":{"acme":{"url":"https://mcp.acme.com/mcp","auth_type":"dynamic_client_registration"}}}`,
},
"mcp_servers with all fields": {
manifest: AppManifest{MCPServers: map[string]MCPServer{
"acme": {
URL: "https://mcp.acme.com/mcp",
AuthProviderKey: "acme",
AuthType: "manual_auth",
},
}},
expectedJSON: `{"display_information":{"name":""},"mcp_servers":{"acme":{"url":"https://mcp.acme.com/mcp","auth_provider_key":"acme","auth_type":"manual_auth"}}}`,
},
"multiple mcp_servers": {
manifest: AppManifest{MCPServers: map[string]MCPServer{
"acme": {URL: "https://mcp.acme.com/mcp"},
"other": {URL: "https://mcp.other.com/mcp", AuthType: "no_auth"},
}},
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
actualJSON, err := json.Marshal(tc.manifest)
require.NoError(t, err)
if tc.expectedJSON != "" {
assert.Equal(t, tc.expectedJSON, string(actualJSON))
}
// Verify round-trip unmarshaling
var unmarshaled AppManifest
err = json.Unmarshal(actualJSON, &unmarshaled)
require.NoError(t, err)
assert.Equal(t, tc.manifest.MCPServers, unmarshaled.MCPServers)
})
}
}

func Test_AppManifest_AppSettings_FunctionRuntime(t *testing.T) {
tests := map[string]struct {
settings *AppSettings
Expand Down
Loading