ask-web-search-mcp 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f160f5a8fb458d0709056a11c582668c7635a5eaaaf85d9be6874177eba701ac
4
- data.tar.gz: 846c889c1942698894bb3d5af8b385ee54c775d6b1d355ebe62227cb39a46539
3
+ metadata.gz: ac5646c79697323c0e3468f1ae9f23c75c961d0a39e844abac53c47cf3f1cd15
4
+ data.tar.gz: 8786a020e9ebc20cc94dcf2b7e7c29246351e7ae7aed2ecad369f04108aabab9
5
5
  SHA512:
6
- metadata.gz: badf1176d59f3b255a7fd66b89c5a772c6bcb8fea3b4bb94bf1ce1a1d49f6d031fe8c2cfaf9f135a1f965dcaed758e7fa2222de7168d6d80cf42d5f5731364ea
7
- data.tar.gz: 821fc274ee6ea451359afedacca24bc319a532bf10a6b67b1a458345194a89227d457d255432020eb1feb86e03908d774cc2da3785db84d7ef0eccbc71f2728c
6
+ metadata.gz: 4b0ece49a60e7203c45f9c3c240bcb94e1449ca12f77b94097766ad64b403f1f263e907af7260db7e3fcb293f58a91dae787875a84efa3f573fdef32922d3be5
7
+ data.tar.gz: bc67755832d14e152efcafc2e0a4f8334e4693197c92608acc1770d2c8a845fedf1343a9a133a3c1a5da628c1d06536c6ba7e9fa7f32ad5dd922343477a94abe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.0] - 2026-08-12
4
+
5
+ ### Changed
6
+
7
+ - **The server owns its tool shell.** `ask_web_search` is now a
8
+ duck-typed tool (`Ask::WebSearch::MCP::Tool` — `name` /
9
+ `description` / `params_schema` / `call`) wrapping the library entry
10
+ `Ask::WebSearch.search`, instead of a renamed `Ask::Tools::WebSearch`.
11
+ The MCP adapter's contract is duck-typed by design, so the ask-tools /
12
+ ask-core / ask-schema dependency chain is gone from the server
13
+ process entirely. `ask-web-search` floor raised to `>= 0.3.0` (the
14
+ module-level API). The native agent tool remains available in
15
+ ask-web-search as an optional integration for non-MCP consumers.
16
+
17
+ ## [0.3.1] - 2026-08-04
18
+
19
+ ### Fixed
20
+
21
+ - Corrected publish of the 0.3.0 changeset (0.3.0 was yanked — it shipped a
22
+ stale build missing the `tool` extraction and serverInfo version
23
+ passthrough). 0.3.1 is the same changeset built correctly.
24
+
25
+ ## [0.3.0] - 2026-08-04
26
+
27
+ ### Changed
28
+
29
+ - **Stateless protocol support (2026-07-28)** — the server now negotiates the
30
+ stateless MCP revision via `server/discover` (no `initialize` handshake,
31
+ per-request `_meta`, `resultType`) when the client supports it, while
32
+ remaining backward compatible with legacy `initialize`-handshake clients.
33
+ Requires `ask-mcp >= 0.4` — the 0.4 line also brings server-side
34
+ resources/prompts and the Streamable HTTP rework.
35
+ - Development resolves `ask-mcp` from rubygems via the `>= 0.4` floor — no
36
+ local path overrides; the server always exercises the published protocol
37
+ support.
38
+
39
+ ### Added
40
+
41
+ - Functional test suite (`test/server_test.rb`) driving the server end-to-end
42
+ with `Ask::MCP::Client` over a real stdio subprocess: stateless
43
+ negotiation, tool listing, tool calls against a stubbed SearXNG (in-process
44
+ `FakeSearxng`), no-results handling, unknown-tool errors, and a
45
+ SearXNG-unreachable error path.
46
+ - `Ask::WebSearch::MCP.tool` — extracted, testable accessor for the
47
+ `ask_web_search` tool instance, with unit tests covering the MCP tool
48
+ contract (name, description, params schema).
49
+ - The server now reports its own gem version in the MCP `serverInfo`
50
+ handshake (via `ask-mcp >= 0.4.3`), instead of ask-mcp's version.
51
+
3
52
  ## [0.2.0] - 2026-07-18
4
53
 
5
54
  ### Changed
