quickstart-resources/mcp-client-rust
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Alex Akimov 3844c5b45e
Add smoke tests for Go and Rust clients (#196)
* Add smoke tests for Go and Rush clients

* Add smoke tests for Go and Rush clients
2026-09-15 15:14:06 -07:00
..
src Add smoke tests for Go and Rust clients (#196) 2026-09-15 15:14:06 -07:00
Cargo.lock Bump the cargo group across 2 directories with 3 updates 2026-08-19 00:09:25 +00:00
Cargo.toml Update to rmcp 3.1.0 2026-08-09 15:36:38 -07:00
README.md Correct README claims that do not match the repo 2026-08-28 10:51:08 -07:00

An LLM-Powered Chatbot MCP Client written in Rust

An interactive chatbot MCP client: it launches an MCP server over stdio, lists its tools, and hands them to Claude, which can call them while answering your questions.

This example accompanies the Build an MCP client tutorial.

Prerequisites

Setup

Export your API key, or put it in a .env file in this directory (the .env file is optional):

export ANTHROPIC_API_KEY=your-api-key-here

Run the client

Pass the command that starts the server — a binary or a script — after --:

cargo run -- ../weather-server-rust/target/release/weather

(Build the server first with cargo build --release in its directory.)

Type a question (for example, "What's the weather in Sacramento?") and Claude answers using the server's tools. Type quit to exit.

Without an ANTHROPIC_API_KEY, the client still connects, prints the server's tools, and exits — useful for verifying the MCP wiring without credentials.

Structured content

rmcp does not validate tool output, so this client compiles each declared outputSchema at connect time and checks results against it — the spec's client-side SHOULD. It uses the jsonschema crate, which rmcp's own documentation recommends.

The two channels go to different readers: content is forwarded to the model, while structured_content is used as data — the client counts the items it returns. See Structured Content.