1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright 2026 Mahmoud Harmouch.
//
// Licensed under the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/// Registers a single MCP server on an agent.
///
/// # Usage
///
/// ```rust
/// use autogpt::mcp_server;
/// use autogpt::agents::agent::AgentGPT;
/// use autogpt::cli::settings::{McpServerConfig, McpTransport};
/// use std::collections::HashMap;
///
/// let mut agent = AgentGPT::new_borrowed("Dev", "Write code");
/// mcp_server!(agent, McpServerConfig {
/// name: "github".to_string(), transport: McpTransport::Stdio,
/// command: Some("docker".to_string()),
/// args: vec!["run".into(), "-i".into(), "ghcr.io/github/github-mcp-server".into()],
/// url: None, http_url: None, headers: Default::default(), env: Default::default(),
/// cwd: None, timeout_ms: 500_000, trust: false,
/// include_tools: vec![], exclude_tools: vec![],
/// description: Some("GitHub tools".to_string()), oauth: None,
/// });
/// ```
/// Registers multiple MCP servers on an agent at once.
///
/// # Usage
///
/// ```rust
/// use autogpt::with_mcp_servers;
/// use autogpt::agents::agent::AgentGPT;
/// use autogpt::cli::settings::{McpServerConfig, McpTransport};
/// use std::collections::HashMap;
///
/// let mut agent = AgentGPT::new_borrowed("Dev", "Write code");
/// with_mcp_servers!(agent, [
/// McpServerConfig {
/// name: "github".to_string(), transport: McpTransport::Stdio,
/// command: Some("docker".to_string()),
/// args: vec!["run".into()], url: None, http_url: None,
/// headers: Default::default(), env: Default::default(),
/// cwd: None, timeout_ms: 500_000, trust: false,
/// include_tools: vec![], exclude_tools: vec![],
/// description: None, oauth: None,
/// },
/// ]);
/// ```