Class McpStdioServer

java.lang.Object
com.github.thought2code.mcp.annotated.server.McpServerBase
com.github.thought2code.mcp.annotated.server.McpStdioServer
All Implemented Interfaces:
McpServer

public class McpStdioServer extends McpServerBase
MCP server implementation for Standard Input/Output (STDIO) mode.

This class extends McpServerBase and provides an MCP server implementation that uses standard input/output for communication. STDIO mode is the default mode for CLI tools and allows the server to communicate through standard input and output streams.

STDIO mode is suitable for:

  • Command-line interface (CLI) applications
  • Integration with shell scripts and pipelines
  • Simple communication scenarios where HTTP is not required

The server uses the standard input stream for receiving requests and the standard output stream for sending responses, making it easy to integrate with existing command-line tools.

Author:
codeboyzhou
See Also:
  • Constructor Details

    • McpStdioServer

      public McpStdioServer(McpServerConfiguration configuration)
      Constructs a new McpStdioServer with the specified configuration.
      Parameters:
      configuration - the server configuration
  • Method Details

    • createSyncSpecification

      public io.modelcontextprotocol.server.McpServer.SyncSpecification<?> createSyncSpecification()
      Creates and returns a synchronization specification for STDIO mode.

      This method creates an McpServer.SyncSpecification that uses standard input/output transport provider for communication. The transport provider is configured with the default JSON mapper for message serialization and deserialization.

      Returns:
      a synchronization specification configured for STDIO transport
      See Also:
      • StdioServerTransportProvider
      • McpJsonMapper