Expand description
MCP Common - Shared types and utilities for MCP proxy modules
This crate provides common functionality shared across mcp-sse-proxy and mcp-streamable-proxy to avoid code duplication.
§Feature Flags
telemetry: 基础 OpenTelemetry 支持otlp: OTLP exporter 支持(用于 Jaeger 等)
§国际化 (i18n)
本 crate 提供多语言支持,使用 rust-i18n 实现。
§使用方法
use mcp_common::{t, set_locale, init_locale_from_env};
// 初始化语言设置(程序启动时调用)
init_locale_from_env();
// 获取翻译
let msg = t!("errors.mcp_proxy.service_not_found", service = "my-service");Re-exports§
pub use backend_bridge::BackendBridge;pub use client_config::McpClientConfig;pub use config::McpServiceConfig;pub use process_compat::check_windows_command;pub use process_compat::ensure_runtime_path;pub use process_compat::resolve_windows_command;pub use process_compat::spawn_stderr_reader;pub use tool_filter::ToolFilter;pub use i18n::AVAILABLE_LOCALES;pub use i18n::DEFAULT_LOCALE;pub use i18n::current_locale;pub use i18n::init_locale_from_env;pub use i18n::set_locale;
Modules§
- backend_
bridge - Backend Bridge trait for cross-protocol MCP proxy
- client_
config - Client connection configuration for MCP services
- config
- MCP 服务配置
- diagnostic
- 子进程启动诊断工具
- i18n
- 国际化模块
- mirror
- 镜像源配置:通过进程级环境变量为 npx/uvx 子进程设置国内镜像源
- process_
compat - 跨平台进程管理兼容层
- tool_
filter - 工具过滤器
Macros§
- t
- 导出 t! 宏,用于获取翻译 Get I18n text
- wrap_
process_ v8 - 为 process-wrap 8.x 的 TokioCommandWrap 应用平台特定的包装
- wrap_
process_ v9 - 为 process-wrap 9.x 的 CommandWrap 应用平台特定的包装