Skip to content

stxkxs/stedi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stedi

A production-ready CLI and MCP server for the Stedi Healthcare & EDI Platform.

Built with Cobra and Charm libraries for a polished terminal experience.

Features

  • Healthcare APIs — eligibility checks (270/271), claims submission (837), claim status (276/277), payer search, provider and enrollment management
  • Developer Plan APIs — insurance discovery, coordination of benefits, batch eligibility with tier-aware error handling
  • EDI Platform APIs — transaction inspection, mapping invocation, file execution management
  • MCP Server — tools and agentic workflow prompts for AI assistants (Claude, Cursor, VS Code) via stdio or SSE transport
  • Interactive forms — guided input for complex operations like eligibility checks
  • API Playground — full-screen interactive TUI with guided multi-step workflows and individual endpoint exploration
  • Dual output — styled terminal output by default, raw JSON with --json for scripting

Installation

# Install directly
go install github.com/stxkxs/stedi@latest

# Or clone and build
git clone https://github.com/stxkxs/stedi.git && cd stedi
go build -o stedi .

Requires Go 1.24+.

Configuration

Set your Stedi API key using one of these methods (checked in order):

# 1. Environment variable
export STEDI_API_KEY=test_xxxxx

# 2. .env file in current directory
echo "STEDI_API_KEY=test_xxxxx" > .env

# 3. ~/.stedi/.env
mkdir -p ~/.stedi && echo "STEDI_API_KEY=test_xxxxx" > ~/.stedi/.env

# 4. Interactive setup
stedi config set-key

Verify configuration:

stedi config show

Usage

Payers

# Search for payers by name
stedi payers search "Blue Cross"

# List all 5000+ payers
stedi payers list

# Get detailed payer information
stedi payers get HPQRS

# Output as JSON for scripting
stedi payers search "Aetna" --json | jq '.items[].payer.stediId'

Eligibility Checks (270/271)

# Interactive — guided form collects subscriber, provider, and payer details
stedi eligibility check

# From file — provide a complete request body
stedi eligibility check --file eligibility-request.json

# JSON output for downstream processing
stedi eligibility check --file request.json --json
Example eligibility request JSON
{
  "controlNumber": "123456789",
  "tradingPartnerServiceId": "HPQRS",
  "provider": {
    "organizationName": "ACME Health Services",
    "npi": "1234567890"
  },
  "subscriber": {
    "memberId": "0000000000",
    "firstName": "JANE",
    "lastName": "DOE",
    "dateOfBirth": "19900101"
  },
  "encounter": {
    "serviceTypeCodes": ["30"]
  }
}

Claims Submission (837)

# Submit a professional claim (CMS-1500)
stedi claims submit --file claim.json --type professional

# Submit a dental claim
stedi claims submit --file claim.json --type dental

# Submit an institutional claim (UB-04)
stedi claims submit --file claim.json --type institutional

Claim Status (276/277)

# Interactive inquiry
stedi claim-status check

# From file
stedi claim-status check --file status-request.json

Transactions

# List recent transactions
stedi transactions list

# Paginated results
stedi transactions list --page-size 10 --page-token "TOKEN"

# Get transaction details
stedi transactions get TXN_ID

# View transaction input/output
stedi transactions input TXN_ID
stedi transactions output TXN_ID

# Poll for new transactions
stedi transactions poll

Providers

# List registered providers
stedi providers list

# Create a provider (interactive form)
stedi providers create

# Get provider details
stedi providers get PROVIDER_ID

# Delete a provider (with confirmation prompt)
stedi providers delete PROVIDER_ID

Enrollments

# List enrollments (with optional filters)
stedi enrollments list
stedi enrollments list --provider-id PROV_123 --payer-id HPQRS

# Create an enrollment (interactive)
stedi enrollments create

# Get enrollment details
stedi enrollments get ENROLLMENT_ID

EDI Mappings

# Invoke a mapping with input data
stedi mappings invoke MAPPING_ID --file input.json

