Skip to content

Commit f5f2015

Browse files
MCPGODEBUG update for 1.6.0 (#893)
1 parent e01639a commit f5f2015

4 files changed

Lines changed: 57 additions & 17 deletions

File tree

docs/mcpgodebug.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,39 @@
1818

1919
## `MCPGODEBUG` history
2020

21+
### 1.6.0
22+
23+
Options listed below were added and will be removed in the 1.8.0 version of the SDK.
24+
25+
- `seterroroverwrite` added. If set to `1`, `SetError` will always overwrite
26+
`Content` with the error text, restoring the previous behavior. The default
27+
behavior was changed to preserve existing `Content` if it has already been
28+
populated.
29+
30+
- `enableoriginverification` added. If set to `1`, default (zero-value)
31+
cross-origin protection will be applied when
32+
`StreamableHTTPOptions.CrossOriginProtection` is nil, restoring the
33+
behavior from v1.4.1-v1.5.0. The default behavior was changed to not
34+
enable cross-origin protection.
35+
36+
- `disablelocalhostprotection` removal was postponed until 1.8.0, as it is now
37+
also used in the SSE transport.
38+
39+
Options below were removed:
40+
41+
- `jsonescaping`, according to plan,
42+
43+
- `disablecrossoriginprotection`, it was replaced by
44+
`enableoriginverification` after the default was changed to not enable
45+
cross-origin protection.
46+
2147
### 1.4.1
2248

2349
Options listed below will be removed in the 1.6.0 version of the SDK.
2450

2551
- `disablecrossoriginprotection` added. If set to `1`, newly added cross-origin
2652
protection will be disabled. The default behavior was changed to enable
27-
cross-origin protection. **Removal of this option was postponed until 1.7.0.**
53+
cross-origin protection.
2854

2955
### 1.4.0
3056

@@ -39,4 +65,4 @@ Options listed below will be removed in the 1.6.0 version of the SDK.
3965
protection. The protection can also be disabled by setting the
4066
`DisableLocalhostProtection` field in the `StreamableHTTPOptions` or
4167
`SSEOptions` struct to `true`, which is the recommended way to disable
42-
the protection long term. **Removal of this option was postponed until 1.7.0.**
68+
the protection long term. **Removal of this option was postponed until 1.8.0.**

internal/docs/mcpgodebug.src.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,39 @@
1717

1818
## `MCPGODEBUG` history
1919

20+
### 1.6.0
21+
22+
Options listed below were added and will be removed in the 1.8.0 version of the SDK.
23+
24+
- `seterroroverwrite` added. If set to `1`, `SetError` will always overwrite
25+
`Content` with the error text, restoring the previous behavior. The default
26+
behavior was changed to preserve existing `Content` if it has already been
27+
populated.
28+
29+
- `enableoriginverification` added. If set to `1`, default (zero-value)
30+
cross-origin protection will be applied when
31+
`StreamableHTTPOptions.CrossOriginProtection` is nil, restoring the
32+
behavior from v1.4.1-v1.5.0. The default behavior was changed to not
33+
enable cross-origin protection.
34+
35+
- `disablelocalhostprotection` removal was postponed until 1.8.0, as it is now
36+
also used in the SSE transport.
37+
38+
Options below were removed:
39+
40+
- `jsonescaping`, according to plan,
41+
42+
- `disablecrossoriginprotection`, it was replaced by
43+
`enableoriginverification` after the default was changed to not enable
44+
cross-origin protection.
45+
2046
### 1.4.1
2147

2248
Options listed below will be removed in the 1.6.0 version of the SDK.
2349

2450
- `disablecrossoriginprotection` added. If set to `1`, newly added cross-origin
2551
protection will be disabled. The default behavior was changed to enable
26-
cross-origin protection. **Removal of this option was postponed until 1.7.0.**
52+
cross-origin protection.
2753

2854
### 1.4.0
2955

@@ -38,4 +64,4 @@ Options listed below will be removed in the 1.6.0 version of the SDK.
3864
protection. The protection can also be disabled by setting the
3965
`DisableLocalhostProtection` field in the `StreamableHTTPOptions` or
4066
`SSEOptions` struct to `true`, which is the recommended way to disable
41-
the protection long term. **Removal of this option was postponed until 1.7.0.**
67+
the protection long term. **Removal of this option was postponed until 1.8.0.**

internal/jsonrpc2/messages.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"fmt"
1212

1313
internaljson "github.com/modelcontextprotocol/go-sdk/internal/json"
14-
15-
"github.com/modelcontextprotocol/go-sdk/internal/mcpgodebug"
1614
)
1715

1816
// ID is a Request identifier, which is defined by the spec to be a string, integer, or null.
@@ -219,18 +217,8 @@ func marshalToRaw(obj any) (json.RawMessage, error) {
219217
return json.RawMessage(data), nil
220218
}
221219

222-
// jsonescaping is a compatibility parameter that allows to restore
223-
// JSON escaping in the JSON marshaling, which stopped being the default
224-
// in the 1.4.0 version of the SDK. See the documentation for the
225-
// mcpgodebug package for instructions how to enable it.
226-
// The option will be removed in the 1.6.0 version of the SDK.
227-
var jsonescaping = mcpgodebug.Value("jsonescaping")
228-
229220
// jsonMarshal marshals obj to JSON like json.Marshal but without HTML escaping.
230221
func jsonMarshal(obj any) ([]byte, error) {
231-
if jsonescaping == "1" {
232-
return json.Marshal(obj)
233-
}
234222
var buf bytes.Buffer
235223
enc := json.NewEncoder(&buf)
236224
enc.SetEscapeHTML(false)

mcp/streamable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (h *StreamableHTTPHandler) closeAll() {
235235
// disablelocalhostprotection is a compatibility parameter that allows to disable
236236
// DNS rebinding protection, which was added in the 1.4.0 version of the SDK.
237237
// See the documentation for the mcpgodebug package for instructions how to enable it.
238-
// The option will be removed in the 1.6.0 version of the SDK.
238+
// The option will be removed in the 1.8.0 version of the SDK.
239239
var disablelocalhostprotection = mcpgodebug.Value("disablelocalhostprotection")
240240

241241
// enableoriginverification is a compatibility parameter that restores the

0 commit comments

Comments
 (0)