Repository avatar
Other Tools
v1.0.0
active

shebang-mcp-sdk

io.github.sheldonrobinson/shebang-mcp-sdk

Generic shell MCP SDK server with stdio and Streamable HTTP transports.

Documentation

shebang-mcp-sdk

Generic Shebang MCP SDK — The Model Context Protocol (MCP) SDK for shell environments (POSIX sh/Bash & PowerShell), analogous to python-sdk for Python and @modelcontextprotocol/sdk for TypeScript.

License: MIT MCP SDK Agent Skills Agent Plugins

Overview

The Shebang MCP SDK is a generic, cross-platform MCP SDK that provides the core Model Context Protocol (MCP) implementation usable by any shell-based MCP server. It is strictly generic and contains no application-specific logic.

Like the official Python SDK and TypeScript SDK, the Shebang MCP SDK gives you the protocol foundation — JSON-RPC 2.0 framing, initialize/ping/tools/list/tools/call handling, stdio and streamable-http transports, and lifecycle management — so you can focus on building your MCP tools rather than reimplementing the protocol.

Native implementations for:

  • Linux / macOS (Bash): bin/mcp-sdk.sh + bin/shebang-mcp-sdk.sh
  • Windows (PowerShell): bin/mcp-sdk.psm1 + bin/shebang-mcp-sdk.ps1
  • Polyglot Runner: bin/script-runner.sh / bin/script-runner.ps1 (runs in both POSIX sh/bash and PowerShell)

MCP Protocol Support

Required features (implemented per MCP specification):

  • JSON-RPC 2.0 envelope (jsonrpc: "2.0") on every message
  • initialize request → capabilities, serverInfo, protocolVersion
  • notifications/initialized → handled silently (no response)
  • ping request → empty object {} response
  • tools/list → list of available tools
  • tools/call → invoke a named tool with arguments
  • Standard JSON-RPC 2.0 error codes (-32700, -32600, -32601, -32602, -32603)
  • Transports: stdio and streamable-http
  • On-exit cleanup handler

Optional features (explicitly NOT implemented):

  • Authorization, Elicitation, Roots, Sampling, Completions, Logging

Deprecated features (explicitly NOT implemented):

  • Legacy HTTP+SSE transport

Install Skill (.agents/skills/)

Per the Agent Skills Specification, install the skill to .agents/skills/:

# Project-level (.agents/skills/) or User-level (~/.agents/skills/)
mkdir -p .agents/skills
cp -R skills/shebang-mcp-builder .agents/skills/shebang-mcp-builder
New-Item -ItemType Directory -Path .agents/skills -Force | Out-Null
Copy-Item -Recurse -Force skills/shebang-mcp-builder .agents/skills/shebang-mcp-builder

This copies only the discoverable skill, not the SDK runtime. Set PLUGIN_ROOT to a full shebang-mcp-sdk checkout containing bin/ before running setup, generation, or server commands:

export PLUGIN_ROOT=/absolute/path/to/shebang-mcp-sdk
$env:PLUGIN_ROOT = 'C:\path\to\shebang-mcp-sdk'

OS-Specific MCP Servers (mcp.json)

MCP Server NameOS / RuntimeTransportCommand / Endpoint
shebang-mcp-sdkLinux / macOS (POSIX sh/Bash)stdiosh ${PLUGIN_ROOT}/bin/shebang-mcp-sdk.sh --stdio
shebang-mcp-sdk-shLinux / macOS (with jq PATH bootstrap)stdiosh ${PLUGIN_ROOT}/bin/shebang-mcp-sdk.sh --stdio
shebang-mcp-sdk-pwshWindows (PowerShell 7+)stdiopwsh -NoProfile -ExecutionPolicy Bypass -File (Join-Path $env:PLUGIN_ROOT 'bin/shebang-mcp-sdk.ps1') --stdio
shebang-mcp-sdk-powershellWindows (PowerShell 5.1)stdiopowershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $env:PLUGIN_ROOT 'bin/shebang-mcp-sdk.ps1') --stdio
shebang-mcp-sdk-httpCross-Platformstreamable-httphttp://127.0.0.1:8080/mcp

Quick Start

1. Start MCP Server (stdio mode)

  • Linux / macOS (Bash):
    ./bin/shebang-mcp-sdk.sh --stdio
    
  • Windows (PowerShell):
    pwsh -NoProfile -ExecutionPolicy Bypass -File .\bin\shebang-mcp-sdk.ps1 --stdio
    

