Files
kb/openspec/changes/kb-v3-mcp-server/specs/go-client/spec.md
T
steve e7136a4a20 Add MCP server, note mutation endpoint, and updated_at tracking (v3.0.0)
New MCP server (mcp/) exposes kb operations as native MCP tools over
Streamable HTTP with Bearer token auth. Supports collections via tag
conventions, chunked file uploads, and agent-side search patterns.

Engine gains PATCH /api/v1/notes/{id} for in-place note updates with
transactional re-chunk/re-embed, and updated_at column on documents.

Go client adds updatenote command and Patch HTTP method.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 21:34:55 +01:00

3.2 KiB

Go Client (Delta)

ADDED Requirements

Requirement: Update note command

The client SHALL provide a kb updatenote <id> <text> command that updates an existing note's content via the engine's PATCH /api/v1/notes/{id} endpoint.

Scenario: Update a note

  • WHEN the user runs kb updatenote 42 "Updated note content"
  • THEN the client SHALL send PATCH /api/v1/notes/42 with body {"text": "Updated note content"} and display the result

Scenario: Update a note with JSON output

  • WHEN the user runs kb updatenote 42 "new content" --format json
  • THEN the client SHALL output the raw JSON response from the engine

Scenario: Update a non-existent document

  • WHEN the user runs kb updatenote 999 "text" and the engine returns HTTP 404
  • THEN the client SHALL display an error indicating the document was not found and exit with a non-zero code

Scenario: Update a non-note document

  • WHEN the user runs kb updatenote 42 "text" and the engine returns HTTP 422
  • THEN the client SHALL display an error indicating that only notes can be updated and exit with a non-zero code

Scenario: Missing arguments

  • WHEN the user runs kb updatenote or kb updatenote 42 with insufficient arguments
  • THEN the client SHALL display usage help indicating that both document ID and text are required

MODIFIED Requirements

Requirement: Engine version compatibility check

The client SHALL verify that the connected engine meets a minimum version requirement before executing any API command. The minimum required engine version SHALL be embedded in the client binary at build time. If the engine version is below the minimum, the client SHALL print an error message and exit with a non-zero code. There SHALL be no flag to skip or suppress this check.

Scenario: Compatible engine version

  • WHEN the client connects to an engine reporting version 3.0.0 and MinEngineVersion is 3.0.0
  • THEN the client SHALL proceed with the command normally

Scenario: Incompatible engine version

  • WHEN the client connects to an engine reporting version 2.1.0 and MinEngineVersion is 3.0.0
  • THEN the client SHALL print to stderr: Error: kb client vX.Y.Z requires engine v3.0.0+ (connected engine is v2.1.0) followed by an upgrade hint, and exit with code 1

Scenario: Engine unreachable during version check

  • WHEN the client cannot reach the engine's /api/v1/status endpoint
  • THEN the client SHALL skip the version check and proceed with the original command (the actual API call will surface the connectivity error)

Scenario: Version check is cached per session

  • WHEN the client has already verified engine compatibility during the current invocation
  • THEN subsequent API calls within the same invocation SHALL NOT repeat the version check

Scenario: Client version command does not check engine

  • WHEN the user runs kb --version
  • THEN the client SHALL print the client version without contacting the engine

Scenario: MinEngineVersion not set

  • WHEN the client binary has MinEngineVersion set to empty string or dev
  • THEN the client SHALL skip the version check entirely (development builds)