rust-sdk/examples
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jack Amadeo e903341136
chore: refactor OAuth client authorization api (#1009)
* refactor!: refactor OAuth client authorization api

`OAuthState::start_authorization` now accepts a declarative `AuthorizationRequest`
describing the client's available identity material and selects the highest-priority
mechanism the server supports: pre-registered client information → Client ID
Metadata Documents (SEP-991) → Dynamic Client Registration.

This replaces the three mechanism-specific entry points (`start_authorization`,
`start_authorization_with_metadata_url`, `start_authorization_with_preregistered_client`),
where callers previously had to know which mechanism to pick. `AuthorizationSession::new`
is consolidated the same way, and the failure-recovery pattern from #994 (returning the
manager alongside the error so `OAuthState` recovers to `Unauthorized` on transient failures)
is now applied across all registration paths. Includes new `RecordingOAuthHttpClient`-based
tests covering the priority matrix and recovery semantics, plus updated docs, examples, and
conformance client.

* fix: dcr registration uses requested application type

* fix: error for invalid combination
2026-07-23 14:13:11 -04:00
..
clients chore: refactor OAuth client authorization api (#1009) 2026-07-23 14:13:11 -04:00
servers feat: Implement SEP-2663 Tasks Extension (#1020) 2026-07-22 14:16:52 -04:00
simple-chat-client chore: add #[non_exhaustive] and mutation methods to improve compatibility (#715) 2026-03-03 10:38:01 -05:00
transport chore(deps): update tokio-tungstenite requirement from 0.29.0 to 0.30.0 (#989) 2026-07-13 15:55:56 -04:00
wasi feat(macros): auto-generate get_info and default router (#785) 2026-04-08 15:06:26 -04:00
README.md chore: remove the rig example (#763) 2026-03-23 09:01:49 +08:00

Quick Start With Claude Desktop

  1. Build the Server (Counter Example)

    cargo build --release -p mcp-server-examples --example servers_counter_stdio
    

    This builds a standard input/output MCP server binary.

  2. Add or update this section in your PATH-TO/claude_desktop_config.json

    Windows

    {
      "mcpServers": {
        "counter": {
          "command": "PATH-TO/rust-sdk/target/release/examples/servers_counter_stdio.exe",
          "args": []
        }
      }
    }
    

    MacOS/Linux

    {
      "mcpServers": {
        "counter": {
          "command": "PATH-TO/rust-sdk/target/release/examples/servers_counter_stdio",
          "args": []
        }
      }
    }
    
  3. Ensure that the MCP UI elements appear in Claude Desktop The MCP UI elements will only show up in Claude for Desktop if at least one server is properly configured. It may require to restart Claude for Desktop.

  4. Once Claude Desktop is running, try chatting:

    counter.say_hello
    

    Or test other tools like:

    counter.increment
    counter.get_value
    counter.sum {"a": 3, "b": 4}
    

Client Examples

see clients/README.md

Server Examples

see servers/README.md

Transport Examples

Integration

  • Rig A stream chatbot with rig
  • Simple Chat Client A simple chat client implementation using the Model Context Protocol (MCP) SDK.

WASI

Use Mcp Inspector

npx @modelcontextprotocol/inspector