Module: Ask::WebSearch::MCP

Defined in:
lib/ask/web_search/mcp.rb,
lib/ask/web_search/mcp/version.rb

Constant Summary collapse

VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.startObject

Start the MCP server over stdio, exposing the ask_web_search tool.

$ ask-web-search-mcp

The server will listen for JSON-RPC messages on stdin and write responses to stdout — the standard MCP stdio transport. Register this executable as an MCP server in your client configuration:

"mcp": {
"servers": {
  "ask-web-search-mcp": {
    "type": "stdio",
    "command": "ask-web-search-mcp",
    "args": []
  }
}
}


36
37
38
39
40
41
42
43
44
# File 'lib/ask/web_search/mcp.rb', line 36

def self.start
  Ask::MCP::Server.start_stdio(
    name: "ask-web-search-mcp",
    version: VERSION,
    tools: [tool],
    capabilities: { tools: {} },
    debug: ENV["DEBUG"] == "1"
  )
end

.toolObject

Builds the tool exposed over MCP: Ask::Tools::WebSearch renamed to "ask_web_search" to avoid collisions with client-side tools of the same name.



13
14
15
16
17
# File 'lib/ask/web_search/mcp.rb', line 13

def self.tool
  tool = Ask::Tools::WebSearch.new
  tool.define_singleton_method(:name) { "ask_web_search" }
  tool
end