Commit 1b98aeb
authored
feat(fast-time): rmcp /mcp transport + legacy SSE shim (#5299)
* feat: add rust fast-time sse transport
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* refactor: split rust fast-time transports
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: negotiate MCP protocol version and evict idle sessions
- Echo the client's requested protocolVersion when supported, else the
latest version this server speaks (both SSE and streamable HTTP).
- Track last-seen time per streamable-HTTP session and evict idle ones
past SESSION_IDLE_TTL instead of leaking until the cap is reached.
- get_stats now counts its own invocation like every other tool, and the
unreachable session-id header fallback is dropped.
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* refactor(fast-time): use rmcp SDK for Streamable HTTP transport and tools
Replace the hand-rolled MCP layer with the official Rust SDK (rmcp):
- /mcp Streamable HTTP transport is now served by rmcp's
StreamableHttpService + LocalSessionManager, removing the bespoke
session map and JSON-RPC dispatch (streamable_http.rs). A lightweight
gate caps concurrent sessions at MAX_ACTIVE_SESSIONS (rmcp's session
manager has no built-in cap); existing sessions are cleaned up by rmcp
on disconnect/DELETE.
- Tools are declared once via #[tool] macros with schemas derived from
their parameter types, removing the hand-written tool schemas and
dispatch (mcp.rs). The schema_error/schema_success fixtures retain
their declared outputSchema.
- The legacy HTTP+SSE transport remains a hand-rolled shim (documented
exception) because rmcp does not reproduce the bespoke ContextForge
legacy-SSE semantics (endpoint event, sessionId/session_id aliases,
202/404/410 codes). It delegates tools/list and tools/call back to the
rmcp server so schemas and logic never drift.
- serverInfo is built explicitly so /mcp reports the server identity
rather than rmcp's own crate name.
Behavior parity (DST conversion, echo delay limit, protocol-version echo,
output schemas) is covered by unit tests; both transports verified
end-to-end.
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* feat(fast-time): add MCP resources, prompts, and tool annotations
Port the Go fast-time-server's resource and prompt surface to the Rust
server so it advertises the same MCP capabilities:
- 4 resources: timezone://info, time://current/world, time://formats,
time://business-hours.
- 3 prompts: compare_timezones, schedule_meeting, convert_time_detailed.
- Advertise resources + prompts capabilities; add readOnly / idempotent /
title annotations to get_system_time and convert_time.
Resources and prompts are shared by both the /mcp transport (rmcp
ServerHandler) and the legacy SSE shim (resources/list, resources/read,
prompts/list, prompts/get).
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* feat(fast-time): add CLI, stdio transport, and Bearer auth
Bring the Rust server up to the Go transport/CLI surface:
- clap CLI: --transport (stdio|sse|http|dual|rest), --addr/--listen/--port,
--public-url, --auth-token, --log-level. With no arguments it still serves
every HTTP route on BIND_ADDRESS (default 0.0.0.0:9080), preserving the
container/Makefile behavior; the HTTP modes all serve the full router.
- stdio transport via rmcp serve(), for `--transport stdio`.
- Bearer-token auth middleware for the HTTP transports, exempting /health
and /version, mirroring the Go authMiddleware (401 + WWW-Authenticate).
- Send tracing logs to stderr so the stdio transport keeps stdout as a pure
JSON-RPC stream.
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* feat(fast-time): add the /api/v1 REST surface and CORS
Port the Go fast-time-server's REST API to the Rust server, alongside the
existing high-throughput /api/echo and /api/time benchmark endpoints:
- /api/v1/time (+ /{tz}), /api/v1/convert, /api/v1/convert/batch
- /api/v1/timezones (+ /{tz}), /api/v1/resources (+ /{slug}),
/api/v1/prompts (+ /{name}/execute)
- /api/v1/test/echo, /api/v1/test/validate, /api/v1/test/performance
- permissive CORS with a 204 preflight, applied as the outermost layer
The REST resources/prompts mirror the Go REST handlers' simpler payloads,
which differ from the richer MCP resource/prompt content.
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* feat(fast-time): add OpenAPI spec and Swagger docs endpoints
Serve /api/v1/openapi.json (an OpenAPI 3.0 document describing the REST
surface) and /api/v1/docs (a Swagger UI page), matching the Go server.
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: restore fast-time Rust CI parity
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: publish Rust fast-time server image
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: stabilize fast-time CI
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: use Rust fast-time in wrapper paths
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: align fast-time references with Rust server
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: build Rust server container images
Signed-off-by: lucarlig <luca.carlig@ibm.com>
* fix: disable gunicorn control socket in read-only containers
Signed-off-by: lucarlig <luca.carlig@ibm.com>
---------
Signed-off-by: lucarlig <luca.carlig@ibm.com>1 parent 1867330 commit 1b98aeb
39 files changed
Lines changed: 3357 additions & 1215 deletions
File tree
- .github/workflows
- charts/mcp-stack
- docs/docs
- using/servers
- mcp-servers/rust
- benchmark-server
- fast-time-server
- src
- transports
- slow-time-server
- tests/performance
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
| 81 | + | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
271 | | - | |
| 272 | + | |
272 | 273 | | |
273 | | - | |
274 | | - | |
| 274 | + | |
| 275 | + | |
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | 126 | | |
134 | | - | |
135 | 127 | | |
136 | | - | |
137 | | - | |
| 128 | + | |
138 | 129 | | |
139 | 130 | | |
140 | 131 | | |
141 | 132 | | |
142 | 133 | | |
143 | 134 | | |
144 | | - | |
| 135 | + | |
145 | 136 | | |
146 | 137 | | |
147 | 138 | | |
| |||
0 commit comments