Module: Ask::WebFetch::MCP

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

Overview

MCP (Model Context Protocol) server for ask-web-fetch.

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.startObject

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

$ ask-web-fetch-mcp

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

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


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

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

.toolObject

Builds the tool exposed over MCP: Ask::Tools::WebFetch renamed to "ask_web_fetch" to avoid collisions with client-side tools of the same name (ask-web-search-mcp follows the same convention).



14
15
16
17
18
# File 'lib/ask/web_fetch/mcp.rb', line 14

def self.tool
  tool = Ask::Tools::WebFetch.new
  tool.define_singleton_method(:name) { 'ask_web_fetch' }
  tool
end