rust-sdk/examples
Repository files (latest commit first)
Filename Latest commit message Latest commit date
jokemanfire afb8a905e5
chore: add oauth2 support (#130)
1.add oauth2 server and client example
2.add oauth2 impl in sse
3.add auth doc 
Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-04-29 17:52:59 +08:00
..
clients chore: add oauth2 support (#130) 2025-04-29 17:52:59 +08:00
rig-integration fix: fix 2 cargo warnings (#112) 2025-04-09 18:09:33 +08:00
servers chore: add oauth2 support (#130) 2025-04-29 17:52:59 +08:00
simple-chat-client chore: make cli command in simple-chat (#145) 2025-04-27 09:10:51 +08:00
transport chore: disable unix_socket example on windows (#146) 2025-04-26 14:27:15 +08:00
wasi fix: fix 2 cargo warnings (#112) 2025-04-09 18:09:33 +08:00
README.md docs: fix typo and clarify instructions (#124) 2025-04-11 09:05:48 +08:00

Quick Start With Claude Desktop

  1. Build the Server (Counter Example)

    cargo build --release --example servers_std_io
    

    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_std_io.exe",
          "args": []
        }
      }
    }
    

    MacOS/Linux

    {
      "mcpServers": {
        "counter": {
          "command": "PATH-TO/rust-sdk/target/release/examples/servers_std_io",
          "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

  • Client SSE, using reqwest and eventsource-client.
  • Client stdio, using tokio to spawn child process.
  • Everything, test with @modelcontextprotocol/server-everything
  • Collection, How to transpose service into dynamic object, so they will have a same type.

Server Examples

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