From fffc9aa223e59dd9984c2194043731f1c52cda4a Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <115500013+007harshmahajan@users.noreply.github.com> Date: Sat, 14 Nov 2026 10:40:54 +0000 Subject: [PATCH] fix(deps): upgrade rmcp-openapi to v0.32.1 and drop actix (#16809) Co-authored-by: haohuaijin Co-authored-by: Hengfei Yang --- .cargo/audit.toml | 2 - Cargo.lock | 466 +++++++----------- Cargo.toml | 2 +- .../http/src/handler/http/request/mcp/mod.rs | 51 +- .../http/src/handler/http/router/openapi.rs | 1 + src/common/src/meta/user.rs | 9 + src/mcp/src/schema.rs | 71 +++ src/mcp/src/tools.rs | 6 +- 8 files changed, 316 insertions(+), 292 deletions(-) diff --git a/.cargo/audit.toml b/.cargo/audit.toml index d86b5fda5d..3fbbfe3e42 100644 --- a/.cargo/audit.toml +++ b/.cargo/audit.toml @@ -15,7 +15,6 @@ ignore = [ "RUSTSEC-2026-0105", # from core2 0.4.0 (yanked + unmaintained), transitive via pyroscope -> libflate; no upgrade path until libflate publishes a release that drops the core2 dependency "RUSTSEC-2026-0194", # from quick-xml (0.26/0.38/0.39), transitive deps; fixed in >=0.41.0 but upstreams have not yet migrated "RUSTSEC-2026-0195", # from quick-xml (0.26/0.38/0.39), transitive deps; fixed in >=0.41.0 but upstreams have not yet migrated - "RUSTSEC-2026-0189", # from rmcp (0.12/0.13), transitive deps; fix requires 1.4.0 (major bump), no upgrade path yet "RUSTSEC-2026-0310", # from domain 0.11, transitive dep of vrl 0.31; fixed in domain 0.12 which vrl has not adopted yet "RUSTSEC-2026-0367", # from zip 0.6 (chromiumoxide_fetcher, unpacks the Chromium download) and zip 3 (utoipa-swagger-ui build script); fix requires zip 9, no upgrade path upstream "RUSTSEC-2026-0368", # from zip 0.6/3, same sources as RUSTSEC-2026-0367; only trusted archives are extracted @@ -25,6 +24,5 @@ ignore = [ "RUSTSEC-2026-0398", # from zstd-safe 7, the zstd 0.13 line above; fixed in zstd-safe 8, which needs zstd 0.14 "RUSTSEC-2026-0403", # from zstd-safe 7, the zstd 0.13 line above; fixed in zstd-safe 8, which needs zstd 0.14 "RUSTSEC-2026-0459", # from libsqlite3-sys 0.30 via sqlx-sqlite; only our own data dir's database is opened, never untrusted files; fix needs >=0.39 but sqlx-sqlite 0.9 still caps it below 0.38 - "RUSTSEC-2026-0462", # from rmcp (0.12/0.13) via rmcp-openapi; affects the Streamable HTTP clients, we only enable the server features; fix requires rmcp 3.9 (major bump of the rmcp-openapi fork) ] informational_warnings = ["unmaintained"] # warn for categories of informational advisories diff --git a/Cargo.lock b/Cargo.lock index 8ab8c4a88c..d9f13ad7d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,154 +18,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" -[[package]] -name = "actix-codec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" -dependencies = [ - "bitflags 2.13.1", - "bytes", - "futures-core", - "futures-sink", - "memchr", - "pin-project-lite", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "actix-http" -version = "3.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3422032be73eeb15bafdb64086386385875b653eb418a80241d1f98473e86ea6" -dependencies = [ - "actix-codec", - "actix-service", - "actix-utils", - "bitflags 2.13.1", - "bytes", - "bytestring", - "derive_more 2.1.1", - "encoding_rs", - "foldhash 0.2.0", - "futures-core", - "http 0.2.12", - "httparse", - "httpdate", - "itoa", - "language-tags", - "mime", - "percent-encoding", - "pin-project-lite", - "smallvec", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "actix-router" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f8c75c51892f18d9c46150c5ac7beb81c95f78c8b83a634d49f4ca32551fe7" -dependencies = [ - "bytestring", - "cfg-if", - "http 0.2.12", - "regex-lite", - "serde", - "tracing", -] - -[[package]] -name = "actix-rt" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92589714878ca59a7626ea19734f0e07a6a875197eec751bb5d3f99e64998c63" -dependencies = [ - "futures-core", - "tokio", -] - -[[package]] -name = "actix-server" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3716aae056e2f869b7b5cfd8a08fcf98890f8455bec61d69c7dff5d8576f9d2b" -dependencies = [ - "actix-rt", - "actix-service", - "actix-utils", - "futures-core", - "futures-util", - "mio", - "socket2", - "tokio", - "tracing", -] - -[[package]] -name = "actix-service" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e46f36bf0e5af44bdc4bdb36fbbd421aa98c79a9bce724e1edeb3894e10dc7f" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "actix-utils" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" -dependencies = [ - "local-waker", - "pin-project-lite", -] - -[[package]] -name = "actix-web" -version = "4.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd6966acfcc7b66b37bdeea7d11665d5accac89333767e1784d2cecd33984e7" -dependencies = [ - "actix-codec", - "actix-http", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-utils", - "bytes", - "bytestring", - "cfg-if", - "derive_more 2.1.1", - "encoding_rs", - "foldhash 0.2.0", - "futures-core", - "futures-util", - "impl-more", - "itoa", - "language-tags", - "log", - "mime", - "once_cell", - "pin-project-lite", - "regex-lite", - "serde", - "serde_json", - "serde_urlencoded", - "smallvec", - "socket2", - "time", - "tokio", - "tracing", - "url", -] - [[package]] name = "addr2line" version = "0.25.1" @@ -372,7 +224,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -383,7 +235,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1980,7 +1832,7 @@ version = "3.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dee98b0db6a962de883bf5d20362dee4d7ca0d12fe39a7c6c73c844e1cd7c1f" dependencies = [ - "darling 0.23.0", + "darling 0.20.11", "ident_case", "prettyplease", "proc-macro2", @@ -2125,15 +1977,6 @@ dependencies = [ "either", ] -[[package]] -name = "bytestring" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86566c496f2f47d9b8147a4c8b02ffdb69c919fe0c2b2e7195d22cbba0e635c9" -dependencies = [ - "bytes", -] - [[package]] name = "bzip2" version = "0.6.1" @@ -3280,6 +3123,16 @@ dependencies = [ "darling_macro 0.23.0", ] +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core 0.24.1", + "darling_macro 0.24.1", +] + [[package]] name = "darling_core" version = "0.20.11" @@ -3307,6 +3160,19 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.9", +] + [[package]] name = "darling_macro" version = "0.20.11" @@ -3329,6 +3195,17 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core 0.24.1", + "quote", + "syn 3.0.9", +] + [[package]] name = "dashmap" version = "6.2.1" @@ -4382,7 +4259,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.2", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4730,7 +4607,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4843,6 +4720,17 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "fancy-regex" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301f5bf187b3c295fce6468d3875037a0bccc5f6b151c63cac2f85babf21912" +dependencies = [ + "bit-set 0.8.0", + "regex-automata", + "regex-syntax", +] + [[package]] name = "fastdivide" version = "0.4.2" @@ -5066,6 +4954,16 @@ dependencies = [ "num", ] +[[package]] +name = "fraction" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e246562084dde8ebbcc943b261c406ce4f68e5032ec28029a251a47d6a295500" +dependencies = [ + "num", + "num-bigint 0.4.8", +] + [[package]] name = "framehop" version = "0.13.3" @@ -5916,12 +5814,6 @@ dependencies = [ "png", ] -[[package]] -name = "impl-more" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "277ff51754a3f68f12f58446c5d006aa8baa4914ea273cce24a599cfaff33d4f" - [[package]] name = "indexmap" version = "1.9.3" @@ -6176,7 +6068,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -6384,23 +6276,79 @@ dependencies = [ "data-encoding", "email_address", "fancy-regex 0.17.0", - "fraction", + "fraction 0.15.4", "getrandom 0.3.4", "idna", "itoa", "num-cmp", "num-traits", "percent-encoding", - "referencing", + "referencing 0.38.1", "regex", "regex-syntax", - "reqwest 0.12.28", "serde", "serde_json", "unicode-general-category", "uuid-simd", ] +[[package]] +name = "jsonschema" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a42a11b47492e6a2cc76e9c7bcc8077776cb31dac444e0795d7f61bcc6441c08" +dependencies = [ + "ahash 0.8.12", + "bytecount", + "data-encoding", + "email_address", + "fancy-regex 0.19.2", + "fraction 0.17.0", + "getrandom 0.3.4", + "idna", + "itoa", + "jsonschema-regex", + "jsonschema-value", + "num-cmp", + "num-traits", + "percent-encoding", + "referencing 0.60.2", + "regex", + "reqwest 0.13.4", + "rustls", + "serde", + "serde_json", + "strum 0.28.0", + "unicode-general-category", + "uuid-simd", +] + +[[package]] +name = "jsonschema-regex" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "107aeb6ff14b8deb5610096a8ce5c554ec89806b521147eaeb3cae05b07edb7a" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "jsonschema-value" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e281d6b177bb4834f2ffd6f92aa0443cffe29c996b251c8d94eb6f456186feba" +dependencies = [ + "ahash 0.8.12", + "bytecount", + "fraction 0.17.0", + "getrandom 0.3.4", + "memchr", + "num-cmp", + "num-traits", + "serde_json", + "zmij", +] + [[package]] name = "jsonwebtoken" version = "10.4.0" @@ -6469,12 +6417,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "language-tags" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" - [[package]] name = "lasso" version = "0.7.3" @@ -6730,12 +6672,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "local-waker" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" - [[package]] name = "lock_api" version = "0.4.14" @@ -7034,6 +6970,12 @@ dependencies = [ "zstd 0.13.3", ] +[[package]] +name = "micromap" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a86d3146ed3995b5913c414f6664344b9617457320782e64f0bb44afd49d74" + [[package]] name = "mimalloc" version = "0.1.52" @@ -7082,7 +7024,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" dependencies = [ "libc", - "log", "wasi", "windows-sys 0.61.2", ] @@ -7346,7 +7287,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -7527,9 +7468,9 @@ version = "0.1.0" [[package]] name = "oas3" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f67c885c7b19aaf652e84102035258ecb4e0425a4f71037e187798e367bd87" +checksum = "05ed0821ab10d7703415a06df039c2493f3a7667999d8b4e104731de0c53796f" dependencies = [ "derive_more 2.1.1", "http 1.5.0", @@ -8124,7 +8065,7 @@ dependencies = [ "http-body-util", "infra", "ingestion-common", - "jsonschema", + "jsonschema 0.38.1", "log", "o2_dex", "o2_enterprise", @@ -8218,7 +8159,7 @@ dependencies = [ "infra", "ingester", "itertools 0.14.0", - "jsonschema", + "jsonschema 0.38.1", "log", "mime", "o2_dex", @@ -9628,7 +9569,7 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "itertools 0.14.0", "log", "multimap", @@ -9719,7 +9660,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe500dc80e757a75e1e8fb7290e448d62dfba3105ece1d058579cb00b58151cd" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "prost 0.14.4", "prost-build", "prost-types 0.14.4", @@ -10064,7 +10005,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -10352,6 +10293,23 @@ dependencies = [ "serde_json", ] +[[package]] +name = "referencing" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f42818036d3b37cda6bd4c494543158a36e431cb717015ef7c93acc6ba214d3b" +dependencies = [ + "ahash 0.8.12", + "fluent-uri", + "getrandom 0.3.4", + "hashbrown 0.17.1", + "itoa", + "micromap", + "parking_lot 0.12.5", + "percent-encoding", + "serde_json", +] + [[package]] name = "regex" version = "1.13.1" @@ -10450,7 +10408,6 @@ checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64 0.22.1", "bytes", - "futures-channel", "futures-core", "futures-util", "h2", @@ -10660,25 +10617,28 @@ dependencies = [ [[package]] name = "rmcp" -version = "0.12.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528d42f8176e6e5e71ea69182b17d1d0a19a6b3b894b564678b74cd7cab13cfa" +checksum = "d24a7e92f4bcaa36b97fa93c4fa7ca8f3e669eced949345b3462dba333c7f909" dependencies = [ "async-trait", - "base64 0.22.1", + "base64 0.23.1", "bytes", "chrono", "futures", "http 1.5.0", "http-body 1.1.0", "http-body-util", + "indexmap 2.14.0", + "libc", "pastey", "pin-project-lite", - "rand 0.9.5", - "rmcp-macros 0.12.0", + "rand 0.10.2", + "rmcp-macros", "schemars 1.2.2", "serde", "serde_json", + "sha2 0.11.0", "sse-stream", "thiserror 2.0.21", "tokio", @@ -10689,102 +10649,40 @@ dependencies = [ "uuid", ] -[[package]] -name = "rmcp" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1815dbc06c414d720f8bc1951eccd66bc99efc6376331f1e7093a119b3eb508" -dependencies = [ - "async-trait", - "axum", - "base64 0.22.1", - "bytes", - "chrono", - "futures", - "http 1.5.0", - "http-body 1.1.0", - "http-body-util", - "pastey", - "pin-project-lite", - "rand 0.9.5", - "rmcp-macros 0.13.0", - "schemars 1.2.2", - "serde", - "serde_json", - "sse-stream", - "thiserror 2.0.21", - "tokio", - "tokio-stream", - "tokio-util", - "tower-service", - "tracing", - "uuid", -] - -[[package]] -name = "rmcp-actix-web" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79d583880b37748b74ef1895a25ea5ddfa3abfe8881f0539a626d3feb65e9b9a" -dependencies = [ - "actix-web", - "async-stream", - "bon", - "futures", - "rmcp 0.13.0", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tracing", -] - [[package]] name = "rmcp-macros" -version = "0.12.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3f81daaa494eb8e985c9462f7d6ce1ab05e5299f48aafd76cdd3d8b060e6f59" +checksum = "b3140f24a766f80f9ec1607bde85680959a69b83d46fa9ce87dadab7e67ab029" dependencies = [ - "darling 0.23.0", + "darling 0.24.1", "proc-macro2", "quote", "serde_json", - "syn 2.0.119", -] - -[[package]] -name = "rmcp-macros" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11f0bc7008fa102e771a76c6d2c9b253be3f2baa5964e060464d038ae1cbc573" -dependencies = [ - "darling 0.23.0", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.119", + "syn 3.0.9", ] [[package]] name = "rmcp-openapi" -version = "0.23.2" -source = "git+https://github.com/openobserve/rmcp-openapi?branch=v0.23.2-feat#fa758f70818f6fcf31efdd6f2b64a9480afb48bb" +version = "0.32.1" +source = "git+https://github.com/openobserve/rmcp-openapi?branch=v0.32.1-feat#b377944e6fda171c5fe14b19ef2da5cbc85b446e" dependencies = [ - "base64 0.22.1", + "async-trait", + "base64 0.23.1", "bon", "heck 0.5.0", "http 1.5.0", "indexmap 2.14.0", - "jsonschema", + "jsonschema 0.60.2", "mime", "oas3", "regex", "reqwest 0.13.4", - "rmcp 0.12.0", - "rmcp-actix-web", + "rmcp", "schemars 1.2.2", "serde", "serde_json", + "serde_path_to_error", "strsim", "thiserror 2.0.21", "tracing", @@ -11012,7 +10910,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -11071,7 +10969,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -11993,7 +11891,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.119", @@ -12005,7 +11903,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287f59010008f0d7cf5e3b03196d666c1acc46c8d3e9cf34c28a1a7157601e72" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.119", @@ -12024,7 +11922,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -12344,7 +12242,7 @@ dependencies = [ "cfg-if", "libc", "psm", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -12858,10 +12756,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.3", "once_cell", "rustix 1.1.4", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -12881,7 +12779,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -13527,7 +13425,7 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8464ec13c3691491391d9fce00f6416c9a48e46972f72d7865688be2080192c9" dependencies = [ - "rand 0.9.5", + "rand 0.10.2", ] [[package]] @@ -14641,7 +14539,7 @@ dependencies = [ "influxdb-line-protocol", "ipcrypt-rs", "itertools 0.14.0", - "jsonschema", + "jsonschema 0.38.1", "lalrpop", "lalrpop-util", "lz4_flex 0.11.6", @@ -15000,7 +14898,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]] diff --git a/Cargo.toml b/Cargo.toml index 31755c69e8..e7b7c9deba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -382,7 +382,7 @@ multer = "3.1" pprof = { version = "0.15", features = ["flamegraph", "protobuf-codec", "framehop-unwinder"] } promql-parser = "0.11" rcgen = "0.14.4" -rmcp-openapi = { version = "0.23.2", git = "https://github.com/openobserve/rmcp-openapi", branch = "v0.23.2-feat" } +rmcp-openapi = { version = "0.32.1", git = "https://github.com/openobserve/rmcp-openapi", branch = "v0.32.1-feat", default-features = false } rust-embed-for-web = "11.4.1" sourcemap = "9.3.2" tikv-jemalloc-ctl = { version = "0.6", features = [ diff --git a/src/api/http/src/handler/http/request/mcp/mod.rs b/src/api/http/src/handler/http/request/mcp/mod.rs index e30fc0c97f..b4f600e2b9 100644 --- a/src/api/http/src/handler/http/request/mcp/mod.rs +++ b/src/api/http/src/handler/http/request/mcp/mod.rs @@ -792,8 +792,8 @@ mod tests { assert_eq!(response.status(), StatusCode::NO_CONTENT); } - #[test] - fn oss_openapi_initializes_mcp_tools() { + #[tokio::test] + async fn oss_openapi_initializes_mcp_tools() { let api = crate::handler::http::router::openapi::ApiDoc::openapi(); openobserve_mcp::tools::init_mcp_tools(&api).unwrap(); @@ -841,6 +841,53 @@ mod tests { ] { assert!(tools.iter().all(|tool| tool.name != name), "{name}"); } + // Enterprise exposes only UserGet on the user path, so UserUpdate is not a tool there. + let user_update_is_tool = !cfg!(feature = "enterprise"); + assert_eq!( + tools.iter().any(|tool| tool.name == "UserUpdate"), + user_update_is_tool + ); + let mut body_checks = vec![("CreateAlert", &["name", "folder_id"][..])]; + if user_update_is_tool { + body_checks.push(("UserUpdate", &["first_name", "new_password", "role"][..])); + } + for (name, fields) in body_checks { + let tool = tools + .iter() + .find(|tool| tool.name == name) + .unwrap_or_else(|| panic!("{name} is not an MCP tool")); + let body = &tool.input_schema["properties"]["request_body"]; + for field in fields { + assert!( + body["properties"].get(field).is_some(), + "{name} cannot express {field}" + ); + } + } + if !user_update_is_tool { + return; + } + + let user_update = openobserve_mcp::tools::get_tool_metadata("UserUpdate").unwrap(); + for body in [ + serde_json::json!({"first_name": "name"}), + serde_json::json!({"role": "admin"}), + ] { + let arguments = serde_json::json!({ + "org_id": "default", + "email_id": "user@example.com", + "request_body": body, + }); + let result = openobserve_mcp::tools::get_shared_http_client() + .execute_tool_call(&user_update, &arguments) + .await; + if let Err(error) = result { + assert!( + !format!("{error:?}").starts_with("Validation"), + "UserUpdate refused {body}: {error}" + ); + } + } } #[test] diff --git a/src/api/http/src/handler/http/router/openapi.rs b/src/api/http/src/handler/http/router/openapi.rs index 1903f54a0e..ec5eab084e 100644 --- a/src/api/http/src/handler/http/router/openapi.rs +++ b/src/api/http/src/handler/http/router/openapi.rs @@ -891,6 +891,7 @@ use crate::{ openobserve_api_management::request::query_history::QueryHistoryListResponse, openobserve_api_management::request::query_history::QueryHistoryClearResponse, meta::user::UpdateUser, + meta::user::UpdateUserRole, meta::user::UserRoleRequest, meta::user::PostUserRequest, meta::user::UserOrgRole, diff --git a/src/common/src/meta/user.rs b/src/common/src/meta/user.rs index f2d1aa3b10..7a0cfed4d8 100644 --- a/src/common/src/meta/user.rs +++ b/src/common/src/meta/user.rs @@ -122,7 +122,9 @@ pub struct UpdateUser { pub old_password: Option, #[serde(skip_serializing_if = "Option::is_none")] pub new_password: Option, + // A flattened `Option` documents as `oneOf: [null, role]`, making `role` mandatory. #[serde(skip_serializing_if = "Option::is_none", flatten)] + #[schema(value_type = UpdateUserRole)] pub role: Option, #[serde(skip_serializing_if = "Option::is_none")] pub token: Option, @@ -133,6 +135,13 @@ pub struct UpdateUser { pub remove_lockout: bool, } +// Not a doc comment: utoipa would use it as the request body description. +#[derive(ToSchema)] +pub struct UpdateUserRole { + pub role: Option, + pub custom_role: Option>, +} + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, ToSchema)] pub enum UserUpdateMode { OtherUpdate, diff --git a/src/mcp/src/schema.rs b/src/mcp/src/schema.rs index a0d1066950..693281c47c 100644 --- a/src/mcp/src/schema.rs +++ b/src/mcp/src/schema.rs @@ -248,6 +248,7 @@ fn cleanup_schema_metadata(value: &mut Value) { { // Replace the entire object with the non-null variant let mut replacement = non_null.clone(); + carry_sibling_properties(map, &mut replacement); cleanup_schema_metadata(&mut replacement); *value = replacement; return; @@ -259,6 +260,7 @@ fn cleanup_schema_metadata(value: &mut Value) { if variants_clone.len() == 1 { // Replace the entire object with the single variant let mut replacement = variants_clone[0].clone(); + carry_sibling_properties(map, &mut replacement); cleanup_schema_metadata(&mut replacement); *value = replacement; return; @@ -279,6 +281,37 @@ fn cleanup_schema_metadata(value: &mut Value) { } } +/// A `oneOf` variant replaces its parent, so what is declared beside the `oneOf` moves into it. +fn carry_sibling_properties(parent: &serde_json::Map, variant: &mut Value) { + let Some(variant) = variant.as_object_mut() else { + return; + }; + if let Some(Value::Object(siblings)) = parent.get("properties") + && let Some(properties) = variant + .entry("properties") + .or_insert_with(|| Value::Object(serde_json::Map::new())) + .as_object_mut() + { + for (name, schema) in siblings { + properties + .entry(name.clone()) + .or_insert_with(|| schema.clone()); + } + } + if let Some(Value::Array(siblings)) = parent.get("required") + && let Some(required) = variant + .entry("required") + .or_insert_with(|| Value::Array(Vec::new())) + .as_array_mut() + { + for name in siblings { + if !required.contains(name) { + required.push(name.clone()); + } + } + } +} + #[cfg(test)] mod tests { use serde_json::json; @@ -474,6 +507,44 @@ mod tests { assert_eq!(variants[2]["type"], "object"); } + #[test] + fn test_single_variant_oneof_keeps_sibling_properties() { + let mut schema = json!({ + "type": "object", + "properties": {"folder_id": {"type": "string"}}, + "required": ["folder_id"], + "oneOf": [{ + "type": "object", + "properties": {"name": {"type": "string"}}, + "required": ["name"] + }] + }); + + cleanup_schema_metadata(&mut schema); + + assert!(schema.get("oneOf").is_none()); + assert_eq!(schema["properties"]["name"]["type"], "string"); + assert_eq!(schema["properties"]["folder_id"]["type"], "string"); + assert_eq!(schema["required"], json!(["name", "folder_id"])); + } + + #[test] + fn test_nullable_oneof_keeps_sibling_properties() { + let mut schema = json!({ + "properties": {"folder_id": {"type": "string"}}, + "oneOf": [ + {"type": "null"}, + {"type": "object", "properties": {"name": {"type": "string"}}} + ] + }); + + cleanup_schema_metadata(&mut schema); + + assert!(schema.get("oneOf").is_none()); + assert_eq!(schema["properties"]["name"]["type"], "string"); + assert_eq!(schema["properties"]["folder_id"]["type"], "string"); + } + #[test] fn test_remove_internal_fields_from_search_sql() { let schema = json!({ diff --git a/src/mcp/src/tools.rs b/src/mcp/src/tools.rs index 05719f6222..948e68d0a0 100644 --- a/src/mcp/src/tools.rs +++ b/src/mcp/src/tools.rs @@ -475,7 +475,7 @@ pub fn init_mcp_tools(api: &OpenApi) -> Result<()> { // Only extract metadata - this is fast (~186ms for 209 tools) // We skip generate_openapi_tools which creates 200+ HTTP clients (~19.5s) - let tools_metadata = spec.to_tool_metadata(None, false, false)?; + let tools_metadata = spec.to_tool_metadata(None, false, false, false)?; let mut tools: Vec> = Vec::with_capacity(tools_metadata.len()); let mut metadata_map: HashMap = @@ -628,7 +628,7 @@ pub fn enabled_tool_names(api: &OpenApi) -> Result> { let mcp_extensions = extract_mcp_extensions(api); let spec = rmcp_openapi::Spec::from_value(serde_json::to_value(api)?)?; let mut names: Vec = spec - .to_tool_metadata(None, false, false)? + .to_tool_metadata(None, false, false, false)? .into_iter() .map(|metadata| metadata.name) .filter(|name| is_tool_enabled(mcp_extensions.get(name))) @@ -696,7 +696,7 @@ pub async fn init_test_tools() { // Convert to rmcp_openapi spec and extract metadata let api_json = serde_json::to_value(&api).unwrap_or_default(); let spec = rmcp_openapi::Spec::from_value(api_json).unwrap(); - let tools_metadata = spec.to_tool_metadata(None, false, false).unwrap(); + let tools_metadata = spec.to_tool_metadata(None, false, false, false).unwrap(); // Convert to MCPTool format with simplified schemas let mut tools: Vec> = tools_metadata