pub struct McpService;Expand description
MCP 相关业务逻辑(v3.7.0 统一结构)
Implementations§
Source§impl McpService
impl McpService
Sourcepub fn get_all_servers(
state: &AppState,
) -> Result<HashMap<String, McpServer>, AppError>
pub fn get_all_servers( state: &AppState, ) -> Result<HashMap<String, McpServer>, AppError>
获取所有 MCP 服务器(统一结构)
Sourcepub fn upsert_server(
state: &AppState,
server: McpServer,
) -> Result<(), AppError>
pub fn upsert_server( state: &AppState, server: McpServer, ) -> Result<(), AppError>
添加或更新 MCP 服务器
Sourcepub fn toggle_app(
state: &AppState,
server_id: &str,
app: AppType,
enabled: bool,
) -> Result<(), AppError>
pub fn toggle_app( state: &AppState, server_id: &str, app: AppType, enabled: bool, ) -> Result<(), AppError>
切换指定应用的启用状态
Sourcepub fn get_servers(
state: &AppState,
app: AppType,
) -> Result<HashMap<String, Value>, AppError>
👎Deprecated since 3.7.0: Use get_all_servers instead
pub fn get_servers( state: &AppState, app: AppType, ) -> Result<HashMap<String, Value>, AppError>
Use get_all_servers instead
[已废弃] 获取指定应用的 MCP 服务器(兼容旧 API)
Sourcepub fn set_enabled(
state: &AppState,
app: AppType,
id: &str,
enabled: bool,
) -> Result<bool, AppError>
👎Deprecated since 3.7.0: Use toggle_app instead
pub fn set_enabled( state: &AppState, app: AppType, id: &str, enabled: bool, ) -> Result<bool, AppError>
Use toggle_app instead
[已废弃] 设置 MCP 服务器在指定应用的启用状态(兼容旧 API)
Sourcepub fn sync_enabled(state: &AppState, app: AppType) -> Result<(), AppError>
👎Deprecated since 3.7.0: Use sync_all_enabled instead
pub fn sync_enabled(state: &AppState, app: AppType) -> Result<(), AppError>
Use sync_all_enabled instead
[已废弃] 同步启用的 MCP 到指定应用(兼容旧 API)
Sourcepub fn import_from_claude(state: &AppState) -> Result<usize, AppError>
pub fn import_from_claude(state: &AppState) -> Result<usize, AppError>
从 Claude 导入 MCP(v3.7.0 已更新为统一结构)
Sourcepub fn import_from_codex(state: &AppState) -> Result<usize, AppError>
pub fn import_from_codex(state: &AppState) -> Result<usize, AppError>
从 Codex 导入 MCP(v3.7.0 已更新为统一结构)
Auto Trait Implementations§
impl Freeze for McpService
impl RefUnwindSafe for McpService
impl Send for McpService
impl Sync for McpService
impl Unpin for McpService
impl UnsafeUnpin for McpService
impl UnwindSafe for McpService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more