Package com.github.copilot.sdk.json
Class McpStdioServerConfig
java.lang.Object
com.github.copilot.sdk.json.McpServerConfig
com.github.copilot.sdk.json.McpStdioServerConfig
Configuration for a local/stdio MCP (Model Context Protocol) server.
Use this to configure an MCP server that is launched as a local subprocess and communicates via standard input/output.
Example Usage
var server = new McpStdioServerConfig().setCommand("npx")
.setArgs(List.of("-y", "@modelcontextprotocol/server-filesystem", "/path")).setTools(List.of("*"));
var config = new SessionConfig().setMcpServers(Map.of("filesystem", server));
- Since:
- 1.3.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetArgs()Gets the arguments to pass to the command.Gets the command to run the MCP server.getEnv()Gets the environment variables to pass to the server.getType()Gets the server type discriminator.Gets the working directory for the server process.Sets the arguments to pass to the command.setCommand(String command) Sets the command to run the MCP server.Sets the environment variables to pass to the server.setTimeout(Integer timeout) Sets an optional timeout in milliseconds for tool calls to this server.Sets the list of tools to include from this server.setWorkingDirectory(String workingDirectory) Sets the working directory for the server process.Methods inherited from class com.github.copilot.sdk.json.McpServerConfig
getTimeout, getTools
-
Constructor Details
-
McpStdioServerConfig
public McpStdioServerConfig()
-
-
Method Details
-
getType
Gets the server type discriminator.- Returns:
- always
"stdio"
-
getCommand
Gets the command to run the MCP server.- Returns:
- the command
-
setCommand
Sets the command to run the MCP server.- Parameters:
command- the command- Returns:
- this config for method chaining
-
getArgs
Gets the arguments to pass to the command.- Returns:
- the arguments list, or
null
-
setArgs
Sets the arguments to pass to the command.- Parameters:
args- the arguments list- Returns:
- this config for method chaining
-
getEnv
Gets the environment variables to pass to the server.- Returns:
- the environment variables map, or
null
-
setEnv
Sets the environment variables to pass to the server.- Parameters:
env- the environment variables map- Returns:
- this config for method chaining
-
getWorkingDirectory
Gets the working directory for the server process.- Returns:
- the working directory path, or
null
-
setWorkingDirectory
Sets the working directory for the server process.- Parameters:
workingDirectory- the working directory path- Returns:
- this config for method chaining
-
setTools
Description copied from class:McpServerConfigSets the list of tools to include from this server.An empty list means none; use
"*"to include all tools.- Overrides:
setToolsin classMcpServerConfig- Parameters:
tools- the list of tool names, ornull- Returns:
- this config for method chaining
-
setTimeout
Description copied from class:McpServerConfigSets an optional timeout in milliseconds for tool calls to this server.- Overrides:
setTimeoutin classMcpServerConfig- Parameters:
timeout- the timeout in milliseconds, ornullfor the default- Returns:
- this config for method chaining
-