- df-mcp 加 streamable HTTP transport 层(axum 0.7 + tower,server_http.rs),lib.rs pub mod 接线 - src-tauri 加 mcp.rs(spawn_mcp_http + mcp_get_status IPC + mcp-server CLI)+ tray.rs(系统托盘 show_main/setup_tray),lib.rs 集成 + main.rs mcp-server 参数路由 - AI 工具加 entity_resolve.rs(实体解析,tools/mod.rs pub mod 接线)
21 lines
940 B
Rust
21 lines
940 B
Rust
fn main() {
|
|
tauri_build::build();
|
|
|
|
// 从 tauri.conf.json 读取 identifier,注入编译时常量 MCP_APP_IDENTIFIER。
|
|
// CLI 模式(mcp-server)无 tauri app handle,无法通过 app.path().app_data_dir() 获取
|
|
// 真实路径;此常量让 default_db_path 自动拼出 Tauri 实际使用的 APPDATA/{identifier}/ 路径,
|
|
// 保证 MCP server 与 GUI 应用读写同一数据库,无需手动传 --db。
|
|
let conf_path = std::path::Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap())
|
|
.join("tauri.conf.json");
|
|
if let Ok(content) = std::fs::read_to_string(&conf_path) {
|
|
if let Some(identifier) = content
|
|
.lines()
|
|
.find(|l| l.contains("\"identifier\""))
|
|
.and_then(|l| l.split(':').nth(1))
|
|
.map(|s| s.trim().trim_matches(',').trim_matches('"'))
|
|
{
|
|
println!("cargo:rustc-env=MCP_APP_IDENTIFIER={}", identifier);
|
|
}
|
|
}
|
|
}
|