Files
sm-seo-plugin/mcp.go
Jakub Zych cadf6ad805 feat: SEO by URL over the management API and MCP (tracer)
- PUT /_seo/api/v1/seo writes to the record behind a URL in its locale,
  else to an exact URL rule (force_rule writes a rule); the answer says
  where (D-11)
- management routes resolve the backend administrator from a token or
  the MCP dispatch and require golem15.seo.manage (D-10, D-15)
- MCP tool set_url_seo; history records via mcp
- classes.WithTx, FindOwner, SetURLSEO, SaveRule and DeleteRule
2026-10-27 12:06:31 +01:00

39 lines
1.4 KiB
Go

package seo
import (
"net/http"
apicontrollers "git.golem15.com/golem15/sm-seo-plugin/controllers/api"
"git.golem15.com/golem15/summercms/modules/pact"
)
var _ pact.HasMCP = (*Plugin)(nil)
// mcpGuard is the guard every SEO tool runs as: the backend account linked
// to the MCP user. The routes resolve that administrator themselves.
const mcpGuard = "backend"
// mcpPermission is the one SEO permission (D-15) every tool is listed with;
// the routes check it on every call.
const mcpPermission = apicontrollers.PermissionManage
// MCP declares the SEO tools (D-10, P-24): one per operation of the SEO
// admin, each bound to a /_seo/api/v1 management route, run as the backend
// account linked to the MCP user and listed only when that account has
// golem15.seo.manage. pier prefixes them with seo_. GET tools are
// read-only, so a read grant sees only those.
func (p *Plugin) MCP() pact.MCP {
return pact.MCP{Tools: []pact.MCPTool{
{
Name: "set_url_seo",
Title: "Set the SEO of a URL",
Description: "Changes the SEO values of a page addressed by URL. A record behind the URL gets the change in its SEO tab in the URL's locale; otherwise, or with force_rule, an exact URL rule is written. The answer says where it was written.",
Guard: mcpGuard,
Method: http.MethodPut,
Path: "/_seo/api/v1/seo",
Input: apicontrollers.SetSEOInput{},
Permissions: []string{mcpPermission},
},
}}
}