Skip to content

Apothic-AI/smcp-cli

Repository files navigation

smcp-cli

CLI for sMCP Gateway - Secure MCP session management and execution.

Features

  • Authentication - OAuth 2.0 PKCE flow with secure token storage
  • MCP Client - Probe and interact with any MCP server (HTTP or stdio)
  • Session Management - Create, list, and manage isolated execution sessions
  • Code Execution - Execute JavaScript/TypeScript in secure sandboxed containers
  • Bridge - Connect local MCP servers to the cloud gateway
  • Cross-platform - Linux, macOS (Intel & Apple Silicon), Windows

Installation

From Releases

Download the latest binary from GitHub Releases.

From Source

cargo install --path .

Build from Source

git clone https://github.com/Apothic-AI/smcp-cli.git
cd smcp-cli
cargo build --release

Quick Start

# 1. Authenticate with sMCP Gateway
smcp auth login

# 2. Check authentication status
smcp auth status

# 3. List available MCP tools
smcp mcp tools

# 4. Create a session and execute code
smcp session create --ttl 60
smcp exec --session <SESSION_ID> "console.log('Hello from sMCP!')"

Commands

Authentication

smcp auth login    # Start OAuth login flow (opens browser)
smcp auth logout   # Clear stored credentials
smcp auth status   # Check authentication status and token expiry

MCP Client

Interact with any MCP server for testing and development:

# List tools from the default sMCP Gateway
smcp mcp tools

# List tools from a custom MCP server
smcp mcp tools https://your-mcp-server.com/mcp

# List tools from a local stdio MCP server
smcp mcp tools "npx -y @modelcontextprotocol/server-filesystem /tmp"

# Call a tool
smcp mcp call create_session '{"ttl": 60}' --server https://smcp.apothic.ai/mcp

# List and read resources
smcp mcp resources
smcp mcp read <uri>

# List and get prompts
smcp mcp prompts
smcp mcp prompt <name> '{}'

Session Management

smcp session create              # Create a new session
smcp session create --ttl 120    # Create with 2-hour TTL
smcp session list                # List all sessions
smcp session list --format json  # List in JSON format
smcp session status <SESSION_ID> # Get session status
smcp session metrics <SESSION_ID> # Get resource metrics
smcp session delete <SESSION_ID> # Delete a session

Code Execution

# Execute inline code
smcp exec "console.log('Hello')" --session <SESSION_ID>

# Execute from file
smcp exec --file script.js --session <SESSION_ID>

# Stream output
smcp exec --stream "longRunningTask()" --session <SESSION_ID>

Bridge (Local MCP Servers)

Connect your local MCP servers to the sMCP cloud gateway:

smcp bridge start              # Start the bridge daemon
smcp bridge start --foreground # Run in foreground
smcp bridge status             # Check bridge status
smcp bridge logs               # View bridge logs
smcp bridge logs --follow      # Follow logs
smcp bridge stop               # Stop the bridge

Server Configuration

Manage local MCP server configurations for the bridge:

smcp server add --id myserver --command "npx" --args "-y" --args "@modelcontextprotocol/server-filesystem" --args "/tmp"
smcp server list
smcp server enable <SERVER_ID>
smcp server disable <SERVER_ID>
smcp server remove <SERVER_ID>

Shell Completions

# Bash
smcp completions bash > ~/.local/share/bash-completion/completions/smcp

# Zsh
smcp completions zsh > ~/.zfunc/_smcp

# Fish
smcp completions fish > ~/.config/fish/completions/smcp.fish

# PowerShell
smcp completions powershell > smcp.ps1

Configuration

Configuration is stored in ~/.config/smcp/config.toml.

Authentication tokens are stored securely using the system keyring with fallback to ~/.smcp/tokens.json.

Cross-Platform Builds

Build for multiple platforms using cross:

# Install cross
cargo install cross

# Build for Windows
cross build --release --target x86_64-pc-windows-gnu

# Build for Linux
cross build --release --target x86_64-unknown-linux-gnu

macOS builds require a macOS host or GitHub Actions (see .github/workflows/release.yml).

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Copyright 2024-2025 Apothic AI

About

Scriptable MCP (sMCP) management CLI tool

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published