McpServerConfig
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonIgnoreProperties(ignoreUnknown = true) public class McpServerConfig
io/agentscope/harness/agent/tools/McpServerConfig.java:40–216MCP 服务端配置,保存相关配置项。位于 io.agentscope.harness.agent.tools 包。核心成员包括 getConnectionFailureHandler、setConnectionFailureHandler、isDefaultToolsEnabled、setDefaultToolsEnabled、getDisableTools、setDisableTools。
One MCP server entry under mcpServers.<name> in tools.json.
Mirrors the standard MCP client configuration shape so that workspaces can be moved between
AgentScope and other MCP-aware tools with minimal edits. Field semantics map directly onto
io.agentscope.core.tool.mcp.McpClientBuilder.
transport is the discriminator:
-
stdio— uses#command+#args+#env. -
sse— uses#url+#headers+#queryParams. -
http— streamable HTTP, same fields assse.
方法摘要Method Summary
方法详情Method Detail
getConnectionFailureHandler
public java.util.function.Consumer<McpConnectionException> getConnectionFailureHandler()
获取连接失败处理器。
Returns the connection failure handler.
java.util.function.Consumer<McpConnectionException>io/agentscope/harness/agent/tools/McpServerConfig.java:95–98setConnectionFailureHandler
public void setConnectionFailureHandler(java.util.function.Consumer<McpConnectionException> handler)
设置连接失败处理器。
Sets the connection failure handler.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
handler | java.util.function.Consumer<McpConnectionException> | 处理器(类型 `java.util.function.Consumer`)。The handler. |
io/agentscope/harness/agent/tools/McpServerConfig.java:100–103isDefaultToolsEnabled
public boolean isDefaultToolsEnabled()
判断是否默认工具已启用。
Returns whether the default tools enabled.
booleanio/agentscope/harness/agent/tools/McpServerConfig.java:105–107setDefaultToolsEnabled
public void setDefaultToolsEnabled(boolean value)
设置默认工具已启用。
Sets the default tools enabled.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | boolean | 值(类型 `boolean`)。The value. |
io/agentscope/harness/agent/tools/McpServerConfig.java:109–111getDisableTools
public List<String> getDisableTools()
获取禁用工具。
Returns the disable tools.
List<String>io/agentscope/harness/agent/tools/McpServerConfig.java:113–115setDisableTools
public void setDisableTools(List<String> value)
设置禁用工具。
Sets the disable tools.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | List<String> | 值(类型 `List`)。The value. |
io/agentscope/harness/agent/tools/McpServerConfig.java:117–119isPrefixToolNames
public boolean isPrefixToolNames()
判断是否 isPrefixToolNames。
Returns whether the prefix tool names.
booleanio/agentscope/harness/agent/tools/McpServerConfig.java:121–123setPrefixToolNames
public void setPrefixToolNames(boolean value)
设置 setPrefixToolNames。
Sets the prefix tool names.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | boolean | 值(类型 `boolean`)。The value. |
io/agentscope/harness/agent/tools/McpServerConfig.java:125–127isRequired
public boolean isRequired()
判断是否必填。
Returns whether the required.
booleanio/agentscope/harness/agent/tools/McpServerConfig.java:129–131setRequired
public void setRequired(boolean value)
设置必填。
Sets the required.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | boolean | 值(类型 `boolean`)。The value. |
io/agentscope/harness/agent/tools/McpServerConfig.java:133–135getTransport
public String getTransport()
获取传输层。
Returns the transport.
Stringio/agentscope/harness/agent/tools/McpServerConfig.java:137–139setTransport
public void setTransport(String transport)
设置传输层。
Sets the transport.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
transport | String | 传输层(类型 `String`)。The transport. |
io/agentscope/harness/agent/tools/McpServerConfig.java:141–143getCommand
public String getCommand()
获取命令。
Returns the command.
Stringio/agentscope/harness/agent/tools/McpServerConfig.java:145–147setCommand
public void setCommand(String command)
设置命令。
Sets the command.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
command | String | 命令(类型 `String`)。The command. |
io/agentscope/harness/agent/tools/McpServerConfig.java:149–151getArgs
public List<String> getArgs()
获取参数。
Returns the args.
List<String>io/agentscope/harness/agent/tools/McpServerConfig.java:153–155setArgs
public void setArgs(List<String> args)
设置参数。
Sets the args.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
args | List<String> | 参数(类型 `List`)。The args. |
io/agentscope/harness/agent/tools/McpServerConfig.java:157–159getEnv
public Map<String, String> getEnv()
获取 getEnv。
Returns the env.
Map<String, String>io/agentscope/harness/agent/tools/McpServerConfig.java:161–163setEnv
public void setEnv(Map<String, String> env)
设置 setEnv。
Sets the env.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
env | Map<String, String> | env(类型 `Map`)。The env. |
io/agentscope/harness/agent/tools/McpServerConfig.java:165–167getUrl
public String getUrl()
获取URL。
Returns the url.
Stringio/agentscope/harness/agent/tools/McpServerConfig.java:169–171setUrl
public void setUrl(String url)
设置URL。
Sets the url.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
url | String | 服务地址(类型 `String`)。The url. |
io/agentscope/harness/agent/tools/McpServerConfig.java:173–175getHeaders
public Map<String, String> getHeaders()
获取请求头。
Returns the headers.
Map<String, String>io/agentscope/harness/agent/tools/McpServerConfig.java:177–179setHeaders
public void setHeaders(Map<String, String> headers)
设置请求头。
Sets the headers.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
headers | Map<String, String> | 请求头(类型 `Map`)。The headers. |
io/agentscope/harness/agent/tools/McpServerConfig.java:181–183getQueryParams
public Map<String, String> getQueryParams()
获取查询参数。
Returns the query params.
Map<String, String>io/agentscope/harness/agent/tools/McpServerConfig.java:185–187setQueryParams
public void setQueryParams(Map<String, String> queryParams)
设置查询参数。
Sets the query params.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
queryParams | Map<String, String> | 查询参数(类型 `Map`)。The query params. |
io/agentscope/harness/agent/tools/McpServerConfig.java:189–191getEnableTools
public List<String> getEnableTools()
获取启用工具。
Returns the enable tools.
List<String>io/agentscope/harness/agent/tools/McpServerConfig.java:193–195setEnableTools
public void setEnableTools(List<String> enableTools)
设置启用工具。
Sets the enable tools.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
enableTools | List<String> | 启用工具(类型 `List`)。The enable tools. |
io/agentscope/harness/agent/tools/McpServerConfig.java:197–199getTimeout
public Duration getTimeout()
获取超时。
Returns the timeout.
Durationio/agentscope/harness/agent/tools/McpServerConfig.java:201–203setTimeout
public void setTimeout(Duration timeout)
设置超时。
Sets the timeout.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
timeout | Duration | 超时时间(类型 `Duration`)。The timeout. |
io/agentscope/harness/agent/tools/McpServerConfig.java:205–207getInitializationTimeout
public Duration getInitializationTimeout()
获取 getInitializationTimeout。
Returns the initialization timeout.
Durationio/agentscope/harness/agent/tools/McpServerConfig.java:209–211setInitializationTimeout
public void setInitializationTimeout(Duration initializationTimeout)
设置 setInitializationTimeout。
Sets the initialization timeout.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
initializationTimeout | Duration | initialization 超时(类型 `Duration`)。The initialization timeout. |
io/agentscope/harness/agent/tools/McpServerConfig.java:213–215