Server constructor

Server({
  1. required String name,
  2. required String version,
  3. String? description,
  4. String? title,
  5. String? websiteUrl,
  6. List<McpIcon>? icons,
  7. String? instructions,
  8. ServerCapabilities capabilities = const ServerCapabilities(),
  9. int? pageSize,
  10. bool serverInfoInResults = true,
  11. Duration cacheTtl = Duration.zero,
  12. bool publicLists = false,
  13. Duration progressMinInterval = const Duration(milliseconds: 50),
  14. McpTaskStore? taskStore,
})

Creates a new MCP server with the specified parameters

Implementation

Server({
  required this.name,
  required this.version,
  this.description,
  this.title,
  this.websiteUrl,
  this.icons,
  this.instructions,
  this.capabilities = const ServerCapabilities(),
  this.pageSize,
  this.serverInfoInResults = true,
  this.cacheTtl = Duration.zero,
  this.publicLists = false,
  this.progressMinInterval = const Duration(milliseconds: 50),
  McpTaskStore? taskStore,
}) : taskStore = taskStore ?? McpTaskStore(),
     assert(pageSize == null || pageSize > 0),
     assert(!cacheTtl.isNegative) {
  _taskChanges = this.taskStore.changes.listen(_onTaskChange);
  _metricsCollector = MetricsCollector();
  _standardMetrics = StandardMetrics(_metricsCollector);

  // Initialize resource counters
  _updateResourceMetrics();
}