pub struct McpToolConfig {
pub transport_type: McpTransportType,
pub command: Option<String>,
pub args: Vec<String>,
pub env: Option<Vec<(String, String)>>,
pub url: Option<String>,
pub auth_token: Option<String>,
pub name: Option<String>,
}Expand description
Configuration for a single MCP tool source.
Defines how to connect to an MCP server and use its tools.
§Examples
§STDIO Transport (npx package)
[[agents.mcp_tools]]
type = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]§STDIO Transport (Python MCP server)
[[agents.mcp_tools]]
type = "stdio"
command = "python"
args = ["-m", "mcp_server_time"]§HTTP Transport
[[agents.mcp_tools]]
type = "http"
url = "http://localhost:3000/mcp"
auth_token = "${MCP_AUTH_TOKEN}"Fields§
§transport_type: McpTransportTypeTransport type: “stdio” or “http”
command: Option<String>Command to execute (for stdio transport). Examples: “npx”, “python”, “node”, or path to an executable.
args: Vec<String>Arguments for the command (for stdio transport).
env: Option<Vec<(String, String)>>Environment variables for the child process (for stdio transport). Format: [[“KEY”, “VALUE”], [“KEY2”, “VALUE2”]]
url: Option<String>URL for HTTP transport. Example: “http://localhost:3000/mcp”
auth_token: Option<String>Authentication token for HTTP transport (optional). Can use environment variable syntax: “${MCP_AUTH_TOKEN}”
name: Option<String>Optional name for this tool source (for logging/debugging).
Implementations§
Source§impl McpToolConfig
impl McpToolConfig
Sourcepub fn stdio(command: impl Into<String>, args: Vec<String>) -> Self
pub fn stdio(command: impl Into<String>, args: Vec<String>) -> Self
Create a new STDIO transport configuration.
§Arguments
command- Command to execute (e.g., “npx”, “python”)args- Arguments to pass to the command
Sourcepub fn npx(package: impl Into<String>, extra_args: Vec<String>) -> Self
pub fn npx(package: impl Into<String>, extra_args: Vec<String>) -> Self
Create an npx-based MCP tool configuration.
§Arguments
package- NPM package name (e.g., “@modelcontextprotocol/server-filesystem”)extra_args- Additional arguments after the package name
Sourcepub fn with_env(self, env: Vec<(String, String)>) -> Self
pub fn with_env(self, env: Vec<(String, String)>) -> Self
Set environment variables for the process.
Sourcepub fn with_auth_token(self, token: impl Into<String>) -> Self
pub fn with_auth_token(self, token: impl Into<String>) -> Self
Set authentication token for HTTP transport.
Trait Implementations§
Source§impl Clone for McpToolConfig
impl Clone for McpToolConfig
Source§fn clone(&self) -> McpToolConfig
fn clone(&self) -> McpToolConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for McpToolConfig
impl Debug for McpToolConfig
Source§impl Default for McpToolConfig
impl Default for McpToolConfig
Source§fn default() -> McpToolConfig
fn default() -> McpToolConfig
Source§impl<'de> Deserialize<'de> for McpToolConfig
impl<'de> Deserialize<'de> for McpToolConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for McpToolConfig
impl RefUnwindSafe for McpToolConfig
impl Send for McpToolConfig
impl Sync for McpToolConfig
impl Unpin for McpToolConfig
impl UnwindSafe for McpToolConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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