Class: TypeGuessr::MCP::Server
- Inherits:
-
Object
- Object
- TypeGuessr::MCP::Server
- Defined in:
- lib/type_guessr/mcp/server.rb
Overview
MCP server that exposes type-guessr’s inference engine as tools. Indexes the target project on startup and serves type queries via stdio transport.
Usage:
server = TypeGuessr::MCP::Server.new(project_path: "/path/to/project")
server.start
Instance Attribute Summary collapse
-
#runtime ⇒ StandaloneRuntime
readonly
The runtime used for inference (available after #start).
Instance Method Summary collapse
-
#initialize(project_path:) ⇒ Server
constructor
A new instance of Server.
-
#start ⇒ Object
Build index and start the MCP server (blocks on stdio transport).
Constructor Details
#initialize(project_path:) ⇒ Server
Returns a new instance of Server.
33 34 35 36 |
# File 'lib/type_guessr/mcp/server.rb', line 33 def initialize(project_path:) @project_path = File.(project_path) @runtime = nil end |
Instance Attribute Details
#runtime ⇒ StandaloneRuntime (readonly)
Returns The runtime used for inference (available after #start).
30 31 32 |
# File 'lib/type_guessr/mcp/server.rb', line 30 def runtime @runtime end |
Instance Method Details
#start ⇒ Object
Build index and start the MCP server (blocks on stdio transport)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/type_guessr/mcp/server.rb', line 39 def start warn "[type-guessr] Initializing for project: #{@project_path}" index = build_ruby_index @runtime = build_runtime(index) index_project_files start_file_watcher server = ::MCP::Server.new( name: "type-guessr", version: TypeGuessr::VERSION, tools: build_tools ) warn "[type-guessr] Server ready" transport = ::MCP::Server::Transports::StdioTransport.new(server) transport.open end |