2. Start Streamable HTTP Service

  • Linux / macOS (Bash):
    ./bin/shebang-mcp-sdk.sh --streamable-http --host 127.0.0.1 --port 8080 --listen
    
  • Windows (PowerShell):
    pwsh -NoProfile -ExecutionPolicy Bypass -File .\bin\shebang-mcp-sdk.ps1 --streamable-http --port 8080
    

3. Verify the server responds

curl -X POST http://127.0.0.1:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'

Package Structure

shebang-mcp-sdk/
+-- bin/
|   +-- mcp-sdk.sh                    # Generic Bash MCP SDK (stdio + streamable-http)
|   +-- mcp-sdk.psm1                  # Generic PowerShell MCP SDK (stdio + streamable-http)
|   +-- shebang-mcp-sdk.sh            # Bash MCP server entry point
|   +-- shebang-mcp-sdk.ps1           # PowerShell MCP server entry point
|   +-- script-runner                 # Polyglot runner (POSIX sh / Bash & PowerShell)
|   +-- script-runner.sh              # Polyglot runner (.sh entry point)
|   +-- script-runner.ps1             # Polyglot runner (.ps1 entry point)
|   +-- script-runner.cmd             # Windows CMD launcher -> script-runner.ps1
|   +-- package-mcpb.sh               # MCPB bundle builder (POSIX sh)
|   +-- package-mcpb.ps1              # MCPB bundle builder (PowerShell)
+-- packaging/mcpb/
|   +-- manifest.sh.json              # MCPB manifest (Bash edition)
|   +-- manifest.pwsh.json            # MCPB manifest (PowerShell edition)
|   +-- mcp.template.json             # MCP server config template
+-- skills/shebang-mcp-builder/       # Agent Skills discovery mirror
|   +-- SKILL.md                      # Skill metadata & instructions
|   +-- references/
|   |   +-- spec-template.md
|   |   +-- checklist.md
|   +-- scripts/
|       +-- setup-sdk.{sh,ps1}        # SDK setup & info script
+-- io.github.sheldonrobinson.shebang-mcp-builder/  # Client extension hooks & commands
|   +-- hooks/
|   |   +-- hooks.json
|   |   +-- stop-hook.{sh,ps1}
|   +-- commands/
|       +-- sdk-help.md
+-- plugin.json                       # Agent Plugins v1.0.0 manifest
+-- mcp.json                          # MCP Server configurations
+-- server.json                       # Official MCP Registry manifest
+-- package.sh                        # Basher install script and BINS/DEPS metadata
+-- LICENSE
+-- README.md

Consumer Extension

The SDK is generic — consumers extend it by defining global functions:

  • Bash: handle_list_tools, handle_tools_call, mcp_custom_method_handler
  • PowerShell: Handle-ListTools, Handle-ToolsCall, Invoke-McpCustomMethod

Optional resources and prompts use the dedicated handle_list_resources / handle_read_resource and handle_list_prompts / handle_get_prompt handlers (or their PowerShell equivalents). The core advertises the corresponding capabilities only when consumers provide those handlers; they are not automatic features of every generic server.

See skills/shebang-mcp-builder/SKILL.md for the full consumer extension guide.

MCP Builder Skill Integration

The Shebang MCP SDK is designed to work with the MCP Builder Skill — a skill for creating high-quality MCP servers that enable LLMs to interact with external services through well-designed tools.

The MCP Builder Skill (from anthropics/skills) provides guidance for building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). With the Shebang MCP SDK, you can apply the same MCP Builder principles to shell-based MCP servers:

  • Define tool handlers (handle_list_tools / handle_tools_call) following MCP Builder patterns
  • Use mcp_custom_method_handler for custom protocol methods
  • Register cleanup hooks via mcp_register_cleanup / Register-McpCleanup
  • Package as MCPB bundles for distribution via the Official MCP Registry

See bin/package-mcpb.sh / bin/package-mcpb.ps1 for building distributable .mcpb packages.

Links

License

MIT

MCPB
https://github.com/sheldonrobinson/shebang-mcp-sdk/releases/download/v1.0.0/shebang-mcp-sdk.sh.mcpb
Install Command
# mcpb: https://github.com/sheldonrobinson/shebang-mcp-sdk/releases/download/v1.0.0/shebang-mcp-sdk.sh.mcpb
Runtime: sh
MCPB
https://github.com/sheldonrobinson/shebang-mcp-sdk/releases/download/v1.0.0/shebang-mcp-sdk.pwsh.mcpb
Install Command
# mcpb: https://github.com/sheldonrobinson/shebang-mcp-sdk/releases/download/v1.0.0/shebang-mcp-sdk.pwsh.mcpb
Runtime: pwsh