Class McpHttpServerConfig

java.lang.Object
com.github.copilot.rpc.McpServerConfig
com.github.copilot.rpc.McpHttpServerConfig

public final class McpHttpServerConfig extends McpServerConfig
Configuration for a remote HTTP/SSE MCP (Model Context Protocol) server.

Use this to configure an MCP server that communicates over HTTP or Server-Sent Events (SSE).

Example Usage

var server = new McpHttpServerConfig().setUrl("https://mcp.example.com/sse").setTools(List.of("*"));

var config = new SessionConfig().setMcpServers(Map.of("remote-server", server));
Since:
1.3.0
See Also:
  • Constructor Details

    • McpHttpServerConfig

      public McpHttpServerConfig()
  • Method Details

    • getType

      public String getType()
      Gets the server type discriminator.
      Returns:
      always "http"
    • getUrl

      public String getUrl()
      Gets the URL of the remote server.
      Returns:
      the server URL
    • setUrl

      public McpHttpServerConfig setUrl(String url)
      Sets the URL of the remote server.
      Parameters:
      url - the server URL
      Returns:
      this config for method chaining
    • getHeaders

      public Map<String,String> getHeaders()
      Gets the optional HTTP headers to include in requests.
      Returns:
      the headers map, or null
    • setHeaders

      public McpHttpServerConfig setHeaders(Map<String,String> headers)
      Sets optional HTTP headers to include in requests to this server.
      Parameters:
      headers - the headers map
      Returns:
      this config for method chaining
    • getOauthClientId

      public String getOauthClientId()
      Gets the statically configured OAuth client ID.
      Returns:
      the OAuth client ID, or null
    • setOauthClientId

      public McpHttpServerConfig setOauthClientId(String oauthClientId)
      Sets the statically configured OAuth client ID.
      Parameters:
      oauthClientId - the non-empty OAuth client ID
      Returns:
      this config for method chaining
    • getOauthScopes

      public List<String> getOauthScopes()
      Gets the configured OAuth scopes.
      Returns:
      the OAuth scopes, or null
    • setOauthScopes

      public McpHttpServerConfig setOauthScopes(List<String> oauthScopes)
      Sets the OAuth scopes to request when the server challenge omits scope or provides an empty scope.
      Parameters:
      oauthScopes - the non-empty list of RFC 6749 scope-token strings
      Returns:
      this config for method chaining
    • getOauthPublicClient

      public Boolean getOauthPublicClient()
      Gets whether the configured OAuth client is public.
      Returns:
      whether the client is public, or null
    • setOauthPublicClient

      public McpHttpServerConfig setOauthPublicClient(Boolean oauthPublicClient)
      Sets whether the configured OAuth client is public.
      Parameters:
      oauthPublicClient - whether the client is public
      Returns:
      this config for method chaining
    • getOauthGrantType

      public String getOauthGrantType()
      Gets the configured OAuth grant type.
      Returns:
      the OAuth grant type, or null
    • setOauthGrantType

      public McpHttpServerConfig setOauthGrantType(String oauthGrantType)
      Sets the OAuth grant type.
      Parameters:
      oauthGrantType - the OAuth grant type
      Returns:
      this config for method chaining
    • setTools

      public McpHttpServerConfig setTools(List<String> tools)
      Description copied from class: McpServerConfig
      Sets the list of tools to include from this server.

      An empty list means none; use "*" to include all tools.

      Overrides:
      setTools in class McpServerConfig
      Parameters:
      tools - the list of tool names, or null
      Returns:
      this config for method chaining
    • setTimeout

      public McpHttpServerConfig setTimeout(Integer timeout)
      Description copied from class: McpServerConfig
      Sets an optional timeout in milliseconds for tool calls to this server.
      Overrides:
      setTimeout in class McpServerConfig
      Parameters:
      timeout - the timeout in milliseconds, or null for the default
      Returns:
      this config for method chaining