Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

Merge branch 'main' into mcp_protocol

Nathanac8141ab15b0
diff --cc frontend/rust-lib/Cargo.lock
index 2b8da3c1e9,ba07ff9c3b..7b4967728f
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@@ -14,6 -14,6 +14,284 @@@ dependencies =
"syn 2.0.94",
]
++[[package]]
++name = "actix-codec"
++version = "0.5.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a"
++dependencies = [
++ "bitflags 2.4.0",
++ "bytes",
++ "futures-core",
++ "futures-sink",
++ "memchr",
++ "pin-project-lite",
++ "tokio",
++ "tokio-util",
++ "tracing",
++]
++
++[[package]]
++name = "actix-cors"
++version = "0.6.5"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "0346d8c1f762b41b458ed3145eea914966bb9ad20b9be0d6d463b20d45586370"
++dependencies = [
++ "actix-utils",
++ "actix-web",
++ "derive_more",
++ "futures-util",
++ "log",
++ "once_cell",
++ "smallvec",
++]
++
++[[package]]
++name = "actix-http"
++version = "3.5.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f"
++dependencies = [
++ "actix-codec",
++ "actix-rt",
++ "actix-service",
++ "actix-tls",
++ "actix-utils",
++ "ahash 0.8.6",
++ "base64 0.21.5",
++ "bitflags 2.4.0",
++ "brotli",
++ "bytes",
++ "bytestring",
++ "derive_more",
++ "encoding_rs",
++ "flate2",
++ "futures-core",
++ "h2 0.3.21",
++ "http 0.2.9",
++ "httparse",
++ "httpdate",
++ "itoa",
++ "language-tags",
++ "local-channel",
++ "mime",
++ "percent-encoding",
++ "pin-project-lite",
++ "rand 0.8.5",
++ "sha1",
++ "smallvec",
++ "tokio",
++ "tokio-util",
++ "tracing",
++ "zstd 0.13.2",
++]
++
++[[package]]
++name = "actix-macros"
++version = "0.2.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
++dependencies = [
++ "quote",
++ "syn 2.0.94",
++]
++
++[[package]]
++name = "actix-router"
++version = "0.5.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8"
++dependencies = [
++ "bytestring",
++ "cfg-if",
++ "http 0.2.9",
++ "regex",
++ "regex-lite",
++ "serde",
++ "tracing",
++]
++
++[[package]]
++name = "actix-rt"
++version = "2.10.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208"
++dependencies = [
++ "futures-core",
++ "tokio",
++]
++
++[[package]]
++name = "actix-server"
++version = "2.5.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6398974fd4284f4768af07965701efbbb5fdc0616bff20cade1bb14b77675e24"
++dependencies = [
++ "actix-rt",
++ "actix-service",
++ "actix-utils",
++ "futures-core",
++ "futures-util",
++ "mio 1.0.3",
++ "socket2 0.5.5",
++ "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-tls"
++version = "3.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ac453898d866cdbecdbc2334fe1738c747b4eba14a677261f2b768ba05329389"
++dependencies = [
++ "actix-rt",
++ "actix-service",
++ "actix-utils",
++ "futures-core",
++ "impl-more",
++ "pin-project-lite",
++ "tokio",
++ "tokio-rustls 0.23.4",
++ "tokio-util",
++ "tracing",
++ "webpki-roots 0.22.6",
++]
++
++[[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.4.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b"
++dependencies = [
++ "actix-codec",
++ "actix-http",
++ "actix-macros",
++ "actix-router",
++ "actix-rt",
++ "actix-server",
++ "actix-service",
++ "actix-tls",
++ "actix-utils",
++ "actix-web-codegen",
++ "ahash 0.8.6",
++ "bytes",
++ "bytestring",
++ "cfg-if",
++ "cookie 0.16.2",
++ "derive_more",
++ "encoding_rs",
++ "futures-core",
++ "futures-util",
++ "itoa",
++ "language-tags",
++ "log",
++ "mime",
++ "once_cell",
++ "pin-project-lite",
++ "regex",
++ "serde",
++ "serde_json",
++ "serde_urlencoded",
++ "smallvec",
++ "socket2 0.5.5",
++ "time",
++ "url",
++]
++
++[[package]]
++name = "actix-web-codegen"
++version = "4.3.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8"
++dependencies = [
++ "actix-router",
++ "proc-macro2",
++ "quote",
++ "syn 2.0.94",
++]
++
++[[package]]
++name = "actix-web-lab"
++version = "0.20.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "7675c1a84eec1b179c844cdea8488e3e409d8e4984026e92fa96c87dd86f33c6"
++dependencies = [
++ "actix-http",
++ "actix-router",
++ "actix-service",
++ "actix-utils",
++ "actix-web",
++ "actix-web-lab-derive",
++ "ahash 0.8.6",
++ "arc-swap",
++ "async-trait",
++ "bytes",
++ "bytestring",
++ "csv",
++ "derive_more",
++ "futures-core",
++ "futures-util",
++ "http 0.2.9",
++ "impl-more",
++ "itertools 0.12.1",
++ "local-channel",
++ "mediatype",
++ "mime",
++ "once_cell",
++ "pin-project-lite",
++ "regex",
++ "serde",
++ "serde_html_form",
++ "serde_json",
++ "tokio",
++ "tokio-stream",
++ "tracing",
++]
++
++[[package]]
++name = "actix-web-lab-derive"
++version = "0.20.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9aa0b287c8de4a76b691f29dbb5451e8dd5b79d777eaf87350c9b0cbfdb5e968"
++dependencies = [
++ "proc-macro2",
++ "quote",
++ "syn 2.0.94",
++]
++
++[[package]]
++name = "actix-ws"
++version = "0.2.5"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "535aec173810be3ca6f25dd5b4d431ae7125d62000aa3cbae1ec739921b02cf3"
++dependencies = [
++ "actix-codec",
++ "actix-http",
++ "actix-web",
++ "futures-core",
++ "tokio",
++]
++
[[package]]
name = "addr2line"
version = "0.21.0"
@@@ -217,7 -168,7 +446,7 @@@ dependencies =
"anyhow",
"bincode",
"getrandom 0.2.10",
-- "reqwest 0.12.9",
++ "reqwest 0.12.15",
"serde",
"serde_json",
"serde_repr",
@@@ -340,6 -285,6 +563,15 @@@ dependencies =
"zstd-safe 7.2.0",
]
++[[package]]
++name = "async-convert"
++version = "1.0.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6d416feee97712e43152cd42874de162b8f9b77295b1c85e5d92725cc8310bae"
++dependencies = [
++ "async-trait",
++]
++
[[package]]
name = "async-lock"
version = "3.4.0"
@@@ -351,6 -296,6 +583,31 @@@ dependencies =
"pin-project-lite",
]
++[[package]]
++name = "async-openai"
++version = "0.19.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "fbc0b1877fb1bc415caa14d1899f0f477e8eb38f2fe16f54be196d7c4a92e15c"
++dependencies = [
++ "async-convert",
++ "backoff",
++ "base64 0.21.5",
++ "bytes",
++ "derive_builder",
++ "futures",
++ "rand 0.8.5",
++ "reqwest 0.11.27",
++ "reqwest-eventsource",
++ "secrecy",
++ "serde",
++ "serde_json",
++ "thiserror 1.0.64",
++ "tokio",
++ "tokio-stream",
++ "tokio-util",
++ "tracing",
++]
++
[[package]]
name = "async-recursion"
version = "1.1.1"
@@@ -458,7 -403,7 +715,7 @@@ dependencies =
"rustversion",
"serde",
"sync_wrapper 0.1.2",
-- "tower",
++ "tower 0.4.13",
"tower-layer",
"tower-service",
]
@@@ -480,6 -425,6 +737,20 @@@ dependencies =
"tower-service",
]
++[[package]]
++name = "backoff"
++version = "0.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"
++dependencies = [
++ "futures-core",
++ "getrandom 0.2.10",
++ "instant",
++ "pin-project-lite",
++ "rand 0.8.5",
++ "tokio",
++]
++
[[package]]
name = "backtrace"
version = "0.3.69"
@@@ -703,6 -648,6 +974,15 @@@ dependencies =
"serde",
]
++[[package]]
++name = "bytestring"
++version = "1.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e465647ae23b2823b0753f50decb2d5a86d2bb2cac04788fafd1f80e45378e5f"
++dependencies = [
++ "bytes",
++]
++
[[package]]
name = "bzip2"
version = "0.4.4"
@@@ -920,7 -819,7 +1154,7 @@@ dependencies =
"pin-project",
"prost 0.13.3",
"rayon",
-- "reqwest 0.12.9",
++ "reqwest 0.12.15",
"scraper 0.17.1",
"semver",
"serde",
@@@ -931,7 -830,7 +1165,7 @@@
"tokio",
"tokio-retry",
"tokio-stream",
-- "tokio-tungstenite",
++ "tokio-tungstenite 0.20.1",
"tokio-util",
"tracing",
"url",
@@@ -966,7 -865,7 +1200,7 @@@ dependencies =
"percent-encoding",
"thiserror 1.0.64",
"tokio",
-- "tokio-tungstenite",
++ "tokio-tungstenite 0.20.1",
"wasm-bindgen",
"web-sys",
]
@@@ -1245,7 -1144,7 +1479,7 @@@ dependencies =
"protoc-bin-vendored",
"serde",
"serde_repr",
-- "tokio-tungstenite",
++ "tokio-tungstenite 0.20.1",
"yrs",
]
@@@ -1361,6 -1254,6 +1589,23 @@@ version = "0.3.0
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2"
++[[package]]
++name = "convert_case"
++version = "0.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
++
++[[package]]
++name = "cookie"
++version = "0.16.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb"
++dependencies = [
++ "percent-encoding",
++ "time",
++ "version_check",
++]
++
[[package]]
name = "cookie"
version = "0.18.1"
@@@ -1378,7 -1271,7 +1623,7 @@@ version = "0.21.1
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9"
dependencies = [
-- "cookie",
++ "cookie 0.18.1",
"document-features",
"idna 1.0.3",
"log",
@@@ -1549,14 -1442,14 +1794,38 @@@ dependencies =
"cipher",
]
++[[package]]
++name = "darling"
++version = "0.14.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
++dependencies = [
++ "darling_core 0.14.4",
++ "darling_macro 0.14.4",
++]
++
[[package]]
name = "darling"
version = "0.20.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391"
dependencies = [
-- "darling_core",
-- "darling_macro",
++ "darling_core 0.20.8",
++ "darling_macro 0.20.8",
++]
++
++[[package]]
++name = "darling_core"
++version = "0.14.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
++dependencies = [
++ "fnv",
++ "ident_case",
++ "proc-macro2",
++ "quote",
++ "strsim 0.10.0",
++ "syn 1.0.109",
]
[[package]]
@@@ -1573,13 -1466,13 +1842,24 @@@ dependencies =
"syn 2.0.94",
]
++[[package]]
++name = "darling_macro"
++version = "0.14.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
++dependencies = [
++ "darling_core 0.14.4",
++ "quote",
++ "syn 1.0.109",
++]
++
[[package]]
name = "darling_macro"
version = "0.20.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f"
dependencies = [
-- "darling_core",
++ "darling_core 0.20.8",
"quote",
"syn 2.0.94",
]
@@@ -1730,14 -1623,14 +2010,47 @@@ dependencies =
"syn 2.0.94",
]
++[[package]]
++name = "derive_builder"
++version = "0.12.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
++dependencies = [
++ "derive_builder_macro",
++]
++
++[[package]]
++name = "derive_builder_core"
++version = "0.12.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
++dependencies = [
++ "darling 0.14.4",
++ "proc-macro2",
++ "quote",
++ "syn 1.0.109",
++]
++
++[[package]]
++name = "derive_builder_macro"
++version = "0.12.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
++dependencies = [
++ "derive_builder_core",
++ "syn 1.0.109",
++]
++
[[package]]
name = "derive_more"
version = "0.99.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [
++ "convert_case",
"proc-macro2",
"quote",
++ "rustc_version",
"syn 1.0.109",
]
@@@ -2003,6 -1896,6 +2316,17 @@@ dependencies =
"pin-project-lite",
]
++[[package]]
++name = "eventsource-stream"
++version = "0.2.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "74fef4569247a5f429d9156b9d0a2599914385dd189c539334c625d8099d90ab"
++dependencies = [
++ "futures-core",
++ "nom",
++ "pin-project-lite",
++]
++
[[package]]
name = "faccess"
version = "0.2.4"
@@@ -2148,7 -2041,6 +2472,7 @@@ dependencies =
"lib-dispatch",
"lib-infra",
"log",
- "mcpr",
++ "mcp_daemon",
"md5",
"notify",
"pin-project",
@@@ -2931,8 -2823,8 +3255,14 @@@ checksum = "e575fab7d1e0dcb8d0c7bcf9a63
name = "futures-task"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
+ checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
+
++[[package]]
++name = "futures-timer"
++version = "3.0.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
+
[[package]]
name = "futures-util"
version = "0.3.31"
@@@ -3094,7 -2986,7 +3424,7 @@@ dependencies =
"getrandom 0.2.10",
"gotrue-entity",
"infra",
-- "reqwest 0.12.9",
++ "reqwest 0.12.15",
"serde",
"serde_json",
"tracing",
@@@ -3683,6 -3569,6 +4007,12 @@@ dependencies =
"winapi-util",
]
++[[package]]
++name = "impl-more"
++version = "0.1.9"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e8a5a9a0ff0086c7a148acb942baaabeadf9504d10400b5a05645853729b9cd2"
++
[[package]]
name = "indexed_db_futures"
version = "0.4.2"
@@@ -3730,7 -3616,7 +4060,7 @@@ dependencies =
"bytes",
"futures",
"pin-project",
-- "reqwest 0.12.9",
++ "reqwest 0.12.15",
"serde",
"serde_json",
"tokio",
@@@ -3837,10 -3717,10 +4161,11 @@@ dependencies =
[[package]]
name = "js-sys"
--version = "0.3.67"
++version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1"
++checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
++ "once_cell",
"wasm-bindgen",
]
@@@ -3878,6 -3758,6 +4203,12 @@@ dependencies =
"libc",
]
++[[package]]
++name = "language-tags"
++version = "0.3.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388"
++
[[package]]
name = "lazy_static"
version = "1.4.0"
@@@ -4046,6 -3926,6 +4377,23 @@@ version = "0.4.1
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
++[[package]]
++name = "local-channel"
++version = "0.1.5"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8"
++dependencies = [
++ "futures-core",
++ "futures-sink",
++ "local-waker",
++]
++
++[[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.10"
@@@ -4209,25 -4089,6 +4557,40 @@@ version = "0.7.2
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef"
+[[package]]
- name = "mcpr"
- version = "0.2.3"
++name = "mcp_daemon"
++version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "9a434a4b9dfa1c5dcef97ee84fdf4c600bab479df9a24259b9e5474e26f6cd47"
++checksum = "ed0bdbb83765c69f4bf506d318119a25776dbad54906de9c17c1eae566088100"
+dependencies = [
++ "actix-cors",
++ "actix-web",
++ "actix-web-lab",
++ "actix-ws",
+ "anyhow",
- "clap",
- "log",
- "rand 0.8.5",
- "reqwest 0.12.9",
++ "async-openai",
++ "async-trait",
++ "bytes",
++ "bytestring",
++ "futures",
++ "futures-core",
++ "futures-util",
++ "jsonwebtoken",
++ "pin-project-lite",
++ "reqwest 0.12.15",
++ "rustls 0.20.9",
++ "rustls-pemfile 1.0.3",
+ "serde",
+ "serde_json",
+ "thiserror 1.0.64",
- "tiny_http",
- "tungstenite",
++ "tokio",
++ "tokio-stream",
++ "tokio-tungstenite 0.21.0",
++ "tracing",
+ "url",
++ "uuid",
+]
+
[[package]]
name = "md-5"
version = "0.10.5"
@@@ -4253,6 -4114,6 +4616,12 @@@ dependencies =
"log",
]
++[[package]]
++name = "mediatype"
++version = "0.19.20"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "33746aadcb41349ec291e7f2f0a3aa6834d1d7c58066fb4b01f68efc4c4b7631"
++
[[package]]
name = "memchr"
version = "2.7.4"
@@@ -4341,6 -4202,6 +4710,18 @@@ dependencies =
"windows-sys 0.48.0",
]
++[[package]]
++name = "mio"
++version = "1.0.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
++dependencies = [
++ "libc",
++ "log",
++ "wasi 0.11.0+wasi-snapshot-preview1",
++ "windows-sys 0.52.0",
++]
++
[[package]]
name = "moka"
version = "0.12.8"
@@@ -4434,7 -4295,7 +4815,7 @@@ dependencies =
"kqueue",
"libc",
"log",
-- "mio",
++ "mio 0.8.9",
"walkdir",
"windows-sys 0.48.0",
]
@@@ -5655,6 -5516,6 +6036,12 @@@ dependencies =
"regex-syntax 0.8.4",
]
++[[package]]
++name = "regex-lite"
++version = "0.1.6"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a"
++
[[package]]
name = "regex-syntax"
version = "0.6.29"
@@@ -5718,6 -5579,6 +6105,7 @@@ dependencies =
"percent-encoding",
"pin-project-lite",
"rustls 0.21.7",
++ "rustls-native-certs",
"rustls-pemfile 1.0.3",
"serde",
"serde_json",
@@@ -5740,16 -5601,15 +6128,15 @@@
[[package]]
name = "reqwest"
--version = "0.12.9"
++version = "0.12.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f"
++checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb"
dependencies = [
"base64 0.22.1",
"bytes",
-- "cookie",
++ "cookie 0.18.1",
"cookie_store",
"encoding_rs",
- "futures-channel",
"futures-core",
"futures-util",
"h2 0.4.7",
@@@ -5782,6 -5642,6 +6169,7 @@@
"tokio-native-tls",
"tokio-rustls 0.26.1",
"tokio-util",
++ "tower 0.5.2",
"tower-service",
"url",
"wasm-bindgen",
@@@ -5792,6 -5652,6 +6180,22 @@@
"windows-registry",
]
++[[package]]
++name = "reqwest-eventsource"
++version = "0.4.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "8f03f570355882dd8d15acc3a313841e6e90eddbc76a93c748fd82cc13ba9f51"
++dependencies = [
++ "eventsource-stream",
++ "futures-core",
++ "futures-timer",
++ "mime",
++ "nom",
++ "pin-project-lite",
++ "reqwest 0.11.27",
++ "thiserror 1.0.64",
++]
++
[[package]]
name = "ring"
version = "0.16.20"
@@@ -5935,6 -5795,6 +6339,18 @@@ dependencies =
"windows-sys 0.52.0",
]
++[[package]]
++name = "rustls"
++version = "0.20.9"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99"
++dependencies = [
++ "log",
++ "ring 0.16.20",
++ "sct",
++ "webpki",
++]
++
[[package]]
name = "rustls"
version = "0.21.7"
@@@ -5961,6 -5821,6 +6377,18 @@@ dependencies =
"zeroize",
]
++[[package]]
++name = "rustls-native-certs"
++version = "0.6.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
++dependencies = [
++ "openssl-probe",
++ "rustls-pemfile 1.0.3",
++ "schannel",
++ "security-framework",
++]
++
[[package]]
name = "rustls-pemfile"
version = "1.0.3"
@@@ -6129,6 -5989,6 +6557,16 @@@ version = "4.1.0
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
++[[package]]
++name = "secrecy"
++version = "0.8.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e"
++dependencies = [
++ "serde",
++ "zeroize",
++]
++
[[package]]
name = "security-framework"
version = "2.9.2"
@@@ -6211,6 -6071,6 +6649,19 @@@ dependencies =
"syn 2.0.94",
]
++[[package]]
++name = "serde_html_form"
++version = "0.2.7"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9d2de91cf02bbc07cde38891769ccd5d4f073d22a40683aa4bc7a95781aaa2c4"
++dependencies = [
++ "form_urlencoded",
++ "indexmap 2.1.0",
++ "itoa",
++ "ryu",
++ "serde",
++]
++
[[package]]
name = "serde_json"
version = "1.0.128"
@@@ -6330,7 -6190,7 +6781,7 @@@ dependencies =
"gotrue-entity",
"infra",
"pin-project",
-- "reqwest 0.12.9",
++ "reqwest 0.12.15",
"serde",
"serde_json",
"serde_repr",
@@@ -7066,7 -6914,7 +7505,7 @@@ dependencies =
"backtrace",
"bytes",
"libc",
-- "mio",
++ "mio 0.8.9",
"num_cpus",
"parking_lot 0.12.1",
"pin-project-lite",
@@@ -7145,6 -6993,6 +7584,17 @@@ dependencies =
"tokio",
]
++[[package]]
++name = "tokio-rustls"
++version = "0.23.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
++dependencies = [
++ "rustls 0.20.9",
++ "tokio",
++ "webpki",
++]
++
[[package]]
name = "tokio-rustls"
version = "0.24.1"
@@@ -7188,7 -7036,7 +7638,21 @@@ dependencies =
"native-tls",
"tokio",
"tokio-native-tls",
-- "tungstenite",
++ "tungstenite 0.20.1",
++]
++
++[[package]]
++name = "tokio-tungstenite"
++version = "0.21.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38"
++dependencies = [
++ "futures-util",
++ "log",
++ "native-tls",
++ "tokio",
++ "tokio-native-tls",
++ "tungstenite 0.21.0",
]
[[package]]
@@@ -7283,7 -7131,7 +7747,7 @@@ dependencies =
"prost 0.12.3",
"tokio",
"tokio-stream",
-- "tower",
++ "tower 0.4.13",
"tower-layer",
"tower-service",
"tracing",
@@@ -7309,17 -7157,17 +7773,32 @@@ dependencies =
"tracing",
]
++[[package]]
++name = "tower"
++version = "0.5.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
++dependencies = [
++ "futures-core",
++ "futures-util",
++ "pin-project-lite",
++ "sync_wrapper 1.0.2",
++ "tokio",
++ "tower-layer",
++ "tower-service",
++]
++
[[package]]
name = "tower-layer"
--version = "0.3.2"
++version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
++checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
[[package]]
name = "tower-service"
--version = "0.3.2"
++version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
++checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
@@@ -7505,6 -7353,6 +7984,26 @@@ dependencies =
"utf-8",
]
++[[package]]
++name = "tungstenite"
++version = "0.21.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1"
++dependencies = [
++ "byteorder",
++ "bytes",
++ "data-encoding",
++ "http 1.2.0",
++ "httparse",
++ "log",
++ "native-tls",
++ "rand 0.8.5",
++ "sha1",
++ "thiserror 1.0.64",
++ "url",
++ "utf-8",
++]
++
[[package]]
name = "typenum"
version = "1.16.0"
@@@ -7652,6 -7500,6 +8151,7 @@@ dependencies =
"form_urlencoded",
"idna 0.5.0",
"percent-encoding",
++ "serde",
]
[[package]]
@@@ -7734,7 -7576,7 +8228,7 @@@ version = "0.18.2
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df0bcf92720c40105ac4b2dda2a4ea3aa717d4d6a862cc217da653a4bd5c6b10"
dependencies = [
-- "darling",
++ "darling 0.20.8",
"once_cell",
"proc-macro-error",
"proc-macro2",
@@@ -7748,7 -7590,7 +8242,7 @@@ version = "0.19.0
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bac855a2ce6f843beb229757e6e570a42e837bcb15e5f449dd48d5747d41bf77"
dependencies = [
-- "darling",
++ "darling 0.20.8",
"once_cell",
"proc-macro-error2",
"proc-macro2",
@@@ -7807,23 -7649,23 +8301,24 @@@ checksum = "9c8d87e72b64a3b4db28d11ce29
[[package]]
name = "wasm-bindgen"
--version = "0.2.90"
++version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406"
++checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
++ "once_cell",
++ "rustversion",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
--version = "0.2.90"
++version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd"
++checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
-- "once_cell",
"proc-macro2",
"quote",
"syn 2.0.94",
@@@ -7844,9 -7686,9 +8339,9 @@@ dependencies =
[[package]]
name = "wasm-bindgen-macro"
--version = "0.2.90"
++version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999"
++checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@@ -7854,9 -7696,9 +8349,9 @@@
[[package]]
name = "wasm-bindgen-macro-support"
--version = "0.2.90"
++version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7"
++checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
@@@ -7867,9 -7709,9 +8362,12 @@@
[[package]]
name = "wasm-bindgen-shared"
--version = "0.2.90"
++version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
++checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
++dependencies = [
++ "unicode-ident",
++]
[[package]]
name = "wasm-streams"
@@@ -7919,6 -7761,6 +8417,25 @@@ dependencies =
"wasm-bindgen",
]
++[[package]]
++name = "webpki"
++version = "0.22.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53"
++dependencies = [
++ "ring 0.17.8",
++ "untrusted 0.9.0",
++]
++
++[[package]]
++name = "webpki-roots"
++version = "0.22.6"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"
++dependencies = [
++ "webpki",
++]
++
[[package]]
name = "webpki-roots"
version = "0.25.2"
@@@ -8015,34 -7857,34 +8532,39 @@@ dependencies =
"windows-targets 0.52.6",
]
++[[package]]
++name = "windows-link"
++version = "0.1.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
++
[[package]]
name = "windows-registry"
--version = "0.2.0"
++version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
++checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3"
dependencies = [
"windows-result",
"windows-strings",
-- "windows-targets 0.52.6",
++ "windows-targets 0.53.0",
]
[[package]]
name = "windows-result"
--version = "0.2.0"
++version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
++checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
-- "windows-targets 0.52.6",
++ "windows-link",
]
[[package]]
name = "windows-strings"
--version = "0.1.0"
++version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
--checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
++checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
dependencies = [
-- "windows-result",
-- "windows-targets 0.52.6",
++ "windows-link",
]
[[package]]
@@@ -8096,13 -7938,13 +8618,29 @@@ dependencies =
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
-- "windows_i686_gnullvm",
++ "windows_i686_gnullvm 0.52.6",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
++[[package]]
++name = "windows-targets"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b"
++dependencies = [
++ "windows_aarch64_gnullvm 0.53.0",
++ "windows_aarch64_msvc 0.53.0",
++ "windows_i686_gnu 0.53.0",
++ "windows_i686_gnullvm 0.53.0",
++ "windows_i686_msvc 0.53.0",
++ "windows_x86_64_gnu 0.53.0",
++ "windows_x86_64_gnullvm 0.53.0",
++ "windows_x86_64_msvc 0.53.0",
++]
++
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
@@@ -8115,6 -7957,6 +8653,12 @@@ version = "0.52.6
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
++[[package]]
++name = "windows_aarch64_gnullvm"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
++
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
@@@ -8127,6 -7969,6 +8671,12 @@@ version = "0.52.6
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
++[[package]]
++name = "windows_aarch64_msvc"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
++
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
@@@ -8139,12 -7981,12 +8689,24 @@@ version = "0.52.6
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
++[[package]]
++name = "windows_i686_gnu"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
++
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
++[[package]]
++name = "windows_i686_gnullvm"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
++
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
@@@ -8157,6 -7999,6 +8719,12 @@@ version = "0.52.6
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
++[[package]]
++name = "windows_i686_msvc"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
++
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
@@@ -8169,6 -8011,6 +8737,12 @@@ version = "0.52.6
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
++[[package]]
++name = "windows_x86_64_gnu"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
++
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
@@@ -8181,6 -8023,6 +8755,12 @@@ version = "0.52.6
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
++[[package]]
++name = "windows_x86_64_gnullvm"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
++
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
@@@ -8193,6 -8035,6 +8773,12 @@@ version = "0.52.6
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
++[[package]]
++name = "windows_x86_64_msvc"
++version = "0.53.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
++
[[package]]
name = "winnow"
version = "0.5.30"
diff --cc frontend/rust-lib/flowy-ai/Cargo.toml
index 063c86b38e,6564b967e4..2fe8b724c9
--- a/frontend/rust-lib/flowy-ai/Cargo.toml
+++ b/frontend/rust-lib/flowy-ai/Cargo.toml
@@@ -50,7 -50,6 +50,7 @@@ collab-integrate.workspace = tru
[target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies]
notify = "6.1.1"
- mcpr = "0.2.3"
++mcp_daemon = "0.2.1"
[target.'cfg(target_os = "windows")'.dependencies]
winreg = "0.55"
diff --cc frontend/rust-lib/flowy-ai/src/mcp/client.rs
index 0000000000,0000000000..8f03e75c31
new file mode 100644
--- /dev/null
+++ b/frontend/rust-lib/flowy-ai/src/mcp/client.rs
@@@ -1,0 -1,0 +1,45 @@@
++use crate::mcp::util::map_mcp_error;
++use flowy_error::{FlowyError, FlowyResult};
++use mcp_daemon::transport::{ClientStdioTransport, Transport};
++use mcp_daemon::types::Implementation;
++use mcp_daemon::Client;
++
++pub struct MCPServerConfig {
++ server_cmd: String,
++ args: Vec<String>,
++}
++
++impl MCPServerConfig {
++ pub fn is_sse_server(&self) -> bool {
++ self.server_cmd.starts_with("http")
++ }
++}
++
++// https://modelcontextprotocol.io/docs/concepts/tools
++#[derive(Clone)]
++pub struct MCPClient {
++ pub client: Client<ClientStdioTransport>,
++ pub transport: ClientStdioTransport,
++}
++
++impl MCPClient {
++ pub async fn initialize(&self) -> Result<(), FlowyError> {
++ self.transport.open().await.map_err(map_mcp_error)?;
++ self.client.start().await.map_err(map_mcp_error)?;
++
++ let implementation = Implementation {
++ name: "test".to_string(),
++ version: "0.0.1".to_string(),
++ };
++ self
++ .client
++ .initialize(implementation)
++ .map(|err| map_mcp_error)?;
++ Ok(())
++ }
++
++ pub async fn stop(&mut self) -> FlowyResult<()> {
++ self.transport.close().await.map_err(map_mcp_error)?;
++ Ok(())
++ }
++}
diff --cc frontend/rust-lib/flowy-ai/src/mcp/manager.rs
index 0000000000,0000000000..18450f266d
new file mode 100644
--- /dev/null
+++ b/frontend/rust-lib/flowy-ai/src/mcp/manager.rs
@@@ -1,0 -1,0 +1,69 @@@
++use crate::mcp::client::MCPClient;
++use anyhow::Context;
++use dashmap::DashMap;
++use flowy_error::{ErrorCode, FlowyError};
++use mcp_daemon::transport::{
++ ClientHttpTransport, ClientStdioTransport, ServerStdioTransport, Transport, TransportError,
++};
++use mcp_daemon::types::Implementation;
++use mcp_daemon::Client;
++use serde_json::Value;
++use std::io::{BufRead, BufReader};
++use std::process::{Child, Command, Stdio};
++use std::sync::Arc;
++use std::thread;
++use tracing::{debug, info};
++
++pub struct MCPServerConfig {
++ server_cmd: String,
++ args: Vec<String>,
++}
++
++impl MCPServerConfig {
++ pub fn is_sse_server(&self) -> bool {
++ self.server_cmd.starts_with("http")
++ }
++}
++
++pub struct MCPClientManager {
++ stdio_clients: Arc<DashMap<String, MCPClient>>,
++}
++
++impl MCPClientManager {
++ pub fn new() -> MCPClientManager {
++ Self {
++ stdio_clients: Arc::new(DashMap::new()),
++ }
++ }
++
++ pub async fn connect_server(&self, config: MCPServerConfig) -> Result<(), FlowyError> {
++ let client = connect_to_stdio_server(&config.server_cmd, config.args.as_ref()).await?;
++ self.stdio_clients.insert(config.server_cmd, client.clone());
++ client.initialize().await?;
++ Ok(())
++ }
++
++ pub async fn remove_server(&self, config: MCPServerConfig) -> Result<(), FlowyError> {
++ let client = self.stdio_clients.remove(&config.server_cmd);
++ if let Some((_, mut client)) = client {
++ client.stop().await?;
++ }
++ Ok(())
++ }
++}
++
++async fn connect_to_stdio_server(command: &str, args: &[&str]) -> Result<MCPClient, FlowyError> {
++ info!(
++ "Connecting to running server with command: {} {}",
++ command,
++ args.join(" ")
++ );
++
++ let transport = ClientStdioTransport::new(command, args).map_err(map_mcp_error)?;
++ let client = Client::builder(transport.clone()).build();
++ Ok(MCPClient { client, transport })
++}
++
++fn map_mcp_error(err: TransportError) -> FlowyError {
++ FlowyError::new(ErrorCode::MCPError, err.to_string())
++}
diff --cc frontend/rust-lib/flowy-ai/src/mcp/mod.rs
index 62badbf1f9,0000000000..1286a7cf46
mode 100644,000000..100644
--- a/frontend/rust-lib/flowy-ai/src/mcp/mod.rs
+++ b/frontend/rust-lib/flowy-ai/src/mcp/mod.rs
@@@ -1,1 -1,0 +1,3 @@@
- mod client_manager;
++mod client;
++mod manager;
++mod util;
diff --cc frontend/rust-lib/flowy-ai/src/mcp/util.rs
index 0000000000,0000000000..1288e9baa6
new file mode 100644
--- /dev/null
+++ b/frontend/rust-lib/flowy-ai/src/mcp/util.rs
@@@ -1,0 -1,0 +1,6 @@@
++use flowy_error::{ErrorCode, FlowyError};
++use mcp_daemon::transport::TransportError;
++
++pub(crate) fn map_mcp_error(err: TransportError) -> FlowyError {
++ FlowyError::new(ErrorCode::MCPError, err.to_string())
++}