# Pipe from stdin
echo '{"key":"value"}' | stedi mappings invoke MAPPING_ID --file -

Configuration

# Show current config
stedi config show

# Set API key interactively (with secure input)
stedi config set-key

# Print as environment variables
stedi config env
eval $(stedi config env)

API Playground

Launch a full-screen interactive TUI for exploring Stedi APIs — like Postman in the terminal.

stedi playground

Three-panel layout:

  • Left — browse guided workflows and API endpoints grouped by category
  • Top right — request builder with editable parameters and JSON body
  • Bottom right — response viewer with status code, timing, and scrollable JSON

Guided workflows chain multiple API calls with automatic data passing between steps. Select a workflow, fill in the inputs, press s, and watch steps execute with live progress:

 ✓ Search Payers ──────────────── 200  42ms
   Aetna (AETNA_001)

 ⧗ Check Eligibility ──────────────────────
   ⠋ Submitting 270 inquiry...

 ○ Coordination of Benefits ──── Pending

Built-in workflows: Payer Resolution, Eligibility Check, Claims Pre-flight, Provider Onboarding, Coverage Resolution (Developer), and Transaction Review.

Keyboard shortcuts:

Key Action
Tab / Shift+Tab Switch panel focus
/ Browse endpoints
Enter Select endpoint
s Send request / run workflow
e Edit parameters / inputs
Esc Stop editing
? Help overlay
q Quit

Each endpoint comes pre-loaded with sensible defaults — select an endpoint, press s to send, and instantly see the response.

MCP Server

The CLI includes a built-in Model Context Protocol server, enabling AI assistants to interact with Stedi APIs directly.

Available Tools

Tool Description
search_payers Search for insurance payers by name or ID
get_payer Get payer details by Stedi ID
list_payers List all available payers
check_eligibility Run real-time eligibility check (270/271)
submit_professional_claim Submit a professional claim (837P)
check_claim_status Check claim processing status (276/277)
list_transactions List recent transactions
get_transaction Get transaction details
get_transaction_output Get transaction output data
list_providers List registered providers
create_provider Register a new provider
get_provider Get provider details
delete_provider Delete a provider
list_enrollments List payer enrollments
create_enrollment Create a payer enrollment
get_enrollment Get enrollment details
invoke_mapping Invoke an EDI mapping
submit_insurance_discovery Discover patient coverage from demographics (Developer)
get_insurance_discovery Retrieve pending discovery results (Developer)
check_cob Coordination of benefits / multi-payer detection (Developer)
submit_batch_eligibility Submit batch eligibility checks (Developer)
get_batch_eligibility Poll batch eligibility results (Developer)

Agentic Prompts

MCP prompts encode multi-step workflow playbooks with embedded healthcare domain knowledge (X12 transaction types, AAA reject codes, service type codes, payer alias resolution). AI assistants select a prompt, receive step-by-step instructions, and execute autonomously using the tools above.

Prompt Description
payer_resolution Resolve payer name/alias to Stedi payer ID
eligibility_request_builder Build and submit eligibility check from natural language
eligibility_recovery Recover from failed eligibility check with retry strategies
claims_preflight Validate all prerequisites before claim submission
provider_onboarding Register provider and set up payer enrollments
transaction_monitor Scan transactions and surface failures with patterns
coverage_resolution Full coverage chain: eligibility → discovery → COB (Developer)
multi_payer_routing Determine correct claim routing across multiple payers (Developer)
batch_eligibility_review Batch submit, monitor, and auto-recover failures (Developer)

stdio Transport (Claude Desktop, Cursor, VS Code)

Add to your MCP client configuration:

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "stedi": {
      "command": "/path/to/stedi",
      "args": ["mcp", "stdio"],
      "env": {
        "STEDI_API_KEY": "your_api_key"
      }
    }
  }
}

Claude Code (~/.claude/settings.json):

