supercli-mcp-dev
Skill53 starsChanged 5 months agoMITView on GitHub
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.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cavemanSkill
- context-modeSkill
- diagnoseSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- humanenv-usageSkill
- improve-codebase-architectureSkill
- prototypeSkill
- setup-matt-pocock-skillsSkill
- supercli-docs-devSkill
- supercli-masterySkill
- tddSkill
- to-issuesSkill
- to-prdSkill
- triageSkill
- write-a-skillSkill
- zoom-outSkill
- playwright-cliSkill
- supercli.quickstartSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 49
Must include both content types for SSE negotiation:
- Distinctive: line 185
Use space syntax for CLI arguments:
- Very specific: line 228
Fix: Ensure MCP adapter sends Accept: text/event-stream, application/json.
- Very specific: line 234
Fix: Use JSON-RPC 2.0 format with jsonrpc, method, params, and id fields.
- Very specific: line 240
Fix: Use tools/list method to discover available tool names.
- Very specific: line 246
Fix: Use space syntax (--key value) and verify argument schema matches tool expectations.
- Distinctive: line 259
Test with local stdio MCP or mcp-proxy
- Very specific: line 260
Update docs/server.md with new features
- Distinctive: line 262
Test via CLI commands
- Distinctive: line 263
Verify server UI integration
- Distinctive: line 268
Session management: Add automatic session ID handling for stateful HTTP MCP
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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
- HTTP/SSE MCP: HTTP-based MCP servers with SSE streaming
- Stdio MCP with Daemon: Local stdio MCP servers routed through daemon
- Stdio MCP Direct: Direct stdio calls (may have compatibility issues)
Key Components
execute(): Main entry point, routes to appropriate transportcallHttpMcpTool(): HTTP/SSE MCP handler with JSON-RPC supportparseSseResponse(): SSE event parsercallStdioTool(): Direct stdio executionstdioCallToolJsonRpc(): Stdio JSON-RPC protocol handlercallDaemonTool(): Daemon-routed stdio calls
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:
- Lines starting with
event:define event type - Lines starting with
data:contain event data - Empty lines terminate events
- Accumulates chunks and returns final result
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
- File:
cli/mcp-daemon-client.js - Functions:
callDaemonTool(),listDaemonTools() - Maintains persistent sessions for stateful MCP servers
- Daemon runs on CLI side (not server) - starts on-demand when first command with
stateful: trueis executed via CLI - Runs as detached background process with Unix socket at
~/.supercli/mcp-daemon.sock - Persists across command executions to maintain MCP server sessions
- Better for long-running stdio MCP servers
Daemon Lifecycle:
- Auto-starts on first CLI command execution (checks socket, spawns daemon if not running)
- Server UI only stores configuration; CLI syncs and executes
- Manual control:
supercli mcp daemon start/stop/status - Detached process (unref) - doesn't block CLI
- 5-second startup timeout with retry checks
mcp-proxy Integration
What is mcp-proxy?
Transforms stdio MCP servers into HTTP/SSE endpoints. Useful for:
- Exposing local stdio MCPs over HTTP
- Testing MCP tools via HTTP clients
- Bridging stdio to SSE transport
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 3mcp-proxy Options
--port: Port to listen on (default: 8080)--streamEndpoint: HTTP endpoint path (default: /mcp)--stateless: Disable session management--sseEndpoint: SSE endpoint path (default: /sse)
Server-Side MCP Management
Server Routes
POST /api/mcp: Add MCP serverGET /api/mcp: List MCP serversDELETE /api/mcp/:name: Remove MCP server
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
/mcp: MCP server management UI- Add/remove servers
- View server status
- Test MCP tools
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:
- ✅
supercli tree deep list --path /dir --depth 2 - ❌
supercli tree deep list --path=/dir --depth=2
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
- MCP Adapter:
cli/adapters/mcp.js - Daemon Client:
cli/mcp-daemon-client.js - Stdio JSON-RPC:
cli/mcp-stdio-jsonrpc.js - Server MCP Routes:
server/routes/mcp.js - Server MCP Service:
server/services/mcpService.js
Development Workflow
- Implement MCP adapter changes
- Test with local stdio MCP or mcp-proxy
- Update docs/server.md with new features
- Update supercli-cli-admin-cheatsheet skill
- Test via CLI commands
- Verify server UI integration
Future Enhancements
- Streaming output: Implement
--streamflag for incremental SSE output - Session management: Add automatic session ID handling for stateful HTTP MCP
- Tool discovery: Auto-discover tools from MCP servers
- Schema validation: Validate arguments against tool input schemas
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

