Phase 11, part 5: the JSON API
/api/v1 offers the MCP tools as plain HTTP for scripts: GET /api/v1/tools lists what a key may call, POST /api/v1/<tool> calls one with JSON. Each call goes through /mcp internally, so keys, scopes, limits, logging and approvals are the same. /api/v1/docs documents every tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -215,7 +215,7 @@ func (s *Server) csrf(next http.Handler) http.Handler {
|
||||
if c, err := r.Cookie(name); err == nil && len(c.Value) >= 32 {
|
||||
token = c.Value
|
||||
}
|
||||
if !safeMethod(r.Method) && r.URL.Path != "/mcp" {
|
||||
if !safeMethod(r.Method) && r.URL.Path != "/mcp" && !strings.HasPrefix(r.URL.Path, "/api/v1/") {
|
||||
if token == "" || !sameToken(token, sentToken(r)) {
|
||||
http.Error(w, "This form has expired: reload the page and try again.", http.StatusForbidden)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user