Class: RailsMarkup::Server

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

Overview

Main entry point — starts HTTP server and optionally MCP server. HTTP and MCP share the same Store instance so annotations flow both ways. If the HTTP port is already taken, MCP proxies to the existing server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(port: 4747, mcp_only: false) ⇒ Server

Returns a new instance of Server.



12
13
14
15
16
# File 'lib/rails_markup/server.rb', line 12

def initialize(port: 4747, mcp_only: false)
  @port     = port
  @mcp_only = mcp_only
  @store    = Store.new
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



10
11
12
# File 'lib/rails_markup/server.rb', line 10

def store
  @store
end

Instance Method Details

#startObject



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

def start
  if @mcp_only
    start_mcp_only
  else
    start_http_and_mcp
  end
end