Skip to content

Releases

v0.5.0

Choose a tag to compare

@PaytonWebber PaytonWebber released this 10 Jun 21:39
v0.5.0
ef39958

Adds mcp.StatefulToolPack(State, defs) for tool packs whose handlers share mutable state (a daemon client, a database handle). The generated struct holds state: *State and passes it as the handlers' first parameter:

fn record(self: *Bridge, allocator: Allocator, args: RecordArgs) !types.CallToolResult

Motivated by migrating a real downstream server whose tools are all stateful; the stateless ToolPack could not express it without globals. No breaking changes.

Install

zig fetch --save https://github.com/PaytonWebber/zig-mcp-sdk/archive/refs/tags/v0.5.0.tar.gz

v0.4.0

Choose a tag to compare

@PaytonWebber PaytonWebber released this 10 Jun 18:55
v0.4.0
9a03256

Highlights

mcp.ToolPack: one declaration per tool.

fn hello(allocator: Allocator, args: HelloArgs) !types.CallToolResult {
    const msg = try std.fmt.allocPrint(allocator, "Hello, {s}!", .{args.name});
    return types.CallToolResult.text(allocator, msg);
}

const MyTools = mcp.ToolPack(.{
    .hello = .{ .description = "Say hello", .handler = hello },
});

That is a complete tool server: the JSON Schema, the tools/list entry, name dispatch, and typed argument parsing are generated at compile time from the handler's signature. The pack implements listTools/callTool, so it works directly as a Server handler or embedded in a larger one.

  • ToolContext for handlers that report progress: tc.sendProgress(i, total) is a no-op when the client sent no progress token. Over HTTP, progress streams on the POST's own SSE response.
  • Composition: ToolPack(.{ lib_a.tool_defs, my_defs }) merges def groups, so libraries can export tools without owning a server binary. Duplicate names are a compile error.
  • Unknown tools and failed argument validation return descriptive isError results.
  • types.parseArgs accepts absent arguments when every field has a default.

No breaking changes; hand-written listTools/callTool handlers keep working. Both greeter examples now use packs.

See CHANGELOG.md.

Install

zig fetch --save https://github.com/PaytonWebber/zig-mcp-sdk/archive/refs/tags/v0.4.0.tar.gz

v0.3.0

Choose a tag to compare

@PaytonWebber PaytonWebber released this 10 Jun 18:35
v0.3.0
bfd3876

Closes the three remaining Streamable HTTP gaps from v0.2.0.

Highlights

  • POST response streaming: callTool may take a per-call Context (fn(*Handler, Allocator, Context, CallToolParams), detected at compile time). Over HTTP, notifications sent during the call stream on the POST's own SSE response, progress events first, then the result, as the spec prefers. Over stdio they interleave on stdout.
  • Resumable event streams: SSE events carry ids, notifications sent with no stream open are buffered per session (sse_replay_events) and replayed when one opens, and Last-Event-ID resumes after a reconnect. A new GET takes over the stream (last connection wins), so reconnecting clients are never locked out.
  • Session idle reaper: sessions inactive for session_idle_seconds (default 600) are terminated by a background task, so clients that never send DELETE no longer pin session slots.

Behavior change

  • A second GET stream on a session now takes over instead of receiving 409. Between keepalives a dead client is indistinguishable from a quiet one, so 409 locked out reconnecting clients for up to a keepalive interval.

See CHANGELOG.md for details.

Install

zig fetch --save https://github.com/PaytonWebber/zig-mcp-sdk/archive/refs/tags/v0.3.0.tar.gz

v0.2.0

Choose a tag to compare

@PaytonWebber PaytonWebber released this 10 Jun 18:15
v0.2.0
b47916f

Highlights

  • Concurrent HTTP transport: multiple live sessions (refcounted session map, max_sessions cap), connections handled in parallel, per-session protocol version negotiation.
  • Server-sent events: GET with Accept: text/event-stream opens a per-session stream. Server-initiated notifications (logging, progress, channel events) arrive as SSE events with periodic keepalives.
  • Pagination: list handlers may take (self, Allocator, types.ListParams) to receive the cursor; detected at compile time, existing 2-arg handlers keep working.
  • Cancellation + progress: notifications/cancelled routes to an optional onCancelled hook; Context.sendProgress and CallToolParams.progressToken() support progress reporting.
  • HTTP conformance in CI: a curl-driven script exercises sessions, SSE delivery, security rejections, and termination on every push.

Breaking changes

  • Context construction is now sink-based (.{ .sink = .{ .writer = w } }). Handler-facing methods are unchanged.
  • The HTTP transport handles connections concurrently: pass a thread-safe allocator (e.g. std.heap.smp_allocator) and make handler methods tolerant of concurrent calls.

See CHANGELOG.md for the full list including bug fixes.

Install

zig fetch --save https://github.com/PaytonWebber/zig-mcp-sdk/archive/refs/tags/v0.2.0.tar.gz

v0.1.0

Choose a tag to compare

@PaytonWebber PaytonWebber released this 10 Jun 17:38
v0.1.0
26c53e6

First tagged release of zig-mcp-sdk, a Model Context Protocol SDK for Zig 0.16.0.

Highlights

  • Comptime tool schemas: types.schemaForStruct generates MCP JSON Schema from a plain Zig struct at compile time; types.parseArgs parses incoming arguments into the same struct, so schema and parser cannot drift.
  • Server(Handler): comptime-generic MCP server over stdio with request-scoped arena allocators, full lifecycle handling, and protocol version negotiation.
  • Streamable HTTP transport: session management, Origin validation (DNS rebinding protection), Content-Type/Accept validation, configurable body size limit. Cross-platform session IDs via Io.randomSecure.
  • Logging: logging/setLevel routing and Context.sendLogMessage for notifications/message.
  • Claude channel support: channel events, permission relay, experimental capabilities.
  • Conformance-tested: CI runs the full test suite plus a stdio conformance script covering the handshake, tools, resources, prompts, error codes, and parse-error recovery.

See CHANGELOG.md for details.

Install

zig fetch --save https://github.com/PaytonWebber/zig-mcp-sdk/archive/refs/tags/v0.1.0.tar.gz