# Rust Async Runtime: Tokio Tasks, Cancellation, Channels & Axum > Verified Tokio 1.x async Rust patterns: cooperative cancellation, spawn_blocking, bounded mpsc/watch/CancellationToken, and Send bounds. ## Corpus Summary - Canonical Space URL: https://voxell.ai/p/rust-tokio - Documents indexed: 4 (20 passages, 15.6 KB) - Citation Readiness (Aggarwal GEO): 57/100 (stat_density=0.01, self_contained=0.95) - Full machine-readable corpus bundle: https://voxell.ai/s/rust-tokio/llms-full.txt ## Agent & MCP Integration (Zero API Key Required) Connect any MCP client or autonomous agent directly via Streamable HTTP: - Endpoint: `POST https://voxell.ai/s/rust-tokio/mcp` - Tools: `search_verified_docs` (grounded passage search), `ask_cited_answer` (cited synthesis) ```bash curl -sS -X POST https://voxell.ai/s/rust-tokio/mcp \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_verified_docs","arguments":{"query":"key facts and specifications","top_k":5}}}' ``` ## Document & Section Map - **official_ref_1_tutorial_tokio_an_asynchrono.md** (4 passages, 5 KB) - Section: Tutorial | Tokio - An asynchronous Rust runtime - **official_ref_2_raw_githubusercontent_com_to.md** (14 passages, 9.6 KB) - Section: raw.githubusercontent.com/tokio-rs/tokio/master/README.md - Section: Tokio - Section: Overview - Section: Example - Section: Getting Help - **tokio-channels-and-graceful-shutdown.md** (1 passages, 310 B) - Section: Tokio Bounded Channels, JoinSet & Graceful Shutdown - **tokio-tasks-blocking-and-mutexes.md** (1 passages, 777 B) - Section: Tokio Runtime Rules: Blocking Work, Mutexes & Cancellation Safety ## Verified Sample Citations (High Fact Density) - **[official_ref_2_raw_githubusercontent_com_to.md #1]**: # Tokio A runtime for writing reliable, asynchronous, and slim applications with the Rust programming language. It is: * **Fast**: Tokio's zero-cost abstractions give you bare-metal performance. * **Reliable**: Tokio leverages Rust's ownership, type system, and concurrency model to reduce bugs and ensure thread safety. * **Scalable**: Tokio has a minimal ... - **[official_ref_2_raw_githubusercontent_com_to.md #2]**: [crates-badge]: https://img.shields.io/crates/v/tokio.svg [crates-url]: https://crates.io/crates/tokio [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg [mit-url]: https://github.com/tokio-rs/tokio/blob/master/LICENSE [actions-badge]: https://github.com/tokio-rs/tokio/workflows/CI/badge.svg [actions-url]: https://github.com/tokio-rs/tokio/act... - **[official_ref_2_raw_githubusercontent_com_to.md #3]**: ## Overview Tokio is an event-driven, non-blocking I/O platform for writing asynchronous applications with the Rust programming language. At a high level, it provides a few major components: * A multithreaded, work-stealing based task [scheduler]. * A reactor backed by the operating system's event queue (epoll, kqueue, IOCP, etc.). * Asynchronous [TCP and... - **[official_ref_2_raw_githubusercontent_com_to.md #4]**: ## Example A basic TCP echo server with Tokio. Make sure you enable the full features of the tokio crate on Cargo.toml: ```toml [dependencies] tokio = { version = "1.54.1", features = ["full"] } ``` Then, on your main.rs: ```rust,no_run use tokio::net::TcpListener; use tokio::io::{AsyncReadExt, AsyncWriteExt}; #[tokio::main] async fn main() -> Result<(), ... - **[official_ref_2_raw_githubusercontent_com_to.md #5]**: // Write the data back if let Err(e) = socket.write_all(&buf[0..n]).await { eprintln!("failed to write to socket; err = {:?}", e); return; } } }); } } ``` More examples can be found [here][examples]. For a larger "real world" example, see the [mini-redis] repository. [examples]: https://github.com/tokio-rs/tokio/tree/master/examples [mini-redis]: https://... - **[official_ref_2_raw_githubusercontent_com_to.md #6]**: ## Contributing :balloon: Thanks for your help improving the project! We are so happy to have you! We have a [contributing guide][guide] to help you get involved in the Tokio project. [guide]: https://github.com/tokio-rs/tokio/blob/master/docs/contributing/README.md