Getting Started

CLI

Overview of OPLINK CLI usage

The OPLINK CLI lets you scaffold configs and run the MCP server that exposes your workflows to IDEs/agents.

Quick Reference

  • oplink init – create a minimal project config and .mcp-workflows folder
  • oplink add <giget> – fetch example workflows from a remote source
  • oplink server – start the MCP stdio server (used by IDE MCP integrations)
  • oplink config get – print the resolved oplink.config.mjs
  • oplink validate – validate .mcp-workflows/workflows.yaml and servers.json
  • oplink scaffold workflow <name> – append a new prompt or scripted workflow block

Tip: run any command with --help to see flags.

Commands

  • oplink init Initialize Oplink in a project. Creates .mcp-workflows/ and oplink.config.mjs if missing.
    npx oplink init
    

    Options:
    • --dir <directory> – target directory (default .)
    • --ide <cursor|windsurf|cline|rootcode|headless> – prefill IDE hints (defaults to auto‑detect)
    • --cwd <directory> – working directory (advanced)
  • oplink add <giget> Pull workflows from a remote (giget) source into .mcp-workflows.
    npx oplink add github:user/repo/path
    

    Options:
    • --force – overwrite existing file/directory
    • --cwd <dir> – custom working directory
  • oplink server Start the MCP stdio server using your project workflows.
    npx oplink server --config ./.mcp-workflows
    

    Options:
    • --config <path> – directory named .mcp-workflows or .workflows
    • --cwd <dir> – working directory
    • --logLevel <silent|info|verbose> – control diagnostic output
  • oplink config get Print the resolved Oplink config (if present).
    npx oplink config get
    
  • oplink validate Validate your .mcp-workflows files against the official schemas.
    npx oplink validate --config ./.mcp-workflows
    
  • oplink scaffold workflow <name> Append a valid workflow block (prompt by default, add --scripted for steps).
    npx oplink scaffold workflow take_screenshot --scripted
    

Examples

  1. Initialize in my-project:
    npx oplink init --dir my-project
    
  2. Add from a giget source:
    npx oplink add github:username/workflows/coding
    
  3. Run against a project workflows directory:
    npx oplink server --config ./.mcp-workflows
    

Environment & .env

  • Oplink automatically loads .env files from your --config directory before expanding ${VAR} in .mcp-workflows/servers.json.
    • Precedence: shell > .env.{NODE_ENV}.local > .env.{NODE_ENV} > .env.local > .env.
    • Shell‑exported values always win (they are never overridden by files).
  • You can still export variables in your shell or configure env in your IDE’s MCP entry; those take precedence over .env.
  • After loading .env, any unresolved ${VAR} placeholders will cause startup to fail with a clear error.

Notes

  • The server speaks MCP JSON‑RPC on STDOUT and writes diagnostics to STDERR, so keep STDOUT clean in custom scripts.
  • There is no oplink run command; IDEs call tools through the MCP server you start with oplink server.

For more details, see Installation and Workflows.