Skip to content

Commit 01d5beb

Browse files
committed
Move all clients to API version 2026-10-21
The Python, TypeScript and Ruby SDK upgrades switched those clients to 2026-10-21; this brings Go and Rust along so all five send the same version. - Go: anthropic-sdk-go v2 (new module path; no other changes needed) - Rust: anthropic-version 2026-10-21, key sent as Authorization: Bearer - Ruby: require anthropic >= 2.3.0 - Tests: the fake API checks the version and auth headers on every request
1 parent 1f0c0a6 commit 01d5beb

8 files changed

Lines changed: 29 additions & 15 deletions

File tree

‎mcp-client-go/go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/modelcontextprotocol/quickstart-resources/mcp-client-go
33
go 1.25.1
44

55
require (
6-
github.com/anthropics/anthropic-sdk-go v1.84.0
6+
github.com/anthropics/anthropic-sdk-go/v2 v2.7.0
77
github.com/google/jsonschema-go v0.4.3
88
github.com/joho/godotenv v1.5.1
99
github.com/modelcontextprotocol/go-sdk v1.8.0

‎mcp-client-go/go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ cloud.google.com/go/auth/oauth2adapt v0.2.3 h1:MlxF+Pd3OmSudg/b1yZ5lJwoXCEaeedAg
44
cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I=
55
cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY=
66
cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY=
7-
github.com/anthropics/anthropic-sdk-go v1.84.0 h1:mnAhggc5H5A98JYmhQELT+j4J89PYBFKnnSvUTNwNd8=
8-
github.com/anthropics/anthropic-sdk-go v1.84.0/go.mod h1:GThfYqPJoaQ/6pmibCI98Cr4y5su2FXMUHn3NrSSnIc=
7+
github.com/anthropics/anthropic-sdk-go/v2 v2.7.0 h1:wT62eHG7DL/ueUSJwjNQ0jRftJDSUyA2jg2wa7bNCO4=
8+
github.com/anthropics/anthropic-sdk-go/v2 v2.7.0/go.mod h1:LAOInMKgn6reTIrPvKXa5weyqzxsJkxSBuzhnxzukpQ=
99
github.com/aws/aws-sdk-go-v2 v1.38.0 h1:UCRQ5mlqcFk9HJDIqENSLR3wiG1VTWlyUfLDEvY7RxU=
1010
github.com/aws/aws-sdk-go-v2 v1.38.0/go.mod h1:9Q0OoGQoboYIAJyslFyF1f5K1Ryddop8gqMhWx/n4Wg=
1111
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 h1:tW1/Rkad38LA15X4UQtjXZXNKsCgkshC3EbmcUmghTg=

‎mcp-client-go/main.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"os/exec"
1212
"strings"
1313

14-
"github.com/anthropics/anthropic-sdk-go"
15-
"github.com/anthropics/anthropic-sdk-go/option"
14+
"github.com/anthropics/anthropic-sdk-go/v2"
15+
"github.com/anthropics/anthropic-sdk-go/v2/option"
1616
"github.com/google/jsonschema-go/jsonschema"
1717
"github.com/joho/godotenv"
1818
"github.com/modelcontextprotocol/go-sdk/mcp"

‎mcp-client-ruby/Gemfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
source "https://rubygems.org"
44

5-
gem "anthropic", '>= 1.72.0'
5+
gem "anthropic", '>= 2.3.0'
66
gem "dotenv"
77
gem "mcp", ">= 1.6.0"

‎mcp-client-ruby/Gemfile.lock‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PLATFORMS
3333
x86_64-linux
3434

3535
DEPENDENCIES
36-
anthropic (>= 1.72.0)
36+
anthropic (>= 2.3.0)
3737
dotenv
3838
mcp (>= 1.6.0)
3939

‎mcp-client-rust/src/main.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const SYSTEM_PROMPT: &str =
2222
"You are a helpful assistant. Use the available tools when they help answer the question.";
2323

2424
const ANTHROPIC_API_BASE: &str = "https://api.anthropic.com";
25-
const ANTHROPIC_VERSION: &str = "2023-06-01";
25+
const ANTHROPIC_VERSION: &str = "2026-10-21";
2626
const REQUEST_TIMEOUT: Duration = Duration::from_secs(120);
2727
/// Image types the Messages API accepts.
2828
const SUPPORTED_IMAGE_TYPES: [&str; 4] = ["image/jpeg", "image/png", "image/gif", "image/webp"];
@@ -382,7 +382,7 @@ impl MCPClient {
382382
let response = self
383383
.http
384384
.post(format!("{}/v1/messages", base_url.trim_end_matches('/')))
385-
.header("x-api-key", api_key)
385+
.bearer_auth(api_key)
386386
.header("anthropic-version", ANTHROPIC_VERSION)
387387
.json(&request)
388388
.send()

‎tests/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Tool calls reach the live NWS API. When it is unreachable the tools return an er
2525

2626
Connecting and listing tools does not exercise the chat loop, so each client is also driven through nine scripted queries with `tool-loop-test.ts`. No real API is involved: the helper starts a fake Anthropic Messages API on a loopback port and hands it to the client through `ANTHROPIC_BASE_URL`, which every quickstart SDK reads. The client talks to the mock MCP server as in the no-key test. The helper types each query only after the client shows its `Query:` prompt, as a person would.
2727

28-
The fake API picks a script from the query text and checks every request the client sends. Every request must carry the same system prompt, and its history must be one the real API accepts: no message empty, and every `tool_use` answered by a `tool_result` in the next message.
28+
The fake API picks a script from the query text and checks every request the client sends. Every request must use API version `2026-10-21` and send the key as `Authorization: Bearer`, as the current SDKs do, and carry the same system prompt, and its history must be one the real API accepts: no message empty, and every `tool_use` answered by a `tool_result` in the next message.
2929

3030
- **parallel tools** — a response with two `tool_use` blocks, then one for a tool the mock server lacks, then an answer. `tools` must be passed on every call, `max_tokens` must be 10000 (room for the model's adaptive thinking), every `tool_use` must get a `tool_result` in a single following user message with matching `tool_use_id`s, and the MCP `isError` result must be forwarded as `is_error`.
3131
- **ten tool turns** — exactly `MAX_TOOL_TURNS` tool calls, then an answer. The client must print the answer and no stop notice: nothing was cut short.

‎tests/helpers/tool-loop-test.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@
4040
* - "after clear", typed after a blank line and ` clear `: the history must be
4141
* empty again, and the blank line must not have been sent.
4242
*
43-
* Every request must carry the same system prompt, every query after the first
44-
* must carry the earlier conversation, and the history must be one the API
45-
* accepts: no message empty, and every tool_use answered by a tool_result in
46-
* the next message.
43+
* Every request must use API version 2026-10-21 and send the key as a bearer
44+
* token, as the current SDKs do. Every request must carry the same system
45+
* prompt, every query after the first must carry the earlier conversation, and
46+
* the history must be one the API accepts: no message empty, and every
47+
* tool_use answered by a tool_result in the next message.
4748
*
4849
* A client that does one tool round and stops, drops `tools` on the second
4950
* call, sends one tool_result per message, or gets the turn cap wrong fails
@@ -112,6 +113,10 @@ const INPUT = [
112113
"quit",
113114
];
114115

116+
/** The API version the current SDKs send, and the Rust client sets. */
117+
const API_VERSION = "2026-10-21";
118+
const API_KEY = "test-key";
119+
115120
/** SYSTEM_PROMPT in every client. */
116121
const SYSTEM_PROMPT =
117122
"You are a helpful assistant. Use the available tools when they help answer the question.";
@@ -131,6 +136,9 @@ type Request = {
131136
};
132137

133138
const failures: string[] = [];
139+
/** Every anthropic-version and Authorization header the client sent. */
140+
const versionsSent = new Set<string>();
141+
const authSent = new Set<string>();
134142
let passed = 0;
135143
const calls: Record<Scenario, number> = {
136144
parallel: 0,
@@ -497,6 +505,8 @@ function startFakeApi(): Promise<http.Server> {
497505
let body = "";
498506
req.on("data", (chunk) => (body += chunk));
499507
req.on("end", () => {
508+
versionsSent.add(String(req.headers["anthropic-version"]));
509+
authSent.add(String(req.headers.authorization));
500510
let request: Request;
501511
try {
502512
request = JSON.parse(body) as Request;
@@ -540,7 +550,7 @@ function runClient(
540550
): Promise<{ code: number | null; stdout: string; stderr: string }> {
541551
return new Promise((resolve) => {
542552
const child = spawn(command, args, {
543-
env: { ...process.env, ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_API_KEY: "test-key" },
553+
env: { ...process.env, ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_API_KEY: API_KEY },
544554
stdio: ["pipe", "pipe", "pipe"],
545555
});
546556
let stdout = "";
@@ -578,6 +588,10 @@ function runClient(
578588
/** Checks on the client's output once it has exited. */
579589
function checkOutput(code: number | null, stdout: string) {
580590
check(code === 0, `client exited 0 (got ${code})`);
591+
const versions = [...versionsSent].join(", ");
592+
check(versions === API_VERSION, `every request uses API version ${API_VERSION} (got ${versions})`);
593+
const auth = [...authSent].join(", ");
594+
check(auth === `Bearer ${API_KEY}`, `every request sends the key as a bearer token (got ${auth})`);
581595
check(calls.parallel === 3, `parallel: API was called 3 times (got ${calls.parallel})`);
582596
check(stdout.includes(FINAL_ANSWER.parallel), "parallel: client printed the final answer");
583597

0 commit comments

Comments
 (0)