Skip to content
Merged
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
16 changes: 8 additions & 8 deletions pkgs/mcpx/docs/spec/conformance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,8 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement
| [tools-declare-capability](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | MUST | server | tested: `conformance.TestFeaturesServer/2025-03-26/tools/tools-declare-capability` | n/a: addresses the other side |
| [tools-list-changed-means-emit](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | (definition) | server | tested: `conformance.TestFeaturesServer/2025-03-26/tools/tools-list-changed-means-emit` | n/a: addresses the other side |
| [tools-list-changed-notify](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#list-changed-notification) | SHOULD | server | tested: `conformance.TestFeaturesServer/2025-03-26/tools/tools-list-changed-notify` | n/a: addresses the other side |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | **gap** #257: destructiveHint from any upstream decides whether a call is confirmed; a false hint (or readOnlyHint true) is trusted |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | **gap** #257: the consumer confirmDestructive gate is decided by an untrusted upstream annotation |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-result-iserror-for-tool-errors](https://modelcontextprotocol.io/specification/2026-07-28/schema#calltoolresult) | SHOULD | server | tested: `conformance.TestFeaturesServer/2025-03-26/tools/tools-result-iserror-for-tool-errors` | n/a: addresses the other side |
| [tools-result-lookup-errors-protocol](https://modelcontextprotocol.io/specification/2026-07-28/schema#calltoolresult) | should (lowercase) | server | tested: `conformance.TestFeaturesServer/2025-03-26/tools/tools-result-lookup-errors-protocol` | n/a: addresses the other side |
| [tools-error-unknown-tool-protocol](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#error-handling) | (classification) | server | tested: `conformance.TestFeaturesServer/2025-03-26/tools/tools-error-unknown-tool-protocol` | n/a: addresses the other side |
Expand Down Expand Up @@ -1105,8 +1105,8 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement
| [tools-declare-capability](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | MUST | server | tested: `conformance.TestFeaturesServer/2025-06-18/tools/tools-declare-capability` | n/a: addresses the other side |
| [tools-list-changed-means-emit](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | (definition) | server | tested: `conformance.TestFeaturesServer/2025-06-18/tools/tools-list-changed-means-emit` | n/a: addresses the other side |
| [tools-list-changed-notify](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#list-changed-notification) | SHOULD | server | tested: `conformance.TestFeaturesServer/2025-06-18/tools/tools-list-changed-notify` | n/a: addresses the other side |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | **gap** #257: destructiveHint from any upstream decides whether a call is confirmed; a false hint (or readOnlyHint true) is trusted |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | **gap** #257: the consumer confirmDestructive gate is decided by an untrusted upstream annotation |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-result-iserror-for-tool-errors](https://modelcontextprotocol.io/specification/2026-07-28/schema#calltoolresult) | SHOULD | server | tested: `conformance.TestFeaturesServer/2025-06-18/tools/tools-result-iserror-for-tool-errors` | n/a: addresses the other side |
| [tools-result-lookup-errors-protocol](https://modelcontextprotocol.io/specification/2026-07-28/schema#calltoolresult) | should (lowercase) | server | tested: `conformance.TestFeaturesServer/2025-06-18/tools/tools-result-lookup-errors-protocol` | n/a: addresses the other side |
| [tools-error-unknown-tool-protocol](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#error-handling) | (classification) | server | tested: `conformance.TestFeaturesServer/2025-06-18/tools/tools-error-unknown-tool-protocol` | n/a: addresses the other side |
Expand Down Expand Up @@ -1703,8 +1703,8 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement
| [tools-declare-capability](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | MUST | server | tested: `conformance.TestFeaturesServer/2025-11-25/tools/tools-declare-capability` | n/a: addresses the other side |
| [tools-list-changed-means-emit](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | (definition) | server | tested: `conformance.TestFeaturesServer/2025-11-25/tools/tools-list-changed-means-emit` | n/a: addresses the other side |
| [tools-list-changed-notify](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#list-changed-notification) | SHOULD | server | tested: `conformance.TestFeaturesServer/2025-11-25/tools/tools-list-changed-notify` | n/a: addresses the other side |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | **gap** #257: destructiveHint from any upstream decides whether a call is confirmed; a false hint (or readOnlyHint true) is trusted |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | **gap** #257: the consumer confirmDestructive gate is decided by an untrusted upstream annotation |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-inputschema-no-params-recommended](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | RECOMMENDED | server | tested: `conformance.TestFeaturesServer/2025-11-25/tools/tools-inputschema-no-params-recommended` | n/a: addresses the other side |
| [tools-name-length](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool-names) | SHOULD | server | tested: `conformance.TestFeaturesServer/2025-11-25/tools/tools-name-length` | n/a: addresses the other side |
| [tools-name-case-sensitive](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool-names) | SHOULD | both | tested: `conformance.TestFeaturesServer/2025-11-25/tools/tools-name-case-sensitive` | tested: `conformance.TestFeaturesClient/2025-11-25/tools/tools-name-case-sensitive` |
Expand Down Expand Up @@ -2407,8 +2407,8 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement
| [tools-list-may-vary-by-auth](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | MAY | server | n/a: optional feature mcpx does not implement | n/a: addresses the other side |
| [tools-list-may-be-empty-change](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | MAY | server | tested: `conformance.TestFeaturesServer/2026-07-28/tools/tools-list-may-be-empty-change` | n/a: addresses the other side |
| [tools-list-deterministic-order](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities) | SHOULD | server | tested: `conformance.TestFeaturesServer/2026-07-28/tools/tools-list-deterministic-order` | n/a: addresses the other side |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | **gap** #257: destructiveHint from any upstream decides whether a call is confirmed; a false hint (or readOnlyHint true) is trusted |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | **gap** #257: the consumer confirmDestructive gate is decided by an untrusted upstream annotation |
| [tools-annotations-untrusted](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MUST | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-annotations-hints-no-decisions](https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations) | should (lowercase, schema) | client | n/a: addresses the other side | tested: `daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2026-07-28` |
| [tools-inputschema-no-params-recommended](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | RECOMMENDED | server | tested: `conformance.TestFeaturesServer/2026-07-28/tools/tools-inputschema-no-params-recommended` | n/a: addresses the other side |
| [tools-x-mcp-header-may](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#tool) | MAY | server | n/a: optional feature mcpx does not implement | n/a: addresses the other side |
| [tools-x-mcp-header-not-empty](https://modelcontextprotocol.io/specification/2026-07-28/server/tools#x-mcp-header) | MUST NOT | server | n/a: no tool mcpx serves declares an x-mcp-header parameter | n/a: addresses the other side |
Expand Down
3 changes: 2 additions & 1 deletion pkgs/mcpx/internal/api/boundaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func Boundaries() []Boundary {
{
Name: "elicit.confirmDestructive",
Declares: "with it on, a call to a tool that may be destructive (annotated " +
"destructiveHint, or unannotated) does not run unless somebody confirms it",
"destructiveHint, or unannotated) does not run unless somebody confirms it; " +
"a remote server's annotation never clears the call (#2191)",
State: Enforced,
Refusals: []string{
"TestADestructiveCallIsRefusedWhenNobodyConfirms",
Expand Down
7 changes: 5 additions & 2 deletions pkgs/mcpx/internal/conformance/coverage_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ func init() {
C("tools-aggregator-disambiguate", "e2e.TestDuplicateNamespaceIsRejected@2026-07-28",
"e2e.TestAliasExposesASubsetOfTheSameServer@2026-07-28"),
C("tools-aggregator-not-by-servername", "e2e.TestDuplicateNamespaceIsRejected@2026-07-28"),
// Annotation trust (#2191): the confirmDestructive gate takes
// annotations at face value only from a locally declared (stdio)
// server; a remote upstream's hints never clear a call.
C("tools-annotations-untrusted", "daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2024-11-05,2025-03-26,2025-06-18,2025-11-25,2026-07-28"),
C("tools-annotations-hints-no-decisions", "daemon.TestAnnotationClearsCallOnlyForLocallyDeclaredServers@2024-11-05,2025-03-26,2025-06-18,2025-11-25,2026-07-28"),
SReq("conformance.TestFeaturesServer",
"resources-sec-binary-encoded",
"tools-declare-capability",
Expand Down Expand Up @@ -102,8 +107,6 @@ func init() {
registerGaps(
Gap{ID: "resources-annotations-defs", Side: Client, Issue: "#207", Why: "mcpclient.Resource has no annotations field; they are dropped on parse"},
Gap{ID: "tools-display-name-precedence", Side: Client, Issue: "#207", Why: "tool title and annotations.title are carried but nothing that displays a tool uses them"},
Gap{ID: "tools-annotations-untrusted", Side: Client, Issue: "#257", Why: "destructiveHint from any upstream decides whether a call is confirmed; a false hint (or readOnlyHint true) is trusted"},
Gap{ID: "tools-annotations-hints-no-decisions", Side: Client, Issue: "#257", Why: "the consumer confirmDestructive gate is decided by an untrusted upstream annotation"},
Gap{ID: "prompts-validate-io", Side: Client, Issue: "#257", Why: "an upstream prompts/get result is passed on unvalidated"},
)
}
26 changes: 24 additions & 2 deletions pkgs/mcpx/internal/daemon/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,15 @@ func (r *Registry) confirmDestructive(ctx context.Context, p *pool.Pool, tool st
break
}
}
if found == nil || !destructiveHint(found.Annotations) {
if found == nil || annotationClearsCall(p, found) {
return nil
}
path := p.Namespace() + "." + tool
req := elicit.Confirmation(elicit.Ask{
Server: p.Name(),
Tool: tool,
Session: cc.SessionID,
Message: fmt.Sprintf("%s.%s may be destructive: its server does not mark it read-only or non-destructive. Let this call proceed?",
Message: fmt.Sprintf("%s.%s may be destructive: no trusted annotation clears this call. Let this call proceed?",
p.Namespace(), tool),
Default: "false",
TTL: r.consumer.AskTimeout,
Expand All @@ -436,6 +436,28 @@ func (r *Registry) confirmDestructive(ctx context.Context, p *pool.Pool, tool st
return nil
}

// annotationClearsCall reports whether a tool's annotations may clear
// its call without asking. Tool annotations are hints, not decisions
// (#2191): the specification forbids basing a security decision on
// annotations from an untrusted server, and mcpx establishes trust in
// exactly one way today -- the server is one the user declared locally,
// a stdio command from their own configuration, whose annotations are
// part of the interface they chose to run. A remote upstream's
// readOnlyHint or destructiveHint:false is worth nothing here: a lying
// or compromised server could suppress every confirmation by claiming
// its tools are harmless, so for a remote server the annotation can
// never be the deciding input and the call is confirmed when in doubt.
func annotationClearsCall(p *pool.Pool, found *mcpclient.Tool) bool {
if p == nil || found == nil {
return false
}
cfg := p.Config()
if cfg == nil || !cfg.Stdio() {
return false
}
return !destructiveHint(found.Annotations)
}

// destructiveHint reads the one annotation mcpx acts on, with the
// specification's defaults: destructiveHint is true when absent, and means
// something only when readOnlyHint is not true. An absent hint was read as
Expand Down
40 changes: 40 additions & 0 deletions pkgs/mcpx/internal/daemon/destructive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package daemon
import (
"encoding/json"
"testing"

"github.com/dezren39/mcpx/internal/config"
"github.com/dezren39/mcpx/internal/mcpclient"
"github.com/dezren39/mcpx/internal/pool"
)

// The specification's ToolAnnotations: destructiveHint defaults to true and
Expand All @@ -27,3 +31,39 @@ func TestDestructiveHintUsesTheSpecDefaults(t *testing.T) {
}
}
}

// Annotations are hints, not decisions (#2191): a remote upstream's
// claim that its tool is read-only or non-destructive must never clear
// the confirmation, because a lying server could suppress every ask.
// Only a locally declared (stdio) server's annotations are taken at
// face value -- that server is the user's own configured command.
func TestAnnotationClearsCallOnlyForLocallyDeclaredServers(t *testing.T) {
tool := func(raw string) *mcpclient.Tool {
return &mcpclient.Tool{Name: "wipe", Annotations: json.RawMessage(raw)}
}
local := pool.New(&config.Resolved{Server: &config.Server{Command: "demo"}})
remote := pool.New(&config.Resolved{Server: &config.Server{URL: "https://upstream.example/mcp"}})
for _, c := range []struct {
name string
p *pool.Pool
raw string
want bool
}{
{"local read-only clears", local, `{"readOnlyHint":true}`, true},
{"local non-destructive clears", local, `{"destructiveHint":false}`, true},
{"local destructive does not clear", local, `{"destructiveHint":true}`, false},
{"local unannotated does not clear", local, ``, false},
{"remote read-only does not clear", remote, `{"readOnlyHint":true}`, false},
{"remote non-destructive does not clear", remote, `{"destructiveHint":false}`, false},
{"remote read-only and non-destructive does not clear", remote, `{"readOnlyHint":true,"destructiveHint":false}`, false},
} {
t.Run(c.name, func(t *testing.T) {
if got := annotationClearsCall(c.p, tool(c.raw)); got != c.want {
t.Errorf("annotationClearsCall(%s) = %v, want %v", c.raw, got, c.want)
}
})
}
if annotationClearsCall(nil, tool(`{"readOnlyHint":true}`)) {
t.Error("a nil pool must never clear a call")
}
}
6 changes: 5 additions & 1 deletion pkgs/mcpx/internal/settings/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ func consumerSettings() []Setting {
"client uses it to ask before acting. The specification's " +
"defaults apply: a tool not annotated readOnlyHint, and not " +
"annotated destructiveHint false, may be destructive, so an " +
"unannotated tool is asked about too. A script has no such step. " +
"unannotated tool is asked about too. Annotations are hints, " +
"not proof: a remote server's readOnlyHint or destructiveHint " +
"false never clears a call (#2191) -- only a locally declared " +
"(stdio) server's annotations are taken at face value. " +
"A script has no such step. " +
"Turning this on gives it one. Off by default: it puts a question " +
"on the path of every destructive call, and a caller that cannot " +
"answer waits out the deadline before the call proceeds.",
Expand Down
Loading