ApolloMcpServer constructor

ApolloMcpServer(
  1. StreamChannel<String> channel, {
  2. McpLimits limits = const McpLimits(),
  3. RepositoryAdapter? repository,
  4. RepoConfig repoConfig = const RepoConfig(),
})

Implementation

ApolloMcpServer(
  super.channel, {
  this.limits = const McpLimits(),
  RepositoryAdapter? repository,
  RepoConfig repoConfig = const RepoConfig(),
}) : _repo = repository == null
         ? null
         : RepoRuntime(
             repository is PermissionGuard
                 ? repository
                 : PermissionGuard(repository, config: repoConfig),
           ),
     super.fromStreamChannel(
       implementation: Implementation(
         name: 'apollovm-mcp',
         version: ApolloVM.VERSION,
       ),
       instructions:
           'ApolloVM programmable execution engine and code-inspection server. '
           'Core tools parse, execute, translate and compile source; the '
           '`apollovm.lsp.*` tools inspect it like an editor (diagnostics, '
           'outline, hover, definition, references, completion and '
           'workspace-wide symbol search). All of those operate on inline '
           'source strings. When a workspace is configured, the '
           '`apollovm.fs.*` / `apollovm.search.*` / `apollovm.code.*` / '
           '`apollovm.git.*` tools operate on real files in the repository '
           '(read-only unless writes/git-mutation are enabled) — prefer them '
           'over POSIX shell commands. Tools: ${allToolNames.join(', ')}'
           '${repository == null ? '' : ', ${repoToolNames.join(', ')}'}. '
           'No file or network access is granted to executed code.',
     ) {
  for (final tool in buildTools()) {
    registerTool(tool, (request) => _handle(tool.name, request));
  }
  if (_repo != null) {
    for (final tool in buildRepoTools()) {
      registerTool(tool, (request) => _handleRepo(tool.name, request));
    }
  }
}