Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · mcp

Build an MCP client changeddocs/2026-07-28/develop/build-client

Nearest release: v2.1.328, published 4 hours after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 18 Nov 2026 18:56 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 18 Nov 2026 19:07 UTC.

Upstream edited
Recorded here
Lines+19added
Lines−27removed
From line 104 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits10to this page, all time

The whole hunk

from line 104, old and new numbered
/
lines
from line 104
104104>
105105> load_dotenv() # load environment variables from .env
106106>
107> MODEL = "claude-opus-5"
107> MODEL = "claude-haiku-5-5"
108108> # The model thinks adaptively unless told otherwise, and max_tokens caps thinking
109109> # plus the reply, so leave room for both.
110110> MAX_TOKENS = 10000
from line 293
293293>
294294> ### 3. Query Processing
295295>
296> * Maintains conversation context
296> * Starts a new conversation for each query
297297> * Handles Claude's responses and tool calls
298298> * Runs every tool call of a turn, then answers them all in one message
299299> * Keeps looping while Claude asks for tools, up to `MAX_TOOL_TURNS`
from line 486
486486> {
487487> "type": "module",
488488> "scripts": {
489> "build": "tsc && chmod 755 build/index.js"
489> "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\""
490490> }
491491> }
492492> ```
from line 559
559559> throw new Error("ANTHROPIC_API_KEY is not set");
560560> }
561561>
562> const MODEL = "claude-opus-5";
562> const MODEL = "claude-haiku-5-5";
563563> // The model thinks adaptively unless told otherwise, and max_tokens caps
564564> // thinking plus the reply, so leave room for both.
565565> const MAX_TOKENS = 10000;
from line 779
779779> ```typescript theme={null}
780780> async function main() {
781781> if (process.argv.length < 3) {
782> console.log("Usage: node index.ts <path_to_server_script>");
782> console.log("Usage: node build/index.js <path_to_server_script>");
783783> return;
784784> }
785785> const mcpClient = new MCPClient();
from line 913
913913>
914914> * Java 17 or higher
915915> * Maven 3.6+
916> * npx package manager
916> * npm
917917> * Anthropic API key (Claude)
918918> * Brave Search API key
919919>
920920> ## Setting Up Your Environment
921921>
922> 1. Install npx (Node Package eXecute):
923> First, make sure to install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
924> and then run:
922> 1. Install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), which includes `npx`.
925923>
926> ```bash theme={null}
927> npm install -g npx
928> ```
929>
930924> 2. Clone the repository:
931925>
932926> ```bash theme={null}
from line 1182
11881182> First, let's create the basic client class:
11891183>
11901184> ```kotlin theme={null}
1191> private const val MODEL = "claude-opus-5"
1185> private const val MODEL = "claude-haiku-5-5"
11921186> // The model thinks adaptively unless told otherwise, and max_tokens caps thinking
11931187> // plus the reply, so leave room for both.
11941188> private const val MAX_TOKENS = 10_000L
from line 1555
15611555>
15621556> Before starting, ensure your system meets these requirements:
15631557>
1564> * .NET 8.0 or higher
1558> * .NET 10.0 or higher
15651559> * Anthropic API key (Claude)
15661560> * Windows, Linux, or macOS
15671561>
from line 1571
15771571> Then, add the required dependencies to your project:
15781572>
15791573> ```bash theme={null}
1580> dotnet add package ModelContextProtocol --prerelease
1581> dotnet add package Anthropic.SDK
1574> dotnet add package ModelContextProtocol
1575> dotnet add package Anthropic
15821576> dotnet add package Microsoft.Extensions.Hosting
15831577> dotnet add package Microsoft.Extensions.AI
15841578> ```
from line 1593
15991593> First, let's setup the basic client class in the file `Program.cs`:
16001594>
16011595> ```csharp theme={null}
1602> using Anthropic.SDK;
1596> using Anthropic;
16031597> using Microsoft.Extensions.AI;
16041598> using Microsoft.Extensions.Configuration;
16051599> using Microsoft.Extensions.Hosting;
from line 1651
16571651> Now let's add the core functionality for processing queries and handling tool calls:
16581652>
16591653> ```csharp theme={null}
1660> using var anthropicClient = new AnthropicClient(new APIAuthentication(builder.Configuration["ANTHROPIC_API_KEY"]))
1661> .Messages
1654> using var anthropicClient = new AnthropicClient(new() { ApiKey = builder.Configuration["ANTHROPIC_API_KEY"] })
1655> .AsIChatClient("claude-haiku-5-5")
16621656> .AsBuilder()
16631657> .UseFunctionInvocation()
16641658> .Build();
from line 1660
16661660> var options = new ChatOptions
16671661> {
16681662> MaxOutputTokens = 10000,
1669> ModelId = "claude-opus-5",
16701663> Tools = [.. tools]
16711664> };
16721665>
from line 1711
17181711>
17191712> * Leverages [Microsoft.Extensions.AI](https://learn.microsoft.com/dotnet/ai/ai-extensions) for the chat client.
17201713> * Configures the `IChatClient` to use automatic tool (function) invocation.
1721> * The client reads user input and sends it to the server.
1722> * The server processes the query and returns a response.
1723> * The response is displayed to the user.
1714> * The client reads user input and sends it to Claude.
1715> * When Claude asks for a tool, the client calls it on the server and sends the result back to Claude.
1716> * The client displays Claude's response to the user.
17241717>
17251718> ## Running the Client
17261719>
from line 1735
17421735> 2. List available tools
17431736> 3. Start an interactive chat session where you can:
17441737> * Enter queries
1745> * See tool executions
17461738> * Get responses from Claude
17471739> 4. Exit the session when done
17481740>
from line 1821
18291821> require "mcp"
18301822>
18311823> class MCPClient
1832> ANTHROPIC_MODEL = "claude-opus-5"
1824> ANTHROPIC_MODEL = "claude-haiku-5-5"
18331825> # The model thinks adaptively unless told otherwise, and max_tokens caps thinking
18341826> # plus the reply, so leave room for both.
18351827> MAX_TOKENS = 10000
from line 2268
22762268> use tokio::io::{self, AsyncBufReadExt, BufReader};
22772269> use tokio::process::Command;
22782270>
2279> const MODEL_ANTHROPIC: &str = "claude-opus-5";
2271> const MODEL_ANTHROPIC: &str = "claude-haiku-5-5";
22802272> /// The model may think before answering, and max_tokens caps thinking
22812273> /// plus the reply, so leave room for both.
22822274> const MAX_TOKENS: u32 = 10000;
Feedback