{
  "mcpServers": {
    "stedi": {
      "command": "/path/to/stedi",
      "args": ["mcp", "stdio"],
      "env": {
        "STEDI_API_KEY": "your_api_key"
      }
    }
  }
}

SSE Transport (Remote / Shared)

# Start HTTP server with SSE
stedi mcp sse --port 8080

# Custom host binding
stedi mcp sse --host 127.0.0.1 --port 3000

Connect your MCP client to http://localhost:8080/sse.

Global Flags

Flag Description
--json Output raw JSON instead of styled terminal output
--help Show help for any command
--version Show CLI version

Shell Completion

# Bash
stedi completion bash > /etc/bash_completion.d/stedi

# Zsh
stedi completion zsh > "${fpath[1]}/_stedi"

# Fish
stedi completion fish > ~/.config/fish/completions/stedi.fish

Architecture

stedi/
├── main.go                        # Entry point
├── internal/
│   ├── config/config.go           # Configuration loading (.env, env vars)
│   ├── api/
│   │   ├── client.go              # HTTP client with auth and error handling
│   │   ├── healthcare.go          # Healthcare API methods (payers, eligibility, claims, discovery, COB, batch)
│   │   └── edi.go                 # EDI Platform API methods (transactions, mappings)
│   ├── cmd/
│   │   ├── root.go                # Root command, global flags
│   │   ├── payers.go              # payers list/search/get
│   │   ├── eligibility.go         # eligibility check (interactive form)
│   │   ├── claims.go              # claims submit
│   │   ├── claimstatus.go         # claim-status check (interactive form)
│   │   ├── transactions.go        # transactions list/get/output/input/poll
│   │   ├── providers.go           # providers CRUD (interactive create)
│   │   ├── enrollments.go         # enrollments CRUD (interactive create)
│   │   ├── mappings.go            # mappings invoke
│   │   ├── configure.go           # config show/set-key/env
│   │   ├── mcp.go                 # mcp stdio/sse
│   │   └── playground.go          # playground command entry point
│   ├── mcp/
│   │   ├── server.go              # MCP server with tier-aware error handling
│   │   └── prompts.go             # Agentic workflow prompts with healthcare domain knowledge
│   ├── playground/
│   │   ├── app.go                 # Top-level Bubble Tea model, layout, focus, workflow orchestration
│   │   ├── navigator.go           # Left panel: workflows + categorized endpoint browser
│   │   ├── request.go             # Right-top: request/workflow input builder
│   │   ├── response.go            # Right-bottom: response viewer + progressive workflow display
│   │   ├── recipes.go             # Static registry of API endpoint recipes
│   │   ├── workflows.go           # Guided multi-step workflow definitions
│   │   ├── workflow.go            # Workflow types, data mapping, path resolution
│   │   ├── workflow_exec.go       # Workflow execution engine with step chaining
│   │   ├── execute.go             # Async single-request execution via tea.Cmd
│   │   ├── help.go                # Keyboard shortcut overlay
│   │   └── styles.go              # TUI-specific Lip Gloss styles
│   └── ui/
│       ├── styles.go              # Lip Gloss color palette and component styles
│       └── output.go              # JSON, table, detail view, and helper renderers
└── go.mod

API Coverage

API Surface Endpoints Plan
Payer Search list, search, get Basic
Eligibility (270/271) check Basic
Claims (837) professional, dental, institutional Basic
Claim Status (276/277) check Basic
Transactions list, get, input, output, poll Developer
Providers list, get, create, update, delete Developer
Enrollments list, get, create, update, delete Developer
EDI Mappings invoke Developer
EDI Transactions list, get, output Developer
EDI Executions list, get, input, output Developer
Insurance Discovery submit, get Developer
Coordination of Benefits check Developer
Batch Eligibility submit, poll Developer
MCP Server tools, prompts, stdio + SSE All
API Playground endpoints + guided workflows All

License

MIT

About

Healthcare & EDI Platform CLI with MCP server and API playground for the Stedi API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages