The company's MCP tools under the guardrails, a rate and a breaker
CI / test (push) Successful in 5m35s
CI / test (push) Successful in 5m35s
A tool's answer is read by the caller's policies as the prompt it becomes, so an instruction planted in a ticket is withheld and personal data redacted; its arguments are read before they leave. ctl mcp add --rate bounds each caller's calls a minute to a server (migration 0050), and five failures in a row take a server out for a minute, its tools off the list. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6bef138c23
commit
3a4488b41e
12 files changed
+297
-14
No files matched your search
@@ -38,6 +38,7 @@ type MCPServerView struct {
|
||||
HeaderRefs map[string]string `json:"header_refs,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
|
||||
RatePerMinute int `json:"rate_per_minute,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
CreatedBy string `json:"created_by,omitempty"`
|
||||
}
|
||||
@@ -53,6 +54,9 @@ type MCPServerRequest struct {
|
||||
Secrets map[string]string `json:"secrets,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
|
||||
// RatePerMinute bounds each caller's calls to its tools; a negative
|
||||
// number takes the bound away.
|
||||
RatePerMinute int `json:"rate_per_minute,omitempty"`
|
||||
}
|
||||
|
||||
// MCPTestView is what the server said when asked: its tools, or why not.
|
||||
@@ -64,7 +68,7 @@ type MCPTestView struct {
|
||||
|
||||
func mcpServerView(m store.MCPServer) MCPServerView {
|
||||
return MCPServerView{Name: m.Name, URL: m.URL, Description: m.Description, Headers: m.Headers,
|
||||
HeaderRefs: m.HeaderRefs, Enabled: m.Enabled, TimeoutSeconds: int(m.Timeout / time.Second),
|
||||
HeaderRefs: m.HeaderRefs, Enabled: m.Enabled, TimeoutSeconds: int(m.Timeout / time.Second), RatePerMinute: m.RatePerMinute,
|
||||
CreatedAt: m.CreatedAt, CreatedBy: m.CreatedBy}
|
||||
}
|
||||
|
||||
@@ -192,6 +196,12 @@ func (a *API) mcpServerFrom(ctx context.Context, name string, req MCPServerReque
|
||||
if req.TimeoutSeconds > 0 {
|
||||
m.Timeout = time.Duration(req.TimeoutSeconds) * time.Second
|
||||
}
|
||||
switch {
|
||||
case req.RatePerMinute > 0:
|
||||
m.RatePerMinute = req.RatePerMinute
|
||||
case req.RatePerMinute < 0:
|
||||
m.RatePerMinute = 0
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user