Skip to content

Embedded Rust MCP: HTTP protocol with auth provider#6

Open
deangoodmanson wants to merge 10 commits intomainfrom
rustmcp2
Open

Embedded Rust MCP: HTTP protocol with auth provider#6
deangoodmanson wants to merge 10 commits intomainfrom
rustmcp2

Conversation

@deangoodmanson
Copy link
Collaborator

@deangoodmanson deangoodmanson commented Feb 3, 2026

Summary

Embedded Rust MCP server for Kruxia Flow, providing AI agents with workflow management tools via Streamable HTTP transport.

MCP Server

  • 15 tools across 5 categories: discovery, execution, observability, control, visualization
  • Streamable HTTP transport (not SSE) via rust-mcp-sdk v0.8.2
  • Feature-gated behind mcp-server (opt-in at compile time)
  • Unified auth: delegates to project's AuthenticationService (RS256) — same token works on REST API and MCP

Code Review Pass 1 Fixes (issues 1-10)

  • McpError thiserror enum with Result<T> type alias (project convention)
  • 36 unit tests across MCP tool modules
  • Deduplicated SQL queries in control.rs
  • Compile-time catalog count assertion in discovery.rs
  • Warnings array in estimate_workflow_cost for silent LLM defaults
  • Fixed mod.rs re-exports, updated consumers to use short paths
  • RAII EnvGuard for env var cleanup in config tests
  • Graceful MCP server shutdown with 5s timeout (matching existing pattern)
  • Restored CLAUDE.md from main
  • Fixed clippy warnings (collapsible_if, manual_map)

Code Review Pass 2 Fixes

  • Auth unification: Replaced standalone McpJwtAuthProvider (HS256) with McpAuthAdapter delegating to AuthenticationService (RS256). One token works everywhere. Removed jsonwebtoken from MCP feature deps.
  • Dead config removed: max_concurrent_requests, request_timeout, jwt_secret, auth_required — parsed but never enforced
  • Terminology: "edges" → "dependencies" in visualization comments (CLAUDE.md convention)
  • Visualization tests: 15 unit tests for Mermaid diagram builders and helpers

Repo Cleanup

  • Moved implementation docs to kruxiaflow-internal (see kruxia/kruxiaflow-internal#2)

Test plan

  • cargo clippy --features mcp-server — zero warnings
  • cargo check (without feature) — compiles clean
  • cargo test --features mcp-server -p kruxiaflow -- mcp — 50/50 tests pass
  • Manual: start server with --mcp-enabled, verify tool responses via MCP client

🤖 Generated with Claude Code

@deangoodmanson deangoodmanson changed the title Rust MCP: wire up HTTP transport and auth provider Embedded Rust MCP: HTTP protocol with auth provider Feb 3, 2026
@deangoodmanson deangoodmanson added work in progress WIP code. See: do not merge labels Feb 3, 2026
@deangoodmanson deangoodmanson added the do not merge code should not be merged and next step directive. label Feb 8, 2026
deangoodmanson and others added 7 commits February 8, 2026 21:56
…label

- Extract shared text_response() and parse_uuid() into tools/mod.rs,
  removing identical copies from execution, observability, visualization,
  and control modules.
- Remove single-variant McpTransport enum, transport field, and
  --mcp-transport CLI arg (dead code — only HTTP is supported).
  Stdio rejection kept as simple env var check.
- Correct "SSE" references to "Streamable HTTP" throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…onse

Pass 2: Make async-trait, jsonwebtoken, http optional behind mcp-server
feature flag for smaller binaries when MCP is not needed.

Pass 3: Standardize all handler dispatch to uniform run_* pattern,
migrate all application-level error responses to error_response
(is_error=true) for proper MCP protocol error signaling, add TODO
comments for raw SQL migration and silent defaults, and document
manually-maintained catalogs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add McpError thiserror enum with Result type alias (convention alignment)
- Add 31 unit tests across tool modules (36 total MCP tests)
- Deduplicate SQL queries in control.rs list_waiting_workflows
- Add compile-time catalog count assertion in discovery.rs
- Surface warnings array in estimate_workflow_cost for silent defaults
- Annotate unused config field on handler with allow + doc comment
- Fix mod.rs re-exports, update serve.rs to use short paths
- Restore CLAUDE.md from main branch
- Add RAII EnvGuard for env var cleanup in config tests
- Implement graceful MCP server shutdown with 5s timeout
- Fix 5 clippy warnings (collapsible_if, manual_map)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Development artifacts (user stories, implementation plans, prompt logs)
belong in the internal planning repo, not the crate source directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace McpJwtAuthProvider (HS256) with McpAuthAdapter that delegates
  to the project's AuthenticationService (RS256). One token now works
  across both the REST API and MCP server.
- Remove jwt_secret and auth_required from McpConfig (auth is determined
  by whether an AuthenticationService is passed to spawn_mcp_server)
- Remove jsonwebtoken from mcp-server feature deps
- Remove max_concurrent_requests and request_timeout config fields
  (parsed but never enforced by the SDK)
- Fix "edges" terminology in visualization.rs comments (CLAUDE.md convention)
- Add 15 unit tests for visualization pure functions (node_id, status_style,
  extract_status_map, extract_activity_name_map, build_workflow_mermaid,
  build_cost_mermaid)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge code should not be merged and next step directive. work in progress WIP code. See: do not merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant