Class: BundlerMCP::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler_mcp/server.rb

Overview

Main server class for BundlerMCP

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger: Logger.new(File::NULL)) ⇒ void

Initialize the server



25
26
27
28
29
30
31
32
# File 'lib/bundler_mcp/server.rb', line 25

def initialize(logger: Logger.new(File::NULL))
  @logger = logger

  @server = FastMcp::Server.new(
    name: "bundler-gem-documentation",
    version: VERSION
  )
end

Class Method Details

.run(**args) ⇒ void

This method returns an undefined value.

Convenience method to start the server



19
20
21
# File 'lib/bundler_mcp/server.rb', line 19

def self.run(**args)
  new(**args).run
end

Instance Method Details

#runvoid

This method returns an undefined value.

Start the MCP server



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/bundler_mcp/server.rb', line 36

def run
  gemfile_path = EnvironmentChecker.check!
  logger.info "Starting BundlerMCP server with Gemfile: #{gemfile_path}"

  ToolCollection.each do |tool|
    server.register_tool(tool)
  end

  server.start
rescue StandardError => e
  logger.error e.message
  raise e
end