Module: MailCatcher::Integrations

Extended by:
Integrations
Included in:
Integrations
Defined in:
lib/mail_catcher/integrations.rb,
lib/mail_catcher/integrations/mcp_tools.rb,
lib/mail_catcher/integrations/mcp_server.rb

Overview

Integration manager for optional features like MCP and Claude Plugins

Defined Under Namespace

Modules: MCPTools Classes: MCPServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mcp_serverObject

Returns the value of attribute mcp_server.



11
12
13
# File 'lib/mail_catcher/integrations.rb', line 11

def mcp_server
  @mcp_server
end

Instance Method Details

#available_toolsObject

Get available tools



59
60
61
# File 'lib/mail_catcher/integrations.rb', line 59

def available_tools
  MCPTools.tool_names
end

#initializeObject



13
14
15
# File 'lib/mail_catcher/integrations.rb', line 13

def initialize
  @mcp_server = nil
end

#mcp_running?Boolean

Check if MCP server is running

Returns:

  • (Boolean)


54
55
56
# File 'lib/mail_catcher/integrations.rb', line 54

def mcp_running?
  @mcp_server&.running
end

#start(options = {}) ⇒ Object

Start integrations based on options



18
19
20
21
22
23
24
# File 'lib/mail_catcher/integrations.rb', line 18

def start(options = {})
  $stderr.puts "[Integrations] Starting integrations with options: #{options.inspect}"

  if options[:mcp_enabled]
    start_mcp_server(options)
  end
end

#start_mcp_server(options = {}) ⇒ Object

Start the MCP server



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/mail_catcher/integrations.rb', line 27

def start_mcp_server(options = {})
  $stderr.puts "[Integrations] Starting MCP server"
  @mcp_server = MCPServer.new(options)

  # Run MCP server in a separate thread
  Thread.new do
    begin
      @mcp_server.run
    rescue => e
      $stderr.puts "[Integrations] MCP server error: #{e.message}"
      $stderr.puts e.backtrace
    end
  end

  # Give the server a moment to start
  sleep 0.1
  $stderr.puts "[Integrations] MCP server started"
end

#stopObject

Stop all integrations



47
48
49
50
51
# File 'lib/mail_catcher/integrations.rb', line 47

def stop
  $stderr.puts "[Integrations] Stopping integrations"
  @mcp_server&.stop
  @mcp_server = nil
end