feat(mcp): add MCP extension support with routes and configuration

This commit is contained in:
Ramkumar Chinchani
2025-05-22 23:24:55 +00:00
parent 8a99a3ed23
commit 56afa6bd42
7 changed files with 653 additions and 0 deletions
+4
View File
@@ -496,6 +496,10 @@ func (c *Config) IsMgmtEnabled() bool {
return c.IsSearchEnabled()
}
func (c *Config) IsMCPEnabled() bool {
return c.Extensions != nil && c.Extensions.MCP != nil && *c.Extensions.MCP.Enable
}
func (c *Config) IsImageTrustEnabled() bool {
return c.Extensions != nil && c.Extensions.Trust != nil && *c.Extensions.Trust.Enable
}
+5
View File
@@ -33,4 +33,9 @@ const (
UserPrefs = "/userprefs"
ExtUserPrefs = ExtPrefix + UserPrefs
FullUserPrefs = RoutePrefix + ExtUserPrefs
// mcp extension.
MCP = "/mcp"
ExtMCP = ExtPrefix + MCP
FullMCP = RoutePrefix + ExtMCP
)
+1
View File
@@ -212,6 +212,7 @@ func (rh *RouteHandler) SetupRoutes() {
rh.c.Log)
ext.SetupImageTrustRoutes(rh.c.Config, prefixedRouter, rh.c.MetaDB, rh.c.Log)
ext.SetupMgmtRoutes(rh.c.Config, prefixedRouter, rh.c.Log)
ext.SetupMCPRoutes(rh.c.Config, prefixedRouter, rh.c.StoreController, rh.c.MetaDB, rh.c.Log)
ext.SetupUserPreferencesRoutes(rh.c.Config, prefixedRouter, rh.c.MetaDB, rh.c.Log)
// last should always be UI because it will setup a http.FileServer and paths will be resolved by this FileServer.
ext.SetupUIRoutes(rh.c.Config, rh.c.Router, rh.c.Log)