Skip to content

Commit 743776d

Browse files
committed
Update getting-started-mcp-server.md
1 parent 667e522 commit 743776d

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

doc/getting-started-mcp-server.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,21 +255,21 @@ async fn main() -> SdkResult<()> {
255255
protocol_version: ProtocolVersion::V2025_11_25.into(),
256256
};
257257

258-
// create a std transport with default options
259-
let transport = StdioTransport::new(TransportOptions::default())?;
260-
261258
//instantiate our custom handler for handling MCP messages
262259
let handler = MyServerHandler {};
263260

261+
// create a std transport with default options
262+
let transport = StdioTransport::new(TransportOptions::default())?;
263+
264264
//create the MCP server
265265
let server = server_runtime::create_server(McpServerOptions {
266266
server_details,
267267
transport,
268268
handler: handler.to_mcp_server_handler(),
269269
task_store: None,
270270
client_task_store: None,
271-
message_observer: None,
272-
});
271+
message_observer: None,
272+
});
273273

274274
// Start the server
275275
server.start().await
@@ -306,15 +306,15 @@ Open the address in a web browser:
306306

307307
2- Select STDIO as the transport, enter your binary path in the Command section, and click the Connect button. You should see a message confirming that your server started successfully.
308308

309-
![hello-world-mcp-server-running](./mcp-server-hello-world-01.jpg)
309+
<img src="./mcp-server-hello-world-01.jpg" width="800" alt="hello-world-mcp-server-running"/>
310310

311311
3- Click **List Tools** button, to retrieve list of tools that your server provides:
312312

313-
![hello-world-mcp-server-tools](./mcp-server-hello-world-02.jpg)
313+
<img src="./mcp-server-hello-world-02.jpg" width="800" alt="hello-world-mcp-server-tools"/>
314314

315315
4- Select one the tools, and run it py passing a `name` argument and pressing the **Run Tool** button:
316316

317-
![hello-world-mcp-server-tools](./mcp-server-hello-world-03.jpg)
317+
<img src="./mcp-server-hello-world-03.jpg" width="800" alt="hello-world-mcp-server-tools"/>
318318

319319
---
320320

@@ -336,7 +336,8 @@ tokio = { version = "1", features = ["full"] }
336336
async-trait = "0.1"
337337
```
338338

339-
Then replace the stdio server with:
339+
Then remove the `StdioTransport` and replace the stdio server with:
340+
340341

341342
```rust
342343
use rust_mcp_axum::{create_axum_server, AxumServerOptions};
@@ -352,9 +353,12 @@ let server = create_axum_server(
352353
..Default::default()
353354
},
354355
);
355-
server.start().await?;
356+
357+
server.start().await
356358
```
357359

360+
Mcp server will be available at `http://127.0.0.1:8080/mcp`
361+
358362
### Using Actix-web
359363

360364
Add [`rust-mcp-actix`](https://crates.io/crates/rust-mcp-actix) instead:
@@ -378,7 +382,9 @@ let server = create_actix_server(
378382
..Default::default()
379383
},
380384
);
381-
server.start().await?;
385+
server.start().await
382386
```
383387

388+
Mcp server will be available at `http://127.0.0.1:8080/mcp`
389+
384390
Both crates support **Streamable HTTP** and **SSE** transports, authentication, resumability, health checks, TLS, and more. See their respective READMEs for full documentation.

0 commit comments

Comments
 (0)