any-script-mcp
Enables execution of arbitrary CLI tools and shell scripts by defining them in YAML configuration files as MCP Tools. Supports custom shells (bash, Python, Node.js, Deno), input parameters passed as environment variables, and flexible timeout settings.
README
any-script-mcp
An MCP server that exposes arbitrary CLI tools and shell scripts as MCP Tools
Overview
An MCP server that publishes commands defined in YAML files as MCP Tools. By defining tools in a configuration file, you can execute arbitrary shell scripts from MCP clients.
Installation
npx
Claude Code:
$ claude mcp add any-script \
-s user \
-- npx any-script-mcp
json:
{
"mcpServers": {
"any-script": {
"command": "npx",
"args": ["any-script-mcp"]
}
}
}
Configuration
Create a configuration file at $XDG_CONFIG_HOME/any-script-mcp/config.yaml (typically ~/.config/any-script-mcp/config.yaml).
You can also specify custom configuration file paths using the ANY_SCRIPT_MCP_CONFIG environment variable:
# Single configuration file
$ ANY_SCRIPT_MCP_CONFIG=/path/to/custom/config.yaml npx any-script-mcp
# Multiple configuration files (Unix/macOS - separated by colon)
$ ANY_SCRIPT_MCP_CONFIG=/path/to/custom.yaml:$XDG_CONFIG_HOME/any-script-mcp/config.yaml npx any-script-mcp
# Multiple configuration files (Windows - separated by semicolon)
$ ANY_SCRIPT_MCP_CONFIG=C:\path\to\custom.yaml;%APPDATA%\any-script-mcp\config.yaml npx any-script-mcp
When multiple configuration files are specified:
- All tools from all files are merged into a single collection
- If the same tool name appears in multiple files, the first occurrence takes precedence
- At least one valid configuration file must be successfully loaded
- This is useful for separating common tools from project-specific or personal customizations
Testing Your Configuration
You can test your configuration using the MCP Inspector:
$ npx @modelcontextprotocol/inspector npx any-script-mcp
This will open a web interface where you can see your registered tools and test them interactively.
Example Configuration
# yaml-language-server: $schema=https://raw.githubusercontent.com/izumin5210/any-script-mcp/main/config.schema.json
tools:
- name: echo
description: Echo a message
inputs:
message:
type: string
description: Message to echo
run: |
echo "Received: $INPUTS__MESSAGE"
- name: git_status
description: Check git status with optional branch
inputs:
branch-name:
type: string
description: Branch to check out
required: false
verbose:
type: boolean
description: Show verbose output
default: false
run: |
if [ -n "${INPUTS__BRANCH_NAME:-}" ]; then
git checkout "$INPUTS__BRANCH_NAME"
fi
if [ "$INPUTS__VERBOSE" = "true" ]; then
git status -v
else
git status
fi
# Delegate search to codex CLI. Inspired by https://github.com/yoshiko-pg/o3-search-mcp
- name: codex-search
description: AI agent with web search for researching latest information, troubleshooting program errors, discussing complex problems and design decisions, exploring advanced library usage, and investigating upgrade paths. Supports natural language queries.
inputs:
prompt:
type: string
description: What you want to search, analyze, or discuss with the AI agent
run: |
codex exec \
--model gpt-5 \
--sandbox workspace-write \
--config "sandbox_workspace_write.network_access=true" \
"$INPUTS__PROMPT" \
--json \
| jq -sr 'map(select(.msg.type == "agent_message") | .msg.message) | last'
timeout: 600000 # 10 minutes for complex AI operations
- name: build
description: Run build process with tests
run: |
npm run build
npm test
timeout: 180000 # 3 minutes for build and test
Configuration Format
Tool Definition
Each tool has the following fields:
name: Tool name (alphanumeric, underscore, and hyphen only)description: Tool descriptioninputs: Input parameter definitions (object format)run: Shell script to executeshell: Shell command to execute the script (optional, default:"bash -e {0}")timeout: Execution timeout in milliseconds (optional, default: 300000 = 5 minutes)
Input Parameters
Each input parameter has the following fields:
type: Parameter type (string,number,boolean)description: Parameter descriptionrequired: Whether the parameter is required (default:true)default: Default value (optional)
Input parameters are passed as environment variables to shell scripts in two ways:
Individual Environment Variables
Variable names have the INPUTS__ prefix and are converted to uppercase (hyphens are converted to underscores).
Examples:
message→$INPUTS__MESSAGEbranch-name→$INPUTS__BRANCH_NAME
JSON Format (INPUTS_JSON)
All inputs are also available as a single JSON object in the INPUTS_JSON environment variable. This preserves type information, making it easier to work with non-shell interpreters.
Example usage:
// Node.js
const inputs = JSON.parse(process.env.INPUTS_JSON);
console.log(inputs.num * 2); // count is a number, not a string
Shell Option
The shell option allows you to specify a custom shell or interpreter for executing scripts. The {0} placeholder is replaced with the path to the temporary script file.
Default: "bash -e {0}"
Examples:
# yaml-language-server: $schema=https://raw.githubusercontent.com/izumin5210/any-script-mcp/main/config.schema.json
tools:
# Python script
- name: python_analysis
description: Analyze data with Python
shell: "python {0}"
inputs:
data:
type: string
description: Data to analyze
run: |
import os
import json
data = os.environ['INPUTS__DATA']
# Process data with Python
result = {"analysis": f"Processed: {data}"}
print(json.dumps(result))
# Deno script
- name: deno_fetch
description: Fetch data with Deno
shell: "deno run --allow-net {0}"
inputs:
endpoint:
type: string
description: API endpoint
run: |
const endpoint = Deno.env.get("INPUTS__ENDPOINT");
const response = await fetch(endpoint);
console.log(await response.json());
# Using INPUTS_JSON for type preservation
- name: add_2
description: add 2 to a number
shell: "node {0}"
inputs:
num:
type: number
description: a number to add 2 to
run: |
const inputs = JSON.parse(process.env.INPUTS_JSON);
console.log(inputs.num + 2); // number is a number, not a string
Advanced Examples - AI Agents with Web Search
# yaml-language-server: $schema=https://raw.githubusercontent.com/izumin5210/any-script-mcp/main/config.schema.json
tools:
- name: gemini-search
description: AI agent with web search using Gemini 2.5 Flash
shell: "deno run -N -E {0}"
inputs:
query:
type: string
description: Query for AI search
required: true
run: |
import { GoogleGenAI } from "npm:@google/genai@^1";
const inputs = JSON.parse(Deno.env.get("INPUTS_JSON"));
const ai = new GoogleGenAI({ apiKey: Deno.env.get("GEMINI_API_KEY") });
const res = await ai.models.generateContent({
model: "gemini-2.5-flash",
contents: inputs.query,
config: {
tools: [{ googleSearch: {} }],
systemInstruction: "...",
},
});
console.log(
res.candidates?.[0]?.content?.parts?.map((p) => p.text ?? "").join(""),
);
- name: gpt-5-search
description: AI agent with web search using GPT-5
shell: "deno run -N -E {0}"
inputs:
query:
type: string
description: Query for AI search
required: true
run: |
import OpenAI from "jsr:@openai/openai";
const inputs = JSON.parse(Deno.env.get("INPUTS_JSON"));
const client = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY") });
const res = await client.responses.create({
model: "gpt-5",
tools: [{ type: "web_search_preview" }],
input: inputs.query,
instructions: "...",
});
console.log(res.output_text);
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
