Commit eea86af
authored
fix(phase-5): remove dead code and update docs (#104)
## Problem
After phases 3, 3.5, and 4 restructured the server architecture
(session-centric, Plug-based HTTP path, functional
transport for clients only), several artifacts were left behind:
- Server transports (`STDIO`, `StreamableHTTP`, `SSE`) still implement
`@behaviour Anubis.Transport` with functional
callbacks (`transport_init`, `parse`, `encode`, `extract_metadata`) that
are never called in production — the Plug
uses `Message.decode` directly, and the STDIO GenServer does too
- `Client.State.protocol_module` is stored during init but never read
- Documentation references outdated APIs, wrong callback names,
incorrect option keys, and stale protocol versions
Related issues: #77, #7, #90, #14, #64, #25, #28
## Solution
**Dead code removal:**
- Removed `@behaviour Anubis.Transport` and all functional callbacks
from `Server.Transport.STDIO`,
`Server.Transport.StreamableHTTP`, and `Server.Transport.SSE` (including
helper functions like `split_complete_lines`,
`decode_lines`, `find_header`)
- Removed `protocol_module` field from `Client.State` (type, struct,
init logic)
- Updated `Anubis.Transport` moduledoc to list only client adapters
- Removed all server-side functional transport tests from
`behaviour_test.exs`
**Documentation fixes:**
- `README.md`: Rewrote Quick Start to use Component/schema API, fixed
`handle_tool` → `handle_tool_call` (#77), fixed
`max:` → `max_length:` (#64), updated `protocol_version` to
`"2025-06-18"`, showed both static (`component`) and
dynamic (`register_tool`) patterns
- `building-a-client.md`: Fixed `name:` → `client_name:` for multiple
instances (#7), updated protocol version
- `building-a-server.md`: Fixed version `"~> 0.11"` → `"~> 0.17"`, fixed
`bug_report_content`/`build_report_content`
mismatch, fixed broken `mix anubis.stdio.sse` task, fixed
`frame.private.session_id` → `frame.context.session_id`
- `recipes.md`: Fixed `frame.transport[:headers]` →
`frame.context.headers`, `frame.private.session_id` →
`frame.context.session_id`, `send_notification` →
`Anubis.Server.send_resources_list_changed()`, `send_log_message` →
correct signature, `handle_request` with `tools/call` →
`handle_tool_call/3`
- `reference.md`: Removed spurious `type: :string` from enum field
example (#90), added SSE deprecation note
- `introduction.md`: Updated protocol version to `"2025-06-18"`
- `CONTRIBUTING.md`: Fixed MIT → LGPL-v3
- `mix.exs`: Fixed `pages/home.md` → `pages/introduction.md`
## Rationale
Straight cleanup pass — no behavioral changes. The functional
`Anubis.Transport` callbacks on server transports were
dead code since the architecture moved to direct `Message.decode` in
Plug/GenServer handlers. Removing them reduces
surface area and avoids confusion about which code path is actually
used. Documentation fixes are driven directly by
user-reported issues on GitHub.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added an Echo tool and a schema-based DSL for declaring tools.
* **Documentation**
* Updated MCP protocol/version to 2025-06-18 across docs.
* Reorganized Getting Started; transport examples use base_url and mark
SSE deprecated.
* Updated examples and guides to use structured Response return shapes.
* **Bug Fixes**
* Broadened encoding error handling for transports to surface failures
more reliably.
* **Chores**
* License note changed to LGPL‑v3.
* Added example build/test targets.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent efee54a commit eea86af
30 files changed
Lines changed: 287 additions & 631 deletions
File tree
- lib/anubis
- client
- server
- component
- transport
- transport
- pages
- priv/dev
- ascii
- echo-elixir
- upcase
- test/anubis/transport
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
11 | | - | |
| 9 | + | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
16 | | - | |
| 13 | + | |
| 14 | + | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | | - | |
21 | 18 | | |
22 | 19 | | |
23 | | - | |
24 | | - | |
| 20 | + | |
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
28 | | - | |
29 | | - | |
| 24 | + | |
| 25 | + | |
30 | 26 | | |
31 | 27 | | |
32 | 28 | | |
33 | | - | |
34 | 29 | | |
35 | 30 | | |
36 | | - | |
37 | | - | |
| 31 | + | |
38 | 32 | | |
39 | 33 | | |
40 | 34 | | |
41 | | - | |
| 35 | + | |
42 | 36 | | |
43 | 37 | | |
44 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
30 | 47 | | |
31 | 48 | | |
32 | 49 | | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | 56 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| |||
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
80 | | - | |
| 87 | + | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 43 | | |
52 | 44 | | |
53 | 45 | | |
54 | 46 | | |
55 | | - | |
56 | 47 | | |
57 | 48 | | |
58 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
39 | 32 | | |
40 | 33 | | |
41 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
42 | 37 | | |
43 | 38 | | |
44 | | - | |
45 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
46 | 42 | | |
47 | 43 | | |
48 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
| |||
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
172 | | - | |
173 | | - | |
174 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | | - | |
| 180 | + | |
177 | 181 | | |
178 | | - | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
187 | 189 | | |
188 | | - | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
0 commit comments