serveStdio function

ApolloMcpServer serveStdio({
  1. McpLimits limits = const McpLimits(),
  2. Stream<List<int>>? input,
  3. StreamSink<List<int>>? output,
  4. RepositoryAdapter? repository,
  5. RepoConfig repoConfig = const RepoConfig(),
})

Starts an ApolloMcpServer over stdio (the standard local MCP transport), reading newline-delimited JSON-RPC from input and writing to output (defaulting to this process's stdin/stdout).

Pass a repository (with an optional repoConfig) to additionally expose the workspace/repository tools over this transport.

Returns the running server; await its done to know when the peer closes.

Implementation

ApolloMcpServer serveStdio({
  McpLimits limits = const McpLimits(),
  Stream<List<int>>? input,
  StreamSink<List<int>>? output,
  RepositoryAdapter? repository,
  RepoConfig repoConfig = const RepoConfig(),
}) {
  final channel = stdioChannel(input: input ?? stdin, output: output ?? stdout);
  return ApolloMcpServer(
    channel,
    limits: limits,
    repository: repository,
    repoConfig: repoConfig,
  );
}