Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
feat(mcp): bump rmcp to 3.2.0 for latest protocol and OAuth discovery fix
Akarshan Biswasc34484529586
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex 28dd60106..988045bd6 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -1496,22 +1496,22 @@ dependencies = [[[package]]name = "darling"-version = "0.21.3"+version = "0.23.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0"+checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d"dependencies = [- "darling_core 0.21.3",- "darling_macro 0.21.3",+ "darling_core 0.23.0",+ "darling_macro 0.23.0",][[package]]name = "darling"-version = "0.23.0"+version = "0.24.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d"+checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec"dependencies = [- "darling_core 0.23.0",- "darling_macro 0.23.0",+ "darling_core 0.24.1",+ "darling_macro 0.24.1",][[package]]@@ -1530,11 +1530,10 @@ dependencies = [[[package]]name = "darling_core"-version = "0.21.3"+version = "0.23.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4"+checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0"dependencies = [- "fnv","ident_case","proc-macro2","quote",@@ -1544,15 +1543,15 @@ dependencies = [[[package]]name = "darling_core"-version = "0.23.0"+version = "0.24.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0"+checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff"dependencies = ["ident_case","proc-macro2","quote","strsim",- "syn 2.0.118",+ "syn 3.0.5",][[package]]@@ -1568,24 +1567,24 @@ dependencies = [[[package]]name = "darling_macro"-version = "0.21.3"+version = "0.23.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"+checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"dependencies = [- "darling_core 0.21.3",+ "darling_core 0.23.0","quote","syn 2.0.118",][[package]]name = "darling_macro"-version = "0.23.0"+version = "0.24.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"+checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785"dependencies = [- "darling_core 0.23.0",+ "darling_core 0.24.1","quote",- "syn 2.0.118",+ "syn 3.0.5",][[package]]@@ -3211,7 +3210,7 @@ dependencies = ["tokio","tower-service","tracing",- "windows-registry 0.5.3",+ "windows-registry 0.6.1",][[package]]@@ -4827,7 +4826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"dependencies = ["libc",- "windows-sys 0.48.0",+ "windows-sys 0.61.2",][[package]]@@ -5427,16 +5426,16 @@ dependencies = [[[package]]name = "process-wrap"-version = "8.2.1"+version = "9.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a3ef4f2f0422f23a82ec9f628ea2acd12871c81a9362b02c43c1aa86acfc3ba1"+checksum = "2e842efad9119158434d193c6682e2ebee4b44d6ad801d7b349623b3f57cdf55"dependencies = ["futures","indexmap 2.14.0",- "nix 0.30.1",+ "nix 0.31.3","tokio","tracing",- "windows 0.61.3",+ "windows 0.62.2",][[package]]@@ -6024,19 +6023,22 @@ dependencies = [[[package]]name = "rmcp"-version = "0.8.5"+version = "3.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e5947688160b56fb6c827e3c20a72c90392a1d7e9dec74749197aa1780ac42ca"+checksum = "42b6914fac0be956fe704a38239c3f44a9f841d1b06a5713d2f638065593f5b5"dependencies = [- "base64 0.22.1",+ "async-trait",+ "base64 0.23.1",+ "bytes","chrono","futures","http",+ "indexmap 2.14.0","oauth2",- "paste",+ "pastey","pin-project-lite","process-wrap",- "reqwest 0.12.28",+ "reqwest 0.13.4","rmcp-macros","schemars 1.2.1","serde",@@ -6049,19 +6051,20 @@ dependencies = ["tower-service","tracing","url",+ "uuid",][[package]]name = "rmcp-macros"-version = "0.8.5"+version = "3.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "01263441d3f8635c628e33856c468b96ebbce1af2d3699ea712ca71432d4ee7a"+checksum = "cdf1c49bd4d52014b94db0877410db273c2008f01628b0252a2e9460ad9b7fda"dependencies = [- "darling 0.21.3",+ "darling 0.24.1","proc-macro2","quote","serde_json",- "syn 2.0.118",+ "syn 3.0.5",][[package]]@@ -7189,6 +7192,17 @@ dependencies = ["unicode-ident",]+[[package]]+name = "syn"+version = "3.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]+[[package]]name = "sync_wrapper"version = "1.0.2"@@ -9316,7 +9330,7 @@ version = "0.1.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"dependencies = [- "windows-sys 0.48.0",+ "windows-sys 0.61.2",][[package]]@@ -9356,11 +9370,23 @@ version = "0.61.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"dependencies = [- "windows-collections",+ "windows-collections 0.2.0","windows-core 0.61.2",- "windows-future",+ "windows-future 0.2.1","windows-link 0.1.3",- "windows-numerics",+ "windows-numerics 0.2.0",+]++[[package]]+name = "windows"+version = "0.62.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"+dependencies = [+ "windows-collections 0.3.2",+ "windows-core 0.62.2",+ "windows-future 0.3.2",+ "windows-numerics 0.3.1",][[package]]@@ -9372,6 +9398,15 @@ dependencies = ["windows-core 0.61.2",]+[[package]]+name = "windows-collections"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"+dependencies = [+ "windows-core 0.62.2",+]+[[package]]name = "windows-core"version = "0.57.0"@@ -9418,7 +9453,18 @@ checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"dependencies = ["windows-core 0.61.2","windows-link 0.1.3",- "windows-threading",+ "windows-threading 0.1.0",+]++[[package]]+name = "windows-future"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"+dependencies = [+ "windows-core 0.62.2",+ "windows-link 0.2.1",+ "windows-threading 0.2.1",][[package]]@@ -9487,6 +9533,16 @@ dependencies = ["windows-link 0.1.3",]+[[package]]+name = "windows-numerics"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"+dependencies = [+ "windows-core 0.62.2",+ "windows-link 0.2.1",+]+[[package]]name = "windows-registry"version = "0.5.3"@@ -9680,6 +9736,15 @@ dependencies = ["windows-link 0.1.3",]+[[package]]+name = "windows-threading"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"+dependencies = [+ "windows-link 0.2.1",+]+[[package]]name = "windows-version"version = "0.1.7"diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex fb4627d1d..9b4e81133 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -120,11 +120,9 @@ log = "0.4"# accessors on the persisted token record (`core::mcp::oauth`).oauth2 = "5.0"rand = "0.8"-rmcp = { version = "0.8.5", features = [+rmcp = { version = "3.2.0", features = ["auth","client",- "transport-sse-client",- "transport-sse-client-reqwest","transport-streamable-http-client","transport-streamable-http-client-reqwest","transport-child-process",diff --git a/src-tauri/src/core/agent/upstream.rs b/src-tauri/src/core/agent/upstream.rsindex d43eb0314..e3dd3cd30 100644--- a/src-tauri/src/core/agent/upstream.rs+++ b/src-tauri/src/core/agent/upstream.rs@@ -13,7 +13,7 @@ use std::path::PathBuf;use std::sync::Arc;use reqwest::Client;-use rmcp::model::{CallToolRequestParam, CallToolResult};+use rmcp::model::{CallToolRequestParams, CallToolResult};#[cfg(not(feature = "cli"))]use tauri_plugin_llamacpp::state::LlamacppState;use tokio::sync::{mpsc, Mutex};@@ -709,10 +709,9 @@ pub(crate) async fn execute_mcp_tool_calls(continue;};- let tool_call = service.call_tool(CallToolRequestParam {- name: tool_name.clone().into(),- arguments: Some(args_map),- });+ let tool_call = service.call_tool(+ CallToolRequestParams::new(tool_name.clone()).with_arguments(args_map),+ );let result = match tokio::time::timeout(timeout_duration, tool_call).await {Ok(call_result) => call_result.map_err(|e| e.to_string()),diff --git a/src-tauri/src/core/cli/mcp.rs b/src-tauri/src/core/cli/mcp.rsindex c7a26ff8e..b0255cf04 100644--- a/src-tauri/src/core/cli/mcp.rs+++ b/src-tauri/src/core/cli/mcp.rs@@ -15,9 +15,8 @@ use std::process::Stdio;use rmcp::{model::{ClientCapabilities, ClientInfo, Implementation},transport::{- sse_client::{SseClient, SseClientConfig},streamable_http_client::{StreamableHttpClient, StreamableHttpClientTransportConfig},- SseClientTransport, StreamableHttpClientTransport, TokioChildProcess,+ StreamableHttpClientTransport, TokioChildProcess,},ServiceExt,};@@ -414,11 +413,18 @@ async fn connect_in(detail,})?;let authorized = auth.is_some();- let result = match (transport, auth) {- ("http", Some(client)) => serve_http(client, url, name).await,- ("http", None) => serve_http(base, url, name).await,- (_, Some(client)) => serve_sse(client, url, name).await,- (_, None) => serve_sse(base, url, name).await,+ // rmcp 3.x dropped the SSE client transport (MCP deprecated HTTP+SSE+ // for Streamable HTTP), so a legacy `sse` config connects over the+ // streamable-http client instead.+ if transport == "sse" {+ log::warn!(+ "MCP server '{name}' uses the deprecated 'sse' transport; \+ connecting over Streamable HTTP instead"+ );+ }+ let result = match auth {+ Some(client) => serve_http(client, url, name).await,+ None => serve_http(base, url, name).await,};match result {Ok(service) => service,@@ -484,10 +490,7 @@ where{let transport = StreamableHttpClientTransport::with_client(client,- StreamableHttpClientTransportConfig {- uri: url.to_string().into(),- ..Default::default()- },+ StreamableHttpClientTransportConfig::with_uri(url.to_string()),);Ok(RunningServiceEnum::WithInit(client_info()@@ -497,59 +500,31 @@ where))}-/// `serve_http`'s counterpart for the legacy SSE transport.-async fn serve_sse<C>(client: C, url: &str, name: &str) -> Result<RunningServiceEnum, String>-where- C: SseClient + Send + Sync + 'static,-{- let transport = SseClientTransport::start_with_client(- client,- SseClientConfig {- sse_endpoint: url.to_string().into(),- ..Default::default()- },- )- .await- .map_err(|e| format!("failed to start SSE transport for '{name}': {e}"))?;- Ok(RunningServiceEnum::WithInit(- client_info()- .serve(transport)- .await- .map_err(|e| format!("failed to connect to '{name}': {e}"))?,- ))-}-fn client_info() -> ClientInfo {- ClientInfo {- protocol_version: Default::default(),- capabilities: ClientCapabilities::default(),- client_info: Implementation {- name: "Jan CLI Client".to_string(),- version: "0.0.1".to_string(),- title: None,- website_url: None,- icons: None,- },- }+ ClientInfo::new(+ ClientCapabilities::default(),+ Implementation::new("Jan CLI Client", "0.0.1"),+ )}/// Build a reqwest client that sends the configured `headers` on every request-/// (http/sse auth). Non-string header names/values are skipped.+/// (http auth). Non-string header names/values are skipped. Uses `reqwest13`+/// because rmcp's streamable-http transport is implemented for reqwest 0.13.fn http_client(headers: &serde_json::Map<String, Value>,-) -> Result<reqwest::Client, String> {- let mut map = reqwest::header::HeaderMap::new();+) -> Result<reqwest13::Client, String> {+ let mut map = reqwest13::header::HeaderMap::new();for (key, value) in headers.iter() {if let Some(v) = value.as_str() {if let (Ok(name), Ok(val)) = (- reqwest::header::HeaderName::from_bytes(key.as_bytes()),- reqwest::header::HeaderValue::from_str(v),+ reqwest13::header::HeaderName::from_bytes(key.as_bytes()),+ reqwest13::header::HeaderValue::from_str(v),) {map.insert(name, val);}}}- reqwest::Client::builder()+ reqwest13::Client::builder().default_headers(map).build().map_err(|e| e.to_string())@@ -670,10 +645,10 @@ pub async fn describe(name: &str, servers: &SharedMcpServers) -> Option<ServerDecapabilities.push(label);}}- implementation = Some(format!(- "{} {}",- peer.server_info.name, peer.server_info.version- ));+ implementation = peer+ .server_info+ .as_ref()+ .map(|si| format!("{} {}", si.name, si.version));}Some(ServerDetail {diff --git a/src-tauri/src/core/mcp/commands.rs b/src-tauri/src/core/mcp/commands.rsindex 70b36fdb4..ab6ce7cc6 100644--- a/src-tauri/src/core/mcp/commands.rs+++ b/src-tauri/src/core/mcp/commands.rs@@ -1,4 +1,4 @@-use rmcp::model::{CallToolRequestParam, CallToolResult};+use rmcp::model::{CallToolRequestParams, CallToolResult};use serde_json::{json, Map, Value};use tauri::{AppHandle, Emitter, Manager, Runtime, State};use tauri_plugin_opener::OpenerExt;@@ -475,10 +475,11 @@ pub async fn call_tool(log::info!("Found tool {tool_name} in server {srv_name}");// Call the tool with timeout and cancellation support- let tool_call = service.call_tool(CallToolRequestParam {- name: tool_name.clone().into(),- arguments,- });+ let mut params = CallToolRequestParams::new(tool_name.clone());+ if let Some(args) = arguments.clone() {+ params = params.with_arguments(args);+ }+ let tool_call = service.call_tool(params);// Race between timeout, tool call, and cancellationlet result = if cancellation_token.is_some() {@@ -810,10 +811,7 @@ enum PingResult {async fn try_ping_tool(service: &RunningMcpService) -> PingResult {let result = timeout(Duration::from_secs(3),- service.call_tool(CallToolRequestParam {- name: "ping".into(),- arguments: Some(Map::new()),- }),+ service.call_tool(CallToolRequestParams::new("ping").with_arguments(Map::new())),).await;@@ -848,10 +846,9 @@ async fn try_browser_snapshot_tool(service: &RunningMcpService) -> Result<bool,// Snapshot tool is very time-consuming// Extend timeout to make sure the tool call has enough time to succeedDuration::from_secs(20),- service.call_tool(CallToolRequestParam {- name: "browser_snapshot".into(),- arguments: Some(Map::new()),- }),+ service.call_tool(+ CallToolRequestParams::new("browser_snapshot").with_arguments(Map::new()),+ ),).await;diff --git a/src-tauri/src/core/mcp/helpers.rs b/src-tauri/src/core/mcp/helpers.rsindex c2584c89e..386341e4e 100644--- a/src-tauri/src/core/mcp/helpers.rs+++ b/src-tauri/src/core/mcp/helpers.rs@@ -1,9 +1,9 @@use rmcp::{model::{ClientCapabilities, ClientInfo, Implementation},transport::{- sse_client::SseClient, streamable_http_client::StreamableHttpClient,- streamable_http_client::StreamableHttpClientTransportConfig, SseClientTransport,- StreamableHttpClientTransport, TokioChildProcess,+ streamable_http_client::StreamableHttpClient,+ streamable_http_client::StreamableHttpClientTransportConfig, StreamableHttpClientTransport,+ TokioChildProcess,},ServiceExt,};@@ -419,7 +419,7 @@ async fn schedule_mcp_start_task<R: Runtime>(// One client for both transports, and one place the configured headers// are turned into a `HeaderMap` -- the http and sse arms used to carry// identical copies of that loop.- let base = reqwest::Client::builder()+ let base = reqwest13::Client::builder().default_headers(header_map(&config_params.headers)).connect_timeout(config_params.timeout.unwrap_or(Duration::MAX)).build()@@ -435,18 +435,21 @@ async fn schedule_mcp_start_task<R: Runtime>(.map_err(|detail| oauth::NEEDS_AUTH_PREFIX.to_string() + &detail)?;let had_credentials = authorized.is_some();- let label = if transport == "http" {- "Jan Streamable Client"- } else {- "Jan SSE Client"- };- let handler = JanClientHandler::new(client_info(label), name.clone(), app.clone());+ // rmcp 3.x dropped the SSE client transport (MCP deprecated HTTP+SSE for+ // Streamable HTTP), so a legacy `sse` config is served over the+ // streamable-http client instead of a dedicated SSE one.+ if transport == "sse" {+ log::warn!(+ "MCP server '{name}' is configured with the deprecated 'sse' transport; \+ connecting over Streamable HTTP instead"+ );+ }+ let handler =+ JanClientHandler::new(client_info("Jan Streamable Client"), name.clone(), app.clone());- let client = match (transport, authorized) {- ("http", Some(c)) => serve_http(c, &url, handler).await,- ("http", None) => serve_http(base, &url, handler).await,- (_, Some(c)) => serve_sse(c, &url, handler).await,- (_, None) => serve_sse(base, &url, handler).await,+ let client = match authorized {+ Some(c) => serve_http(c, &url, handler).await,+ None => serve_http(base, &url, handler).await,};match client {@@ -764,14 +767,15 @@ fn log_mcp_stderr_line(server_name: &str, line: &str) {}/// Turn the entry's configured `headers` map into a `HeaderMap`, skipping any-/// pair that is not a valid header name/value. Shared by both remote transports.-fn header_map(headers: &serde_json::Map<String, Value>) -> reqwest::header::HeaderMap {- let mut map = reqwest::header::HeaderMap::new();+/// pair that is not a valid header name/value. Uses `reqwest13` because rmcp's+/// streamable-http transport is implemented for reqwest 0.13.+fn header_map(headers: &serde_json::Map<String, Value>) -> reqwest13::header::HeaderMap {+ let mut map = reqwest13::header::HeaderMap::new();for (key, value) in headers.iter() {if let Some(v) = value.as_str() {if let (Ok(name), Ok(val)) = (- reqwest::header::HeaderName::from_bytes(key.as_bytes()),- reqwest::header::HeaderValue::from_str(v),+ reqwest13::header::HeaderName::from_bytes(key.as_bytes()),+ reqwest13::header::HeaderValue::from_str(v),) {map.insert(name, val);}@@ -781,17 +785,10 @@ fn header_map(headers: &serde_json::Map<String, Value>) -> reqwest::header::Head}fn client_info(label: &str) -> ClientInfo {- ClientInfo {- protocol_version: Default::default(),- capabilities: ClientCapabilities::default(),- client_info: Implementation {- name: label.to_string(),- version: "0.0.1".to_string(),- title: None,- website_url: None,- icons: None,- },- }+ ClientInfo::new(+ ClientCapabilities::default(),+ Implementation::new(label, "0.0.1"),+ )}/// Serve the streamable-http transport over any client that implements it, so@@ -806,35 +803,11 @@ where{let transport = StreamableHttpClientTransport::with_client(client,- StreamableHttpClientTransportConfig {- uri: url.to_string().into(),- ..Default::default()- },+ StreamableHttpClientTransportConfig::with_uri(url.to_string()),);handler.serve(transport).await.map_err(|e| e.to_string())}-/// `serve_http`'s counterpart for the legacy SSE transport.-async fn serve_sse<C>(- client: C,- url: &str,- handler: JanClientHandler,-) -> Result<RunningMcpService, String>-where- C: SseClient + Send + Sync + 'static,-{- let transport = SseClientTransport::start_with_client(- client,- rmcp::transport::sse_client::SseClientConfig {- sse_endpoint: url.to_string().into(),- ..Default::default()- },- )- .await- .map_err(|e| format!("Failed to start SSE transport: {e}"))?;- handler.serve(transport).await.map_err(|e| e.to_string())-}-fn emit_mcp_update_event<R: Runtime>(app: &AppHandle<R>, name: &str) {if let Err(e) = app.emit("mcp-update",diff --git a/src-tauri/src/core/mcp/oauth.rs b/src-tauri/src/core/mcp/oauth.rsindex 3c0466e5c..49587e0d4 100644--- a/src-tauri/src/core/mcp/oauth.rs+++ b/src-tauri/src/core/mcp/oauth.rs@@ -21,7 +21,7 @@ use std::net::{Ipv4Addr, SocketAddr};use std::path::{Path, PathBuf};use std::time::{Duration, SystemTime, UNIX_EPOCH};-use rmcp::transport::auth::{AuthClient, OAuthState, OAuthTokenResponse};+use rmcp::transport::auth::{AuthClient, AuthorizationRequest, OAuthState, OAuthTokenResponse};use serde::{Deserialize, Serialize};use serde_json::Value;@@ -286,7 +286,7 @@ pub async fn advertises_oauth(url: &str) -> bool {let OAuthState::Unauthorized(manager) = state else {return false;};- manager.discover_metadata().await.is_ok()+ manager.resolve_metadata().await.is_ok()}/// An authorization in flight: the browser has somewhere to go and the loopback@@ -325,7 +325,9 @@ pub async fn begin(server: &str, url: &str) -> Result<PendingAuth, String> {.await.map_err(|e| format!("could not reach '{url}' for OAuth discovery: {e}"))?;state- .start_authorization(&[], &redirect_uri, Some(CLIENT_NAME))+ .start_authorization(+ AuthorizationRequest::new(redirect_uri.clone()).with_client_name(CLIENT_NAME),+ ).await.map_err(|e| format!("'{server}' does not offer OAuth we can use: {e}"))?;let authorization_url = state@@ -532,8 +534,8 @@ pub async fn authorized_client(name: &str,url: &str,config: &Value,- base: reqwest::Client,-) -> Result<Option<AuthClient<reqwest::Client>>, String> {+ base: reqwest13::Client,+) -> Result<Option<AuthClient<reqwest13::Client>>, String> {if has_static_authorization(config) {return Ok(None);}@@ -588,14 +590,15 @@ pub async fn authorized_client(#[cfg(test)]mod tests {use super::*;- use oauth2::{AccessToken, EmptyExtraTokenFields, RefreshToken, TokenResponse};+ use oauth2::{AccessToken, RefreshToken, TokenResponse};+ use rmcp::transport::auth::VendorExtraTokenFields;use serde_json::json;fn tokens(expires_in: Option<u64>, refresh: bool) -> OAuthTokenResponse {let mut t = OAuthTokenResponse::new(AccessToken::new("at-1".to_string()),oauth2::basic::BasicTokenType::Bearer,- EmptyExtraTokenFields {},+ VendorExtraTokenFields::default(),);if let Some(secs) = expires_in {t.set_expires_in(Some(&Duration::from_secs(secs)));@@ -769,7 +772,7 @@ mod tests {"s","https://x/mcp",&config,- reqwest::Client::new(),+ reqwest13::Client::new(),));assert!(matches!(got, Ok(None)));}@@ -788,7 +791,7 @@ mod tests {"s","https://new/mcp",&config,- reqwest::Client::new(),+ reqwest13::Client::new(),));let err = got.expect_err("stale resource is an error, not a silent skip");assert!(err.contains("https://old/mcp"), "{err}");diff --git a/src-tauri/src/core/mcp/progress.rs b/src-tauri/src/core/mcp/progress.rsindex 6de6eb3ef..d66467ec6 100644--- a/src-tauri/src/core/mcp/progress.rs+++ b/src-tauri/src/core/mcp/progress.rs@@ -93,12 +93,12 @@ mod tests {use rmcp::model::{NumberOrString, ProgressToken};fn params(progress: f64, total: Option<f64>) -> ProgressNotificationParam {- ProgressNotificationParam {- progress_token: ProgressToken(NumberOrString::Number(1)),- progress,- total,- message: None,+ let mut p =+ ProgressNotificationParam::new(ProgressToken(NumberOrString::Number(1)), progress);+ if let Some(total) = total {+ p = p.with_total(total);}+ p}#[test]diff --git a/src-tauri/src/core/mcp/truncate.rs b/src-tauri/src/core/mcp/truncate.rsindex f38e775bd..e940dce81 100644--- a/src-tauri/src/core/mcp/truncate.rs+++ b/src-tauri/src/core/mcp/truncate.rs@@ -6,7 +6,7 @@//! is. Everything that hands an MCP result to a model funnels through here first//! so the payload is bounded and the clipping is announced rather than silent.-use rmcp::model::{CallToolResult, Content};+use rmcp::model::{CallToolResult, ContentBlock};/// Total text characters carried by a result, across every text block.fn total_text_chars(result: &CallToolResult) -> usize {@@ -48,7 +48,7 @@ pub fn truncate_tool_result(result: &CallToolResult, max_chars: u64) -> CallTool}let mut used = 0usize;- let mut new_content: Vec<Content> = Vec::with_capacity(result.content.len() + 1);+ let mut new_content: Vec<ContentBlock> = Vec::with_capacity(result.content.len() + 1);for block in &result.content {let Some(text) = block.as_text() else {@@ -68,20 +68,17 @@ pub fn truncate_tool_result(result: &CallToolResult, max_chars: u64) -> CallToolif keep == len {new_content.push(block.clone());} else {- new_content.push(Content::text(+ new_content.push(ContentBlock::text(text.text.chars().take(keep).collect::<String>(),));}}- new_content.push(Content::text(truncation_marker(used, total)));+ new_content.push(ContentBlock::text(truncation_marker(used, total)));- CallToolResult {- content: new_content,- structured_content: result.structured_content.clone(),- is_error: result.is_error,- meta: result.meta.clone(),- }+ let mut truncated = result.clone();+ truncated.content = new_content;+ truncated}#[cfg(test)]@@ -89,7 +86,7 @@ mod tests {use super::*;fn text_result(parts: &[&str]) -> CallToolResult {- CallToolResult::success(parts.iter().map(|p| Content::text(*p)).collect())+ CallToolResult::success(parts.iter().map(|p| ContentBlock::text(*p)).collect())}fn texts(result: &CallToolResult) -> Vec<String> {@@ -107,7 +104,7 @@ mod tests {#[test]fn serialized_result_the_web_layer_receives_is_bounded() {// Stand-in for a Jan Browser MCP page snapshot: one enormous text block.- let snapshot = CallToolResult::success(vec![Content::text(+ let snapshot = CallToolResult::success(vec![ContentBlock::text("<div>page</div>".repeat(100_000),)]);@@ -194,8 +191,8 @@ mod tests {#[test]fn non_text_blocks_survive_truncation() {let result = CallToolResult::success(vec![- Content::text("z".repeat(1_000)),- Content::image("ZmFrZQ==".to_string(), "image/png".to_string()),+ ContentBlock::text("z".repeat(1_000)),+ ContentBlock::image("ZmFrZQ==".to_string(), "image/png".to_string()),]);let capped = truncate_tool_result(&result, 10);diff --git a/src-tauri/src/core/state.rs b/src-tauri/src/core/state.rsindex 22c4ecabd..17ec68925 100644--- a/src-tauri/src/core/state.rs+++ b/src-tauri/src/core/state.rs@@ -10,7 +10,7 @@ use crate::core::mcp::models::{McpSettings, ToolWithServer};#[cfg(not(feature = "cli"))]use crate::core::mcp::progress::JanClientHandler;#[cfg(feature = "cli")]-use rmcp::model::{CallToolRequestParam, CallToolResult, InitializeRequestParam, Tool};+use rmcp::model::{CallToolRequestParams, CallToolResult, InitializeRequestParams, Tool};#[cfg(feature = "cli")]use rmcp::ServiceError;use rmcp::{service::RunningService, RoleClient};@@ -72,7 +72,7 @@ pub type SharedMcpServers = Arc<Mutex<HashMap<String, RunningMcpService>>>;#[cfg(feature = "cli")]pub enum RunningServiceEnum {NoInit(RunningService<RoleClient, ()>),- WithInit(RunningService<RoleClient, InitializeRequestParam>),+ WithInit(RunningService<RoleClient, InitializeRequestParams>),}#[cfg(feature = "cli")]pub type SharedMcpServers = Arc<Mutex<HashMap<String, RunningServiceEnum>>>;@@ -87,7 +87,7 @@ impl RunningServiceEnum {}pub async fn call_tool(&self,- params: CallToolRequestParam,+ params: CallToolRequestParams,) -> Result<CallToolResult, ServiceError> {match self {Self::NoInit(s) => s.call_tool(params).await,@@ -95,12 +95,12 @@ impl RunningServiceEnum {}}- /// The `initialize` response: what the server said it implements. Read by+ /// The peer's handshake info: what the server said it implements. Read by/// the `/mcp` detail screen for its capabilities and version lines.- pub fn peer_info(&self) -> Option<rmcp::model::InitializeResult> {+ pub fn peer_info(&self) -> Option<rmcp::model::ServerPeerInfo> {match self {- Self::NoInit(s) => s.peer_info().cloned(),- Self::WithInit(s) => s.peer_info().cloned(),+ Self::NoInit(s) => s.peer_info().map(|p| (*p).clone()),+ Self::WithInit(s) => s.peer_info().map(|p| (*p).clone()),}}}