Bash Sdk
БесплатноНе проверенMCP server SDK/example implemented entirely in bash — build a Model Context Protocol server with no runtime dependency beyond a POSIX shell.
Описание
MCP server SDK/example implemented entirely in bash — build a Model Context Protocol server with no runtime dependency beyond a POSIX shell.
README
A lightweight, zero-overhead implementation of the Model Context Protocol (MCP) server in pure Bash.
Why? Most MCP servers are just API wrappers with schema conversion. This implementation provides a zero-overhead alternative to Node.js, Python, or other heavy runtimes.
📋 Features
- ✅ Full JSON-RPC 2.0 protocol over stdio
- ✅ Complete MCP protocol implementation
- ✅ Dynamic tool discovery via function naming convention
- ✅ External configuration via JSON files
- ✅ Easy to extend with custom tools
🔧 Requirements
- Bash shell
jqfor JSON processing (brew install jqon macOS)
🚀 Quick Start
- Clone the repo
git clone https://github.com/muthuishere/mcp-server-bash-sdk
cd mcp-server-bash-sdk
- Make scripts executable
chmod +x mcpserver_core.sh moviemcpserver.sh
- Try it out
echo '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "get_movies"}, "id": 1}' | ./moviemcpserver.sh
🏗️ Architecture
┌─────────────┐ ┌────────────────────────┐
│ MCP Host │ │ MCP Server │
│ (AI System) │◄──────► │ (moviemcpserver.sh) │
└─────────────┘ stdio └────────────────────────┘
│
┌───────┴──────────┐
▼ ▼
┌───────────────────┐ ┌───────────────┐
│ Protocol Layer │ │ Business Logic│
│(mcpserver_core.sh)│ │(tool_* funcs) │
└───────────────────┘ └───────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌───────────────┐
│ Configuration │ │ External │
│ (JSON Files) │ │ Services/APIs │
└─────────────────┘ └───────────────┘
- mcpserver_core.sh: Handles JSON-RPC and MCP protocol
- moviemcpserver.sh: Contains business logic functions
- assets/: JSON configuration files
🔌 Creating Your Own MCP Server
Tool Function Guidelines
When implementing tool functions for the MCP server, follow these guidelines:
- Naming Convention: All tool functions must be prefixed with
tool_followed by the same name defined in tools_list.json - Parameters: Each function should accept a single parameter
$1containing JSON arguments - Success Pattern: For successful operations, echo the result and return 0
- Error Pattern: For validation errors, echo an error message and return 1
- Automatic Discovery: All tool functions are automatically exposed to the MCP server based on tools_list.json
Implementation Steps
- Create your business logic file (e.g.,
weatherserver.sh)
#!/bin/bash
# Weather API implementation
# Override configuration paths BEFORE sourcing the core
MCP_CONFIG_FILE="$(dirname "${BASH_SOURCE[0]}")/assets/weatherserver_config.json"
MCP_TOOLS_LIST_FILE="$(dirname "${BASH_SOURCE[0]}")/assets/weatherserver_tools.json"
MCP_LOG_FILE="$(dirname "${BASH_SOURCE[0]}")/logs/weatherserver.log"
# MCP Server Tool Function Guidelines:
# 1. Name all tool functions with prefix "tool_" followed by the same name defined in tools_list.json
# 2. Function should accept a single parameter "$1" containing JSON arguments
# 3. For successful operations: Echo the expected result and return 0
# 4. For errors: Echo an error message and return 1
# 5. All tool functions are automatically exposed to the MCP server based on tools_list.json
# Source the core MCP server implementation
source "$(dirname "${BASH_SOURCE[0]}")/mcpserver_core.sh"
# Access environment variables
API_KEY="${MCP_API_KEY:-default_key}"
# Tool: Get current weather for a location
# Parameters: Takes a JSON object with location
# Success: Echo JSON result and return 0
# Error: Echo error message and return 1
tool_get_weather() {
local args="$1"
local location=$(echo "$args" | jq -r '.location')
# Parameter validation
if [[ -z "$location" ]]; then
echo "Missing required parameter: location"
return 1
fi
# Call external API
local weather=$(curl -s "https://api.example.com/weather?location=$location&apikey=$API_KEY")
echo "$weather"
return 0
}
# Start the MCP server
run_mcp_server "$@"
- Create
assets/weatherserver_tools.json
{
"tools": [
{
"name": "get_weather",
"description": "Get current weather for a location",
"inputSchema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name or coordinates"
}
},
"required": ["location"]
}
}
]
}
- Create
assets/weatherserver_config.json
{
"protocolVersion": "2025-03-26",
"serverInfo": {
"name": "WeatherServer",
"version": "1.0.0"
},
"capabilities": {
"tools": {
"listChanged": true
}
},
"instructions": "This server provides weather information."
}
- Make your file executable
chmod +x weatherserver.sh
🖥️ Using with VS Code & GitHub Copilot
- Update VS Code settings.json
"mcp": {
"servers": {
"my-weather-server": {
"type": "stdio",
"command": "/path/to/your/weatherserver.sh",
"args": [],
"env": {
"MCP_API_KEY": "your-api-key"
}
}
}
}
- Use with GitHub Copilot Chat
/mcp my-weather-server get weather for New York
🚫 Limitations
- No concurrency/parallel processing
- Limited memory management
- No streaming responses
- Not designed for high throughput
For AI assistants and local tool execution, these aren't blocking issues.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Blog : https://medium.com/@muthuishere/why-i-built-an-mcp-server-sdk-in-shell-yes-bash-6f2192072279
Community
Questions, ideas, or built something with this? Join AgentNexus — a Discord for people building with AI agents and open tools. This project lives in #mcp-bash-sdk.
Установка Bash Sdk
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/muthuishere/mcp-server-bash-sdkFAQ
Bash Sdk MCP бесплатный?
Да, Bash Sdk MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Bash Sdk?
Нет, Bash Sdk работает без API-ключей и переменных окружения.
Bash Sdk — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Bash Sdk в Claude Desktop, Claude Code или Cursor?
Открой Bash Sdk на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Bash Sdk with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
