Class: RailsMcpInsight::Server

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

Overview

Sets up the MCP server with all tools registered and starts the stdio transport for AI assistant communication.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Server

Returns a new instance of Server.



11
12
13
14
# File 'lib/rails_mcp_insight/server.rb', line 11

def initialize(config)
  @config = config
  @ast_parser = Analyzers::AstParser.new
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'lib/rails_mcp_insight/server.rb', line 9

def config
  @config
end

Instance Method Details

#startObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rails_mcp_insight/server.rb', line 16

def start
  require "mcp"

  server = MCP::Server.new(
    name: "rails-mcp-insight",
    version: VERSION,
    tools: tool_classes
  )

  transport = MCP::Server::Transports::StdioTransport.new(server)
  transport.open
end