API Reference

Developer Documentation

Complete reference for the OSOP MCP server, SDKs, CLI, and format converters.

MCP Server
pip install osop-mcp
Python CLI
pip install osop
JS/TS SDK
npm install @osop/sdk
Python SDK
pip install osop-sdk

MCP Tools

9 tools exposed via Model Context Protocol (MCP). Works with GitHub Copilot, Cursor, Claude Desktop, and any MCP-compatible client.

# Install and run the MCP server
$ pip install osop-mcp
$ python -m osop_mcp                    # stdio transport
$ OSOP_MCP_TRANSPORT=sse python -m osop_mcp  # SSE transport (port 8080)

# Or via Docker
$ docker run -i ghcr.io/archie0125/osop-mcp
osop.validate

Validate .osop workflow against JSON Schema

Parameters
contentstring?YAML content to validate
file_pathstring?Path to .osop file
strictbooleanTreat warnings as errors (default: false)
Returns: Errors and warnings with line numbers
osop.risk_assess

Analyze workflow for security risks (0-100 score)

Parameters
contentstring?YAML content to assess
file_pathstring?Path to .osop file
Returns: { overall_score, verdict: safe|caution|warning|danger, findings[] }
osop.run

Execute workflow with given inputs

Parameters
contentstring?YAML content to execute
file_pathstring?Path to .osop file
inputsobject?Workflow input values
dry_runbooleanSimulate without side effects (default: false)
timeout_secondsintegerMax execution time (default: 300)
Returns: Execution results with node outputs and final state
osop.render

Render workflow as visual diagram

Parameters
contentstring?YAML content to render
file_pathstring?Path to .osop file
formatstring"mermaid" | "ascii" | "svg" (default: "mermaid")
directionstring"TB" | "LR" (default: "TB")
Returns: Diagram in specified format
osop.test

Run workflow test cases

Parameters
contentstring?YAML with test cases
file_pathstring?Path to .osop file
filterstring?Pattern to filter tests
verbosebooleanDetailed output (default: false)
Returns: Pass/fail results with test details
osop.optimize

Suggest workflow improvements from execution history

Parameters
contentstring?YAML to analyze
file_pathstring?Path to .osop file
applybooleanReturn optimized YAML vs suggestions only (default: false)
Returns: Optimization suggestions or optimized workflow YAML
osop.import

Convert external formats to OSOP

Parameters
contentstring?Source content
file_pathstring?Path to source file
source_formatstring"github-actions" | "bpmn" | "airflow" | "temporal" | "postman" | "openapi"
Returns: Valid OSOP YAML
osop.export

Convert OSOP to external formats

Parameters
contentstring?OSOP YAML
file_pathstring?Path to .osop file
target_formatstring"github-actions" | "bpmn" | "airflow" | "temporal"
Returns: Content in target format
osop.report

Generate HTML/text report from workflow + execution log

Parameters
contentstring?OSOP YAML content
file_pathstring?Path to .osop file
log_contentstring?OSOPLOG YAML content
log_file_pathstring?Path to .osoplog file
formatstring"html" | "text" (default: "html")
Returns: Self-contained HTML or text report

MCP Configuration

Claude Desktop — claude_desktop_config.json
{
  "mcpServers": {
    "osop": {
      "command": "python",
      "args": ["-m", "osop_mcp"]
    }
  }
}
Claude Code — .mcp.json
{
  "mcpServers": {
    "osop": {
      "command": "python",
      "args": ["-m", "osop_mcp"],
      "env": { "OSOP_LOG_LEVEL": "INFO" }
    }
  }
}

JavaScript / TypeScript SDK

TypeScript-first with full type definitions. Works in Node.js and browsers.

import { OsopClient } from "@osop/sdk";

const client = new OsopClient({ baseUrl: "http://localhost:8080" });

// Validate a workflow
const result = await client.validate({ filePath: "deploy.osop.yaml" });
console.log(result.valid); // true

// Run with dry-run
const execution = await client.run({
  filePath: "deploy.osop.yaml",
  inputs: { environment: "staging" },
  dryRun: true,
});
console.log(execution.status); // "completed"

// Render as Mermaid diagram
const diagram = await client.render({
  filePath: "deploy.osop.yaml",
  format: "mermaid",
});
Constructor Options
baseUrlstringOSOP server URL (required)
apiKeystring?API key for authentication
timeoutnumber?Request timeout ms (default: 30000)

Python SDK

Sync and async clients. Python 3.11+.

from osop_sdk import OsopClient, AsyncOsopClient

# Synchronous
client = OsopClient(base_url="http://localhost:8080")
result = client.validate(file_path="deploy.osop.yaml")
print(result.valid)  # True

execution = client.run(
    file_path="deploy.osop.yaml",
    inputs={"environment": "staging"},
    dry_run=True,
)
print(execution.status)  # "completed"

# Async
async_client = AsyncOsopClient(base_url="http://localhost:8080")
result = await async_client.validate(file_path="workflow.osop.yaml")

CLI Reference

Python 3.11+. All commands accept file paths or stdin.

$ pip install osop

$ osop validate workflow.osop.yaml        # Validate against schema
$ osop validate workflow.osop.yaml --strict  # Warnings = errors

$ osop render workflow.osop.yaml          # Mermaid diagram
$ osop render workflow.osop.yaml --format ascii  # ASCII art

$ osop run workflow.osop.yaml             # Execute
$ osop run workflow.osop.yaml --dry-run   # Simulate

$ osop risk workflow.osop.yaml            # Security risk score (0-100)

$ osop test workflow.osop.yaml            # Run test cases
$ osop test workflow.osop.yaml --verbose  # Detailed output

$ osop report workflow.osop.yaml --log run.osoplog.yaml -o report.html

Format Converters (osop-interop)

Import existing workflows into OSOP or export to external formats.

FormatImportExport
GitHub ActionsYesYes
BPMNYesYes
Apache AirflowYesYes
TemporalYesYes
Postman CollectionsYes
OpenAPI 3.xYes
$ pip install osop-interop

# Import
$ osop import deploy.yml --from github-actions -o deploy.osop.yaml
$ osop import process.bpmn --from bpmn -o process.osop.yaml
$ osop import dag.py --from airflow -o pipeline.osop.yaml

# Export
$ osop export workflow.osop.yaml --to github-actions -o .github/workflows/deploy.yml
$ osop export workflow.osop.yaml --to airflow -o dags/pipeline.py

Environment Variables

VariableDescriptionDefault
OSOP_MCP_TRANSPORTMCP transport protocolstdio
OSOP_MCP_PORTSSE transport port8080
OSOP_LOG_LEVELLogging levelINFO
OSOP_MCP_URLMCP server URL (for skills)
OSOP_APPROVAL_MODEApproval gate behaviormanual