-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMcpServerConfig.java
More file actions
88 lines (78 loc) · 2.96 KB
/
McpServerConfig.java
File metadata and controls
88 lines (78 loc) · 2.96 KB
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
80
81
82
83
84
85
86
87
88
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/
package com.github.copilot.sdk.json;
import java.util.Collections;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
/**
* Abstract base class for MCP (Model Context Protocol) server configurations.
* <p>
* Use one of the concrete subclasses to configure MCP servers:
* <ul>
* <li>{@link McpStdioServerConfig} — for local/stdio-based MCP servers</li>
* <li>{@link McpHttpServerConfig} — for remote HTTP/SSE-based MCP servers</li>
* </ul>
*
* @see McpStdioServerConfig
* @see McpHttpServerConfig
* @see SessionConfig#setMcpServers(java.util.Map)
* @since 1.3.0
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = McpStdioServerConfig.class)
@JsonSubTypes({@JsonSubTypes.Type(value = McpStdioServerConfig.class, name = "stdio"),
@JsonSubTypes.Type(value = McpStdioServerConfig.class, name = "local"),
@JsonSubTypes.Type(value = McpHttpServerConfig.class, name = "http"),
@JsonSubTypes.Type(value = McpHttpServerConfig.class, name = "sse")})
public abstract class McpServerConfig {
@JsonProperty("tools")
private List<String> tools;
@JsonProperty("timeout")
private Integer timeout;
/**
* Gets the list of tools to include from this server.
* <p>
* An empty list means none; use {@code "*"} to include all tools.
*
* @return the list of tool names, or {@code null} if not set
*/
public List<String> getTools() {
return tools == null ? null : Collections.unmodifiableList(tools);
}
/**
* Sets the list of tools to include from this server.
* <p>
* An empty list means none; use {@code "*"} to include all tools.
*
* @param tools
* the list of tool names, or {@code null}
* @return this config for method chaining
*/
public McpServerConfig setTools(List<String> tools) {
this.tools = tools;
return this;
}
/**
* Gets the optional timeout in milliseconds for tool calls to this server.
*
* @return the timeout in milliseconds, or {@code null} for the default
*/
public Integer getTimeout() {
return timeout;
}
/**
* Sets an optional timeout in milliseconds for tool calls to this server.
*
* @param timeout
* the timeout in milliseconds, or {@code null} for the default
* @return this config for method chaining
*/
public McpServerConfig setTimeout(Integer timeout) {
this.timeout = timeout;
return this;
}
}