Skip to content

Commit 6a19c95

Browse files
committed
mcp: finalize cleanup of Go 1.23, make Go version support explicit
1 parent d0922ab commit 6a19c95

6 files changed

Lines changed: 24 additions & 55 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
strategy:
4242
matrix:
43-
go: ["1.23", "1.24", "1.25"]
43+
go: ["1.24", "1.25"]
4444
steps:
4545
- name: Check out code
4646
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ The following table shows which versions of the Go SDK support which versions of
3838
| v1.2.0+ | 2025-06-18 | 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 |
3939
| v1.0.0 - v1.1.0 | 2025-06-18 | 2025-06-18, 2025-03-26, 2024-11-05 |
4040

41+
New releases of the SDK target only supported versions of Go. See
42+
https://go.dev/doc/devel/release#policy for more information.
43+
4144
## Getting started
4245

4346
To get started creating an MCP server, create an `mcp.Server` instance, add

internal/readme/README.src.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ The following table shows which versions of the Go SDK support which versions of
3737
| v1.2.0+ | 2025-06-18 | 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 |
3838
| v1.0.0 - v1.1.0 | 2025-06-18 | 2025-06-18, 2025-03-26, 2024-11-05 |
3939

40+
New releases of the SDK target only supported versions of Go. See
41+
https://go.dev/doc/devel/release#policy for more information.
42+
4043
## Getting started
4144

4245
To get started creating an MCP server, create an `mcp.Server` instance, add

mcp/resource.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ func computeURIFilepath(rawURI, dirFilepath string, rootFilepaths []string) (str
113113
return uriFilepathRel, nil
114114
}
115115

116+
// withFile calls f on the file at join(dir, rel),
117+
// protecting against path traversal attacks.
118+
func withFile(dir, rel string, f func(*os.File) error) (err error) {
119+
r, err := os.OpenRoot(dir)
120+
if err != nil {
121+
return err
122+
}
123+
defer r.Close()
124+
file, err := r.Open(rel)
125+
if err != nil {
126+
return err
127+
}
128+
// Record error, in case f writes.
129+
defer func() { err = errors.Join(err, file.Close()) }()
130+
return f(file)
131+
}
132+
116133
// fileRoots transforms the Roots obtained from the client into absolute paths on
117134
// the local filesystem.
118135
// TODO(jba): expose this functionality to user ResourceHandlers,

mcp/resource_go124.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

mcp/resource_pre_go124.go

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)