Module: Rubydex::MCPServer

Defined in:
lib/rubydex/mcp_server.rb,
lib/rubydex/mcp_server/protocol.rb,
lib/rubydex/mcp_server/tools/base_tool.rb,
lib/rubydex/mcp_server/tools/codebase_stats_tool.rb,
lib/rubydex/mcp_server/tools/get_declaration_tool.rb,
lib/rubydex/mcp_server/tools/get_descendants_tool.rb,
lib/rubydex/mcp_server/tools/search_declarations_tool.rb,
lib/rubydex/mcp_server/tools/get_file_declarations_tool.rb,
lib/rubydex/mcp_server/tools/find_constant_references_tool.rb

Defined Under Namespace

Modules: JSONRPC Classes: BaseTool, CodebaseStatsTool, Error, FindConstantReferencesTool, GetDeclarationTool, GetDescendantsTool, GetFileDeclarationsTool, SearchDeclarationsTool, Server, StdioTransport, Tool

Constant Summary collapse

SERVER_INSTRUCTIONS =
<<~TEXT
  Rubydex provides semantic Ruby code intelligence.

  Use these tools for Ruby source files (.rb, .rbi, .rbs) when you need structural information about declarations, locations, hierarchy, references, or codebase composition.

  Use text search instead for literal strings, comments, log messages, non-Ruby files, or content search rather than structural queries.

  Fully qualified name format: "Foo::Bar" for classes/modules/constants, "Foo::Bar#method_name" for instance methods.

  Pagination: tools that may return a high number of results include `total` for pagination. When `total` exceeds the number of returned items, use `offset` to fetch the next page.
TEXT

Class Method Summary collapse

Class Method Details

.run(path = ".") ⇒ Object

Signature:

  • (?String) -> void



209
210
211
212
213
214
215
# File 'lib/rubydex/mcp_server.rb', line 209

def run(path = ".")
  root = File.realpath(path)
  server = Server.new(root_path: root, transport: StdioTransport.new)
  server.spawn_indexer

  server.main_loop
end