forked from kent/consciousness
MCP client: spawn external tool servers, dispatch via JSON-RPC
New mcp_client.rs: McpRegistry manages MCP server connections. Spawns child processes, speaks JSON-RPC 2.0 over stdio. Discovers tools via tools/list, dispatches calls via tools/call. dispatch_with_agent falls through to MCP after checking internal tools. McpRegistry lives on Agent (shared across forks). Still needs: config-driven server startup, system prompt integration. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
ec7e11db56
commit
8b5614ba99
4 changed files with 241 additions and 3 deletions
|
|
@ -107,6 +107,8 @@ pub struct Config {
|
|||
pub scoring_response_window: usize,
|
||||
pub api_reasoning: String,
|
||||
pub agent_types: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub mcp_servers: Vec<McpServerConfig>,
|
||||
/// Surface agent timeout in seconds.
|
||||
#[serde(default)]
|
||||
pub surface_timeout_secs: Option<u32>,
|
||||
|
|
@ -164,6 +166,7 @@ impl Default for Config {
|
|||
surface_timeout_secs: None,
|
||||
surface_conversation_bytes: None,
|
||||
surface_hooks: vec![],
|
||||
mcp_servers: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -346,6 +349,16 @@ pub struct AppConfig {
|
|||
pub models: HashMap<String, ModelConfig>,
|
||||
#[serde(default = "default_model_name")]
|
||||
pub default_model: String,
|
||||
#[serde(default)]
|
||||
pub mcp_servers: Vec<McpServerConfig>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct McpServerConfig {
|
||||
pub name: String,
|
||||
pub command: String,
|
||||
#[serde(default)]
|
||||
pub args: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
|
|
@ -436,6 +449,7 @@ impl Default for AppConfig {
|
|||
system_prompt_file: None,
|
||||
models: HashMap::new(),
|
||||
default_model: String::new(),
|
||||
mcp_servers: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue