Supercli mcp dev

From javimosch/supercli · View interactive version

Supercli mcp dev is an AI agent skill from the GitHub repository javimosch/supercli. Use this skill when working on MCP (Model Context Protocol) features in supercli — implementing adapters, adding SSE support, working with mcp-proxy, or managing MCP server connections. Covers MCP adapter architecture, transport modes, JSON-RPC format, and server/client integration.

How to use this skill

Skill file

Supercli MCP Development

Work on MCP (Model Context Protocol) features in supercli including adapter implementation, SSE streaming support, and server integration.

MCP Adapter Architecture

The MCP adapter (cli/adapters/mcp.js) supports multiple transport modes:

Transport Modes

  1. HTTP/SSE MCP: HTTP-based MCP servers with SSE streaming
  2. Stdio MCP with Daemon: Local stdio MCP servers routed through daemon
  3. Stdio MCP Direct: Direct stdio calls (may have compatibility issues)

Key Components

HTTP/SSE Implementation

Request Format

Uses JSON-RPC 2.0 format for HTTP MCP calls:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": toolName,
    "arguments": input
  },
  "id": 1
}

Headers

Must include both content types for SSE negotiation:

{
  "Content-Type": "application/json",
  "Accept": "text/event-stream, application/json"
}

SSE Response Parsing

Parses Server-Sent Events format:

Auto-detection

Automatically detects SSE responses via Content-Type header and falls back to JSON if not SSE.

Stdio MCP with Daemon

Configuration

{
  "adapterConfig": {
    "server": "mcp-server-name",
    "tool": "tool-name",
    "stateful": true,
    "timeout_ms": 60000
  }
}

Daemon Client

Daemon Lifecycle:

mcp-proxy Integration

What is mcp-proxy?

Transforms stdio MCP servers into HTTP/SSE endpoints. Useful for:

Usage Pattern

# Start mcp-proxy
npx -y mcp-proxy --port 3002 -- npx -y @andredezzy/deep-directory-tree-mcp

# Add to supercli
supercli server mcp add '{"name":"deep-tree","url":"http://localhost:3002"}'

# Create command
supercli server commands add '{"namespace":"tree","resource":"deep","action":"list","adapter":"mcp","adapterConfig":{"url":"http://localhost:3002","tool":"get_deep_directory_tree"}}'

# Sync and use
supercli sync
supercli tree deep list --path /some/dir --depth 3

mcp-proxy Options

Server-Side MCP Management

Server Routes

MCP Server Entry Format

{
  "name": "server-name",
  "url": "http://localhost:3002",
  "command": "npx -y @package",
  "args": ["--arg1", "--arg2"],
  "stateful": true,
  "timeout_ms": 60000,
  "headers": {},
  "env": {}
}

Server UI

Client-Side MCP Usage

Command Configuration

{
  "namespace": "mcp",
  "resource": "server",
  "action": "tool",
  "adapter": "mcp",
  "adapterConfig": {
    "server": "mcp-server-name",
    "tool": "tool-name",
    "stateful": true
  }
}

Argument Passing

Use space syntax for CLI arguments:

The supercli argument parser treats --key=value as a boolean flag with key=key=value, not as a key-value pair.

Testing MCP Integration

Test with mcp-proxy

# Start proxy
npx -y mcp-proxy --port 3002 -- npx -y @andredezzy/deep-directory-tree-mcp

# List tools
curl http://localhost:3002/tool -X POST \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream, application/json" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'

# Call tool
curl http://localhost:3002/tool -X POST \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream, application/json" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"tool-name","arguments":{}},"id":1}'

Test with Daemon

# Test daemon connection
node cli/mcp-daemon-client.js

# List tools via daemon
# (daemon client handles this internally)

Common Issues

"Not Acceptable: Client must accept both application/json and text/event-stream"

Cause: mcp-proxy requires SSE Accept header.

Fix: Ensure MCP adapter sends Accept: text/event-stream, application/json.

"Parse error: Invalid JSON-RPC message"

Cause: Wrong request format for HTTP MCP.

Fix: Use JSON-RPC 2.0 format with jsonrpc, method, params, and id fields.

"Tool not found"

Cause: Incorrect tool name or tool not exposed by MCP server.

Fix: Use tools/list method to discover available tool names.

"Input validation error"

Cause: Arguments not passed correctly or in wrong format.

Fix: Use space syntax (--key value) and verify argument schema matches tool expectations.

File Locations

Development Workflow

  1. Implement MCP adapter changes
  2. Test with local stdio MCP or mcp-proxy
  3. Update docs/server.md with new features
  4. Update supercli-cli-admin-cheatsheet skill
  5. Test via CLI commands
  6. Verify server UI integration

Future Enhancements

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.