data/README.md CHANGED
@@ -2,9 +2,18 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ask-web-search-mcp.svg)](https://rubygems.org/gems/ask-web-search-mcp)
4
4
 
5
- A minimal [MCP](https://modelcontextprotocol.io/) (Model Context Protocol) server
6
- that exposes an `ask_web_search` tool backed by SearXNG. Designed for use with
7
- MCP-compatible clients like **ZCode**, **Claude Code**, **Codex**, and others.
5
+ A minimal [MCP](https://modelcontextprotocol.io/) (Model Context Protocol)
6
+ server that exposes an `ask_web_search` tool backed by SearXNG. Designed for
7
+ use with MCP-compatible clients like ZCode, Claude Code, Codex, and others.
8
+
9
+ The server speaks MCP **dual-mode** (requires `ask-mcp >= 0.4`): it negotiates
10
+ the stateless `2026-07-28` revision via `server/discover` (no `initialize`
11
+ handshake, per-request `_meta`, `resultType`) when the client supports it, and
12
+ falls back to the legacy `initialize` handshake for older clients.
13
+
14
+ The tool was renamed from `web_search` to `ask_web_search` in version 0.2.0 to
15
+ avoid collisions with client-side tools. Use `ask_web_search` in your
16
+ configuration and prompts.
8
17
 
9
18
  ## Prerequisites
10
19
 
@@ -15,15 +24,14 @@ is `http://localhost:8888`.
15
24
  docker run -d --name searxng -p 8888:8080 searxng/searxng
16
25
  ```
17
26
 
18
- Or use the provided `docker-compose.yml` in the [`searxng`](../searxng) directory:
27
+ Or use the provided `docker-compose.yml` in the `searxng` directory of this
28
+ repository:
19
29
 
20
30
  ```sh
21
31
  cd searxng
22
32
  docker compose up -d
23
33
  ```
24
34
 
25
- You can customise the SearXNG URL via the `SEARXNG_URL` environment variable.
26
-
27
35
  ## Installation
28
36
 
29
37
  ```sh
@@ -49,8 +57,8 @@ The server reads JSON-RPC messages on stdin and writes responses to stdout
49
57
 
50
58
  ### With ZCode
51
59
 
52
- Add the server to your ZCode user configuration
53
- (`~/.zcode/v2/config.json`):
60
+ Add to your ZCode user configuration (`~/.zcode/v2/config.json` or
61
+ `~/.zcode/cli/config.json`):
54
62
 
55
63
  ```json
56
64
  {
@@ -66,7 +74,8 @@ Add the server to your ZCode user configuration
66
74
  }
67
75
  ```
68
76
 
69
- After restarting ZCode, the `ask_web_search` tool will be available to the model.
77
+ After restarting ZCode, the `ask_web_search` tool will be available to the
78
+ model automatically.
70
79
 
71
80
  ### With Claude Code
72
81
 
@@ -74,15 +83,30 @@ After restarting ZCode, the `ask_web_search` tool will be available to the model
74
83
  claude mcp add ask-web-search-mcp -- npx -y @anthropic-ai/mcp-serve ask-web-search-mcp
75
84
  ```
76
85
 
86
+ ## Configuration
87
+
88
+ - `SEARXNG_URL` - the SearXNG endpoint (default: `http://localhost:8888`).
89
+ - `DEBUG=1` - enable verbose logs on stderr.
90
+
91
+ ## Full documentation
92
+
93
+ The full ask-rb documentation lives at https://ask-rb.github.io/ask-docs.
94
+ [Core: Web Search](https://ask-rb.github.io/ask-docs/core/web-search) covers
95
+ ask-web-search-mcp in depth, including the tool library and troubleshooting.
96
+ API reference: https://ask-rb.github.io/ask-docs/reference/api.
97
+
77
98
  ## Development
78
99
 
79
- ```sh
80
- git clone https://github.com/ask-rb/ask-web-search-mcp
81
- cd ask-web-search-mcp
82
- bin/setup
100
+ ```
101
+ bundle install
83
102
  bundle exec rake test
84
103
  ```
85
104
 
105
+ `ask-mcp` resolves from rubygems (`>= 0.4` — the 0.4 line carries the
106
+ stateless 2026-07-28 protocol support). The suite drives the server
107
+ end-to-end with `Ask::MCP::Client` over a real stdio subprocess, stubbing
108
+ SearXNG in-process (no network required).
109
+
86
110
  ## License
87
111
 
88
- MIT — see [LICENSE](LICENSE).
112
+ MIT
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ask/web_search"
4
+
5
+ module Ask
6
+ module WebSearch
7
+ module MCP
8
+ # The ask_web_search tool, duck-typed for Ask::MCP's ToolServer
9
+ # adapter (name / description / params_schema / call). The tool
10
+ # framing lives with its consumer — this server — not in the
11
+ # library: the capability is Ask::WebSearch.search, this is the
12
+ # agent-facing shell around it.
13
+ class Tool
14
+ def name
15
+ "ask_web_search"
16
+ end
17
+
18
+ def description
19
+ "Search the web for current information. Use this to get up-to-date results, recent events, or facts that may have changed."
20
+ end
21
+
22
+ def params_schema
23
+ {
24
+ "type" => "object",
25
+ "properties" => {
26
+ "query" => { "type" => "string", "description" => "The search query" }
27
+ },
28
+ "required" => ["query"]
29
+ }
30
+ end
31
+
32
+ # Returns the formatted results (a String is a success for the
33
+ # adapter) or raises on connection/HTTP failures — the adapter
34
+ # surfaces them as classed errors.
35
+ def call(args)
36
+ query = args["query"].to_s
37
+ raise ArgumentError, "missing required parameter: query" if query.empty?
38
+
39
+ Ask::WebSearch.search(query)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -3,7 +3,7 @@
3
3
  module Ask
4
4
  module WebSearch
5
5
  module MCP
6
- VERSION = "0.2.0"
6
+ VERSION = "0.4.0"
7
7
  end
8
8
  end
9
9
  end
@@ -2,11 +2,20 @@
2
2
 
3
3
  require "ask/mcp"
4
4
  require "ask/web_search"
5
+ require_relative "mcp/tool"
5
6
  require_relative "mcp/version"
6
7
 
7
8
  module Ask
8
9
  module WebSearch
9
10
  module MCP
11
+ # Builds the tool exposed over MCP. The tool framing lives here —
12
+ # ask-web-search is a library (Ask::WebSearch.search); this server
13
+ # owns the agent-facing shell, named "ask_web_search" to avoid
14
+ # collisions with client-side tools of the same name.
15
+ def self.tool
16
+ Tool.new
17
+ end
18
+
10
19
  # Start the MCP server over stdio, exposing the ask_web_search tool.
11
20
  #
12
21
  # $ ask-web-search-mcp
@@ -25,11 +34,9 @@ module Ask
25
34
  # }
26
35
  # }
27
36
  def self.start
28
- tool = Ask::Tools::WebSearch.new
29
- tool.define_singleton_method(:name) { "ask_web_search" }
30
-
31
37
  Ask::MCP::Server.start_stdio(
32
38
  name: "ask-web-search-mcp",
39
+ version: VERSION,
33
40
  tools: [tool],
34
41
  capabilities: { tools: {} },
35
42
  debug: ENV["DEBUG"] == "1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-web-search-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0.1'
18
+ version: 0.4.3
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '0.1'
25
+ version: 0.4.3
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: ask-web-search
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '0.2'
32
+ version: 0.3.0
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '0.2'
39
+ version: 0.3.0
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: minitest
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -66,10 +66,11 @@ dependencies:
66
66
  - !ruby/object:Gem::Version
67
67
  version: '13.0'
68
68
  description: |
69
- A minimal MCP (Model Context Protocol) server that exposes Ask::Tools::WebSearch
69
+ A minimal MCP (Model Context Protocol) server that exposes ask_web_search
70
70
  as a callable tool over stdio. Designed for use with clients that support MCP
71
71
  (ZCode, Claude Code, etc.), it queries a local SearXNG instance and returns
72
- formatted search results suitable for LLM consumption.
72
+ formatted search results suitable for LLM consumption. The tool shell (name,
73
+ schema, call) lives here, wrapping the Ask::WebSearch library.
73
74
  email:
74
75
  - kaka@myrrlabs.com
75
76
  executables:
@@ -83,6 +84,7 @@ files:
83
84
  - bin/ask-web-search-mcp
84
85
  - lib/ask-web-search-mcp.rb
85
86
  - lib/ask/web_search/mcp.rb
87
+ - lib/ask/web_search/mcp/tool.rb
86
88
  - lib/ask/web_search/mcp/version.rb
87
89
  homepage: https://github.com/ask-rb/ask-web-search-mcp
88
90
  licenses: