Skip to content

Latest commit

 

History

History
89 lines (75 loc) · 3.41 KB

File metadata and controls

89 lines (75 loc) · 3.41 KB

smcp-cli Planning and Progress

Implementation Phases

Phase 1: Foundation (Core Setup)

  • Initialize Cargo project with dependencies
  • CLI argument parsing with clap derive
  • Configuration loading (directories + toml)
  • Error types with thiserror
  • Logging with tracing
  • Create PLANNING_AND_PROGRESS.md

Phase 2: Authentication

  • OAuth PKCE flow implementation
  • Local callback HTTP server (axum)
  • Keyring token storage with file fallback
  • Token refresh logic
  • smcp auth login/logout/status commands

Phase 3: MCP API Client

  • HTTP client wrapper with reqwest
  • JSON-RPC 2.0 request/response handling
  • Session CRUD operations
  • Token injection middleware

Phase 4: Session Commands

  • smcp session create with options
  • smcp session list with table/json output
  • smcp session delete
  • smcp session status
  • smcp session metrics
  • Progress indicators (indicatif)

Phase 5: Code Execution

  • smcp exec <code> command
  • smcp preview for type definitions
  • Streaming output support
  • File input option (--file)

Phase 6: MCP Client (rmcp)

  • MCP client wrapper using rmcp crate
  • Transport factory (stdio via TokioChildProcess, HTTP via StreamableHttpClientTransport)
  • smcp mcp tools <server> - List tools
  • smcp mcp call <server> <tool> --args '{}' - Call tool
  • smcp mcp resources <server> - List resources
  • smcp mcp read <server> <uri> - Read resource
  • smcp mcp prompts <server> - List prompts
  • smcp mcp prompt <server> <name> - Get prompt
  • smcp mcp info <server> - Get server info
  • Server spec parsing (URL, command string, config ID, session ID)

Phase 7: Bridge & Daemon

  • WebSocket client (tokio-tungstenite)
  • Protocol message handling (hello/welcome/register/tool_call)
  • MCP server process management (spawn stdio servers)
  • Signal handling (SIGINT, SIGTERM, SIGHUP)
  • PID file management
  • Heartbeat ping/pong (30 second interval)
  • Reconnection with exponential backoff
  • smcp bridge start/stop/status commands

Phase 8: Server Management

  • smcp server add/remove/enable/disable/list
  • Config file manipulation
  • Server validation (check command exists)

Phase 9: Polish & Release

  • Shell completions generation (bash/zsh/fish)
  • Comprehensive integration tests
  • Protocol compatibility tests (verify JSON matches TypeScript)
  • Cross-platform builds (GitHub Actions)
  • README documentation
  • crates.io publish preparation

Recent Bug Fixes (2025-11-28)

OAuth & Authentication Fixes

  • Fixed OAuth public-client scope - server required it to be registered
  • Fixed PKCE code_challenge_method typo in request
  • Fixed token persistence - keyring was silently failing, now saves to ~/.smcp/tokens.json first with keyring as fallback
  • Fixed Bearer token authentication - rmcp's auth_header() internally uses bearer_auth() which adds "Bearer " prefix, so we pass raw token only

Import/Build Fixes

  • Fixed StreamableHttpClientTransportConfig import path to rmcp::transport::streamable_http_client::StreamableHttpClientTransportConfig

Tested Working

  • smcp auth login - OAuth PKCE flow with Better Auth
  • smcp auth status - Shows authenticated with token expiry
  • smcp mcp tools - Lists tools from https://smcp.apothic.ai/mcp with Bearer auth