[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"tool-mark3labs--mcphost":3,"similar-mark3labs--mcphost":180},{"id":4,"github_repo":5,"name":6,"description_en":7,"description_zh":8,"ai_summary_zh":9,"readme_en":10,"readme_zh":11,"quickstart_zh":12,"use_case_zh":13,"hero_image_url":14,"owner_login":15,"owner_name":16,"owner_avatar_url":17,"owner_bio":18,"owner_company":18,"owner_location":18,"owner_email":18,"owner_twitter":18,"owner_website":19,"owner_url":20,"languages":21,"stars":30,"forks":31,"last_commit_at":32,"license":33,"difficulty_score":34,"env_os":35,"env_gpu":36,"env_ram":36,"env_deps":37,"category_tags":42,"github_topics":18,"view_count":34,"oss_zip_url":18,"oss_zip_packed_at":18,"status":46,"created_at":47,"updated_at":48,"faqs":49,"releases":79},6287,"mark3labs\u002Fmcphost","mcphost","A CLI host application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP).","mcphost 是一款基于命令行的主机应用，旨在通过模型上下文协议（MCP）搭建大语言模型与外部工具之间的桥梁。它解决了当前大模型难以安全、统一地调用本地资源或第三方服务的痛点，让 AI 不仅能“对话”，还能实际执行文件操作、运行脚本或获取实时数据。\n\n这款工具特别适合开发者、技术研究人员以及希望构建自动化工作流的进阶用户。无论是需要调试 MCP 服务器的工程师，还是希望将 AI 能力集成到现有脚本系统中的运维人员，都能从中受益。mcphost 兼容主流模型，包括 Claude、OpenAI、Google Gemini 以及本地部署的 Ollama，确保了极高的灵活性。\n\n其核心技术亮点在于完善的架构设计与丰富的功能集：支持同时连接多个 MCP 服务器，并提供精细的工具过滤机制以保障安全；内置文件系统、Bash 执行等常用服务，无需额外配置即可上手；独有的钩子（Hooks）系统允许用户自定义集成逻辑与安全策略；此外，它还支持非交互模式和基于 YAML 的脚本自动化，非常适合融入 CI\u002FCD 流程或编写复杂的自动化任务。通过 mcphost，用户可以轻松构建一个既能理解自然语言指令，又能","mcphost 是一款基于命令行的主机应用，旨在通过模型上下文协议（MCP）搭建大语言模型与外部工具之间的桥梁。它解决了当前大模型难以安全、统一地调用本地资源或第三方服务的痛点，让 AI 不仅能“对话”，还能实际执行文件操作、运行脚本或获取实时数据。\n\n这款工具特别适合开发者、技术研究人员以及希望构建自动化工作流的进阶用户。无论是需要调试 MCP 服务器的工程师，还是希望将 AI 能力集成到现有脚本系统中的运维人员，都能从中受益。mcphost 兼容主流模型，包括 Claude、OpenAI、Google Gemini 以及本地部署的 Ollama，确保了极高的灵活性。\n\n其核心技术亮点在于完善的架构设计与丰富的功能集：支持同时连接多个 MCP 服务器，并提供精细的工具过滤机制以保障安全；内置文件系统、Bash 执行等常用服务，无需额外配置即可上手；独有的钩子（Hooks）系统允许用户自定义集成逻辑与安全策略；此外，它还支持非交互模式和基于 YAML 的脚本自动化，非常适合融入 CI\u002FCD 流程或编写复杂的自动化任务。通过 mcphost，用户可以轻松构建一个既能理解自然语言指令，又能精准操控外部环境的智能代理系统。","# MCPHost 🤖\n\nA CLI host application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP). Currently supports Claude, OpenAI, Google Gemini, and Ollama models.\n\nDiscuss the Project on [Discord](https:\u002F\u002Fdiscord.gg\u002FRqSS2NQVsY)\n\n## Table of Contents\n\n- [Overview](#overview-)\n- [Features](#features-)\n- [Requirements](#requirements-)\n- [Environment Setup](#environment-setup-)\n- [Installation](#installation-)\n- [SDK Usage](#sdk-usage-)\n- [Configuration](#configuration-)\n  - [MCP Servers](#mcp-servers)\n  - [Environment Variable Substitution](#environment-variable-substitution)\n  - [Simplified Configuration Schema](#simplified-configuration-schema)\n  - [Tool Filtering](#tool-filtering)\n  - [Legacy Configuration Support](#legacy-configuration-support)\n  - [Transport Types](#transport-types)\n  - [System Prompt](#system-prompt)\n- [Usage](#usage-)\n  - [Interactive Mode](#interactive-mode-default)\n  - [Script Mode](#script-mode)\n  - [Hooks System](#hooks-system)\n  - [Non-Interactive Mode](#non-interactive-mode)\n  - [Model Generation Parameters](#model-generation-parameters)\n  - [Available Models](#available-models)\n  - [Examples](#examples)\n  - [Flags](#flags)\n  - [Authentication Subcommands](#authentication-subcommands)\n  - [Configuration File Support](#configuration-file-support)\n  - [Interactive Commands](#interactive-commands)\n- [Automation & Scripting](#automation--scripting-)\n- [MCP Server Compatibility](#mcp-server-compatibility-)\n- [Contributing](#contributing-)\n- [License](#license-)\n- [Acknowledgments](#acknowledgments-)\n\n## Overview 🌟\n\nMCPHost acts as a host in the MCP client-server architecture, where:\n- **Hosts** (like MCPHost) are LLM applications that manage connections and interactions\n- **Clients** maintain 1:1 connections with MCP servers\n- **Servers** provide context, tools, and capabilities to the LLMs\n\nThis architecture allows language models to:\n- Access external tools and data sources 🛠️\n- Maintain consistent context across interactions 🔄\n- Execute commands and retrieve information safely 🔒\n\nCurrently supports:\n- Anthropic Claude models (Claude 3.5 Sonnet, Claude 3.5 Haiku, etc.)\n- OpenAI models (GPT-4, GPT-4 Turbo, GPT-3.5, etc.)\n- Google Gemini models (Gemini 2.0 Flash, Gemini 1.5 Pro, etc.)\n- Any Ollama-compatible model with function calling support\n- Any OpenAI-compatible API endpoint\n\n## Features ✨\n\n- Interactive conversations with multiple AI models\n- **Non-interactive mode** for scripting and automation\n- **Script mode** for executable YAML-based automation scripts\n- Support for multiple concurrent MCP servers\n- **Tool filtering** with `allowedTools` and `excludedTools` per server\n- Dynamic tool discovery and integration\n- Tool calling capabilities across all supported models\n- Configurable MCP server locations and arguments\n- Consistent command interface across model types\n- Configurable message history window for context management\n- **OAuth authentication** support for Anthropic (alternative to API keys)\n- **Hooks system** for custom integrations and security policies\n- **Environment variable substitution** in configs and scripts\n- **Builtin servers** for common functionality (filesystem, bash, todo, http)\n\n## Requirements 📋\n\n- Go 1.23 or later\n- For OpenAI\u002FAnthropic: API key for the respective provider\n- For Ollama: Local Ollama installation with desired models\n- For Google\u002FGemini: Google API key (see https:\u002F\u002Faistudio.google.com\u002Fapp\u002Fapikey)\n- One or more MCP-compatible tool servers\n\n## Environment Setup 🔧\n\n1. API Keys:\n```bash\n# For all providers (use --provider-api-key flag or these environment variables)\nexport OPENAI_API_KEY='your-openai-key'        # For OpenAI\nexport ANTHROPIC_API_KEY='your-anthropic-key'  # For Anthropic\nexport GOOGLE_API_KEY='your-google-key'        # For Google\u002FGemini\n```\n\n2. Ollama Setup:\n- Install Ollama from https:\u002F\u002Follama.ai\n- Pull your desired model:\n```bash\nollama pull mistral\n```\n- Ensure Ollama is running:\n```bash\nollama serve\n```\n\nYou can also configure the Ollama client using standard environment variables, such as `OLLAMA_HOST` for the Ollama base URL.\n\n3. Google API Key (for Gemini):\n```bash\nexport GOOGLE_API_KEY='your-api-key'\n```\n\n4. OpenAI Compatible Setup:\n- Get your API server base URL, API key and model name\n- Use `--provider-url` and `--provider-api-key` flags or set environment variables\n\n5. Self-Signed Certificates (TLS):\nIf your provider uses self-signed certificates (e.g., local Ollama with HTTPS), you can skip certificate verification:\n```bash\nmcphost --provider-url https:\u002F\u002F192.168.1.100:443 --tls-skip-verify\n```\n⚠️ **WARNING**: Only use `--tls-skip-verify` for development or when connecting to trusted servers with self-signed certificates. This disables TLS certificate verification and is insecure for production use.\n\n## Installation 📦\n\n```bash\ngo install github.com\u002Fmark3labs\u002Fmcphost@latest\n```\n\n## SDK Usage 🛠️\n\nMCPHost also provides a Go SDK for programmatic access without spawning OS processes. The SDK maintains identical behavior to the CLI, including configuration loading, environment variables, and defaults.\n\n### Quick Example\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"github.com\u002Fmark3labs\u002Fmcphost\u002Fsdk\"\n)\n\nfunc main() {\n    ctx := context.Background()\n    \n    \u002F\u002F Create MCPHost instance with default configuration\n    host, err := sdk.New(ctx, nil)\n    if err != nil {\n        panic(err)\n    }\n    defer host.Close()\n    \n    \u002F\u002F Send a prompt and get response\n    response, err := host.Prompt(ctx, \"What is 2+2?\")\n    if err != nil {\n        panic(err)\n    }\n    \n    fmt.Println(response)\n}\n```\n\n### SDK Features\n\n- ✅ Programmatic access without spawning processes\n- ✅ Identical configuration behavior to CLI\n- ✅ Session management (save\u002Fload\u002Fclear)\n- ✅ Tool execution callbacks for monitoring\n- ✅ Streaming support\n- ✅ Full compatibility with all providers and MCP servers\n\nFor detailed SDK documentation, examples, and API reference, see the [SDK README](sdk\u002FREADME.md).\n\n## Configuration ⚙️\n\n### MCP Servers\nMCPHost will automatically create a configuration file in your home directory if it doesn't exist. It looks for config files in this order:\n- `.mcphost.yml` or `.mcphost.json` (preferred)\n- `.mcp.yml` or `.mcp.json` (backwards compatibility)\n\n**Config file locations by OS:**\n- **Linux\u002FmacOS**: `~\u002F.mcphost.yml`, `~\u002F.mcphost.json`, `~\u002F.mcp.yml`, `~\u002F.mcp.json`\n- **Windows**: `%USERPROFILE%\\.mcphost.yml`, `%USERPROFILE%\\.mcphost.json`, `%USERPROFILE%\\.mcp.yml`, `%USERPROFILE%\\.mcp.json`\n\nYou can also specify a custom location using the `--config` flag.\n\n### Environment Variable Substitution\n\nMCPHost supports environment variable substitution in both config files and script frontmatter using the syntax:\n- **`${env:\u002F\u002FVAR}`** - Required environment variable (fails if not set)\n- **`${env:\u002F\u002FVAR:-default}`** - Optional environment variable with default value\n\nThis allows you to keep sensitive information like API keys in environment variables while maintaining flexible configuration.\n\n**Example:**\n```yaml\nmcpServers:\n  github:\n    type: local\n    command: [\"docker\", \"run\", \"-i\", \"--rm\", \"-e\", \"GITHUB_PERSONAL_ACCESS_TOKEN=${env:\u002F\u002FGITHUB_TOKEN}\", \"ghcr.io\u002Fgithub\u002Fgithub-mcp-server\"]\n    environment:\n      DEBUG: \"${env:\u002F\u002FDEBUG:-false}\"\n      LOG_LEVEL: \"${env:\u002F\u002FLOG_LEVEL:-info}\"\n\nmodel: \"${env:\u002F\u002FMODEL:-anthropic\u002Fclaude-sonnet-4-5-20250929}\"\nprovider-api-key: \"${env:\u002F\u002FOPENAI_API_KEY}\"  # Required - will fail if not set\n```\n\n**Usage:**\n```bash\n# Set required environment variables\nexport GITHUB_TOKEN=\"ghp_your_token_here\"\nexport OPENAI_API_KEY=\"your_openai_key\"\n\n# Optionally override defaults\nexport DEBUG=\"true\"\nexport MODEL=\"openai\u002Fgpt-4\"\n\n# Run mcphost\nmcphost\n```\n\n### Simplified Configuration Schema\n\nMCPHost now supports a simplified configuration schema with three server types:\n\n#### Local Servers\nFor local MCP servers that run commands on your machine:\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"type\": \"local\",\n      \"command\": [\"npx\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"${env:\u002F\u002FWORK_DIR:-\u002Ftmp}\"],\n      \"environment\": {\n        \"DEBUG\": \"${env:\u002F\u002FDEBUG:-false}\",\n        \"LOG_LEVEL\": \"${env:\u002F\u002FLOG_LEVEL:-info}\",\n        \"API_TOKEN\": \"${env:\u002F\u002FFS_API_TOKEN}\"\n      },\n      \"allowedTools\": [\"read_file\", \"write_file\"],\n      \"excludedTools\": [\"delete_file\"]\n    },\n    \"github\": {\n      \"type\": \"local\",\n      \"command\": [\"docker\", \"run\", \"-i\", \"--rm\", \"-e\", \"GITHUB_PERSONAL_ACCESS_TOKEN=${env:\u002F\u002FGITHUB_TOKEN}\", \"ghcr.io\u002Fgithub\u002Fgithub-mcp-server\"],\n      \"environment\": {\n        \"DEBUG\": \"${env:\u002F\u002FDEBUG:-false}\"\n      }\n    },\n    \"sqlite\": {\n      \"type\": \"local\",\n      \"command\": [\"uvx\", \"mcp-server-sqlite\", \"--db-path\", \"${env:\u002F\u002FDB_PATH:-\u002Ftmp\u002Ffoo.db}\"],\n      \"environment\": {\n        \"SQLITE_DEBUG\": \"${env:\u002F\u002FDEBUG:-0}\",\n        \"DATABASE_URL\": \"${env:\u002F\u002FDATABASE_URL:-sqlite:\u002F\u002F\u002Ftmp\u002Ffoo.db}\"\n      }\n    }\n  }\n}\n```\n\nEach local server entry requires:\n- `type`: Must be set to `\"local\"`\n- `command`: Array containing the command and all its arguments\n- `environment`: (Optional) Object with environment variables as key-value pairs\n- `allowedTools`: (Optional) Array of tool names to include (whitelist)\n- `excludedTools`: (Optional) Array of tool names to exclude (blacklist)\n\n#### Remote Servers\nFor remote MCP servers accessible via HTTP:\n```json\n{\n  \"mcpServers\": {\n    \"websearch\": {\n      \"type\": \"remote\",\n      \"url\": \"${env:\u002F\u002FWEBSEARCH_URL:-https:\u002F\u002Fapi.example.com\u002Fmcp}\",\n      \"headers\": [\"Authorization: Bearer ${env:\u002F\u002FWEBSEARCH_TOKEN}\"]\n    },\n    \"weather\": {\n      \"type\": \"remote\", \n      \"url\": \"${env:\u002F\u002FWEATHER_URL:-https:\u002F\u002Fweather-mcp.example.com}\"\n    }\n  }\n}\n```\n\nEach remote server entry requires:\n- `type`: Must be set to `\"remote\"`\n- `url`: The URL where the MCP server is accessible\n- `headers`: (Optional) Array of HTTP headers for authentication and custom headers\n\nRemote servers automatically use the StreamableHTTP transport for optimal performance.\n\n#### Builtin Servers\nFor builtin MCP servers that run in-process for optimal performance:\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\",\n      \"options\": {\n        \"allowed_directories\": [\"${env:\u002F\u002FWORK_DIR:-\u002Ftmp}\", \"${env:\u002F\u002FHOME}\u002Fdocuments\"]\n      },\n      \"allowedTools\": [\"read_file\", \"write_file\", \"list_directory\"]\n    },\n    \"filesystem-cwd\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\"\n    }\n  }\n}\n```\n\nEach builtin server entry requires:\n- `type`: Must be set to `\"builtin\"`\n- `name`: Internal name of the builtin server (e.g., `\"fs\"` for filesystem)\n- `options`: Configuration options specific to the builtin server\n\n**Available Builtin Servers:**\n- `fs` (filesystem): Secure filesystem access with configurable allowed directories\n  - `allowed_directories`: Array of directory paths that the server can access (defaults to current working directory if not specified)\n- `bash`: Execute bash commands with security restrictions and timeout controls\n  - No configuration options required\n- `todo`: Manage ephemeral todo lists for task tracking during sessions\n  - No configuration options required (todos are stored in memory and reset on restart)\n- `http`: Fetch web content and convert to text, markdown, or HTML formats\n  - Tools: `fetch` (fetch and convert web content), `fetch_summarize` (fetch and summarize web content using AI), `fetch_extract` (fetch and extract specific data using AI), `fetch_filtered_json` (fetch JSON and filter using gjson path syntax)\n  - No configuration options required\n\n#### Builtin Server Examples\n\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\",\n      \"options\": {\n        \"allowed_directories\": [\"\u002Ftmp\", \"\u002Fhome\u002Fuser\u002Fdocuments\"]\n      }\n    },\n    \"bash-commands\": {\n      \"type\": \"builtin\", \n      \"name\": \"bash\"\n    },\n    \"task-manager\": {\n      \"type\": \"builtin\",\n      \"name\": \"todo\"\n    },\n    \"web-fetcher\": {\n      \"type\": \"builtin\",\n      \"name\": \"http\"\n    }\n  }\n}\n```\n\n### Tool Filtering\n\nAll MCP server types support tool filtering to restrict which tools are available:\n\n- **`allowedTools`**: Whitelist - only specified tools are available from the server\n- **`excludedTools`**: Blacklist - all tools except specified ones are available\n\n```json\n{\n  \"mcpServers\": {\n    \"filesystem-readonly\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\",\n      \"allowedTools\": [\"read_file\", \"list_directory\"]\n    },\n    \"filesystem-safe\": {\n      \"type\": \"local\", \n      \"command\": [\"npx\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"\u002Ftmp\"],\n      \"excludedTools\": [\"delete_file\"]\n    }\n  }\n}\n```\n\n**Note**: `allowedTools` and `excludedTools` are mutually exclusive - you can only use one per server.\n\n### Legacy Configuration Support\n\nMCPHost maintains full backward compatibility with the previous configuration format. **Note**: A recent bug fix improved legacy stdio transport reliability for external MCP servers (Docker, NPX, etc.).\n\n#### Legacy STDIO Format\n```json\n{\n  \"mcpServers\": {\n    \"sqlite\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-server-sqlite\", \"--db-path\", \"\u002Ftmp\u002Ffoo.db\"],\n      \"env\": {\n        \"DEBUG\": \"true\"\n      }\n    }\n  }\n}\n```\n\n#### Legacy SSE Format\n```json\n{\n  \"mcpServers\": {\n    \"server_name\": {\n      \"url\": \"http:\u002F\u002Fsome_host:8000\u002Fsse\",\n      \"headers\": [\"Authorization: Bearer my-token\"]\n    }\n  }\n}\n```\n\n#### Legacy Docker\u002FContainer Format\n```json\n{\n  \"mcpServers\": {\n    \"phalcon\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"ghcr.io\u002Fmark3labs\u002Fphalcon-mcp:latest\",\n        \"serve\"\n      ]\n    }\n  }\n}\n```\n\n#### Legacy Streamable HTTP Format\n```json\n{\n  \"mcpServers\": {\n    \"websearch\": {\n      \"transport\": \"streamable\",\n      \"url\": \"https:\u002F\u002Fapi.example.com\u002Fmcp\",\n      \"headers\": [\"Authorization: Bearer your-api-token\"]\n    }\n  }\n}\n```\n\n### Transport Types\n\nMCPHost supports four transport types:\n- **`stdio`**: Launches a local process and communicates via stdin\u002Fstdout (used by `\"local\"` servers)\n- **`sse`**: Connects to a server using Server-Sent Events (legacy format)\n- **`streamable`**: Connects to a server using Streamable HTTP protocol (used by `\"remote\"` servers)\n- **`inprocess`**: Runs builtin servers in-process for optimal performance (used by `\"builtin\"` servers)\n\nThe simplified schema automatically maps:\n- `\"local\"` type → `stdio` transport\n- `\"remote\"` type → `streamable` transport\n- `\"builtin\"` type → `inprocess` transport\n\n### System Prompt\n\nYou can specify a custom system prompt using the `--system-prompt` flag. You can either:\n\n1. **Pass the prompt directly as text:**\n   ```bash\n   mcphost --system-prompt \"You are a helpful assistant that responds in a friendly tone.\"\n   ```\n\n2. **Pass a path to a text file containing the prompt:**\n   ```bash\n   mcphost --system-prompt .\u002Fprompts\u002Fassistant.md\n   ```\n\n   Example `assistant.md` file:\n   ```markdown\n   You are a helpful coding assistant. \n   \n   Please:\n   - Write clean, readable code\n   - Include helpful comments\n   - Follow best practices\n   - Explain your reasoning\n   ```\n\n\n## Usage 🚀\n\nMCPHost is a CLI tool that allows you to interact with various AI models through a unified interface. It supports various tools through MCP servers and can run in both interactive and non-interactive modes.\n\n### Interactive Mode (Default)\n\nStart an interactive conversation session:\n\n```bash\nmcphost\n```\n\n### Script Mode\n\nRun executable YAML-based automation scripts with variable substitution support:\n\n```bash\n# Using the script subcommand\nmcphost script myscript.sh\n\n# With variables\nmcphost script myscript.sh --args:directory \u002Ftmp --args:name \"John\"\n\n# Direct execution (if executable and has shebang)\n.\u002Fmyscript.sh\n```\n\n#### Script Format\n\nScripts combine YAML configuration with prompts in a single executable file. The configuration must be wrapped in frontmatter delimiters (`---`). You can either include the prompt in the YAML configuration or place it after the closing frontmatter delimiter:\n\n```yaml\n#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script\n---\n# This script uses the container-use MCP server from https:\u002F\u002Fgithub.com\u002Fdagger\u002Fcontainer-use\nmcpServers:\n  container-use:\n    type: \"local\"\n    command: [\"cu\", \"stdio\"]\nprompt: |\n  Create 2 variations of a simple hello world app using Flask and FastAPI. \n  Each in their own environment. Give me the URL of each app\n---\n```\n\nOr alternatively, omit the `prompt:` field and place the prompt after the frontmatter:\n\n```yaml\n#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script\n---\n# This script uses the container-use MCP server from https:\u002F\u002Fgithub.com\u002Fdagger\u002Fcontainer-use\nmcpServers:\n  container-use:\n    type: \"local\"\n    command: [\"cu\", \"stdio\"]\n---\nCreate 2 variations of a simple hello world app using Flask and FastAPI. \nEach in their own environment. Give me the URL of each app\n```\n\n#### Variable Substitution\n\nScripts support both environment variable substitution and script argument substitution:\n\n1. **Environment Variables**: `${env:\u002F\u002FVAR}` and `${env:\u002F\u002FVAR:-default}` - Processed first\n2. **Script Arguments**: `${variable}` and `${variable:-default}` - Processed after environment variables\n\nVariables can be provided via command line arguments:\n\n```bash\n# Script with variables\nmcphost script myscript.sh --args:directory \u002Ftmp --args:name \"John\"\n```\n\n##### Variable Syntax\n\nMCPHost supports these variable syntaxes:\n\n1. **Required Environment Variables**: `${env:\u002F\u002FVAR}` - Must be set in environment\n2. **Optional Environment Variables**: `${env:\u002F\u002FVAR:-default}` - Uses default if not set\n3. **Required Script Arguments**: `${variable}` - Must be provided via `--args:variable value`\n4. **Optional Script Arguments**: `${variable:-default}` - Uses default if not provided\n\nExample script with mixed environment variables and script arguments:\n```yaml\n#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script\n---\nmcpServers:\n  github:\n    type: \"local\"\n    command: [\"gh\", \"api\"]\n    environment:\n      GITHUB_TOKEN: \"${env:\u002F\u002FGITHUB_TOKEN}\"\n      DEBUG: \"${env:\u002F\u002FDEBUG:-false}\"\n  \n  filesystem:\n    type: \"local\"\n    command: [\"npx\", \"-y\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"${env:\u002F\u002FWORK_DIR:-\u002Ftmp}\"]\n\nmodel: \"${env:\u002F\u002FMODEL:-anthropic\u002Fclaude-sonnet-4-5-20250929}\"\n---\nHello ${name:-World}! Please list ${repo_type:-public} repositories for user ${username}.\nWorking directory is ${env:\u002F\u002FWORK_DIR:-\u002Ftmp}.\nUse the ${command:-gh} command to fetch ${count:-10} repositories.\n```\n\n##### Usage Examples\n\n```bash\n# Set environment variables first\nexport GITHUB_TOKEN=\"ghp_your_token_here\"\nexport DEBUG=\"true\"\nexport WORK_DIR=\"\u002Fhome\u002Fuser\u002Fprojects\"\n\n# Uses env vars and defaults: name=\"World\", repo_type=\"public\", command=\"gh\", count=\"10\"\nmcphost script myscript.sh\n\n# Override specific script arguments\nmcphost script myscript.sh --args:name \"John\" --args:username \"alice\"\n\n# Override multiple script arguments  \nmcphost script myscript.sh --args:name \"John\" --args:username \"alice\" --args:repo_type \"private\"\n\n# Mix of env vars, provided args, and default values\nmcphost script myscript.sh --args:name \"Alice\" --args:command \"gh api\" --args:count \"5\"\n```\n\n##### Default Value Features\n\n- **Empty defaults**: `${var:-}` - Uses empty string if not provided\n- **Complex defaults**: `${path:-\u002Ftmp\u002Fdefault\u002Fpath}` - Supports paths, URLs, etc.\n- **Spaces in defaults**: `${msg:-Hello World}` - Supports spaces in default values\n- **Backward compatibility**: Existing `${variable}` syntax continues to work unchanged\n\n**Important**: \n- Environment variables without defaults (e.g., `${env:\u002F\u002FGITHUB_TOKEN}`) are required and must be set in the environment\n- Script arguments without defaults (e.g., `${username}`) are required and must be provided via `--args:variable value` syntax\n- Variables with defaults are optional and will use their default value if not provided\n- Environment variables are processed first, then script arguments\n\n#### Script Features\n\n- **Executable**: Use shebang line for direct execution (`#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script`)\n- **YAML Configuration**: Define MCP servers directly in the script\n- **Embedded Prompts**: Include the prompt in the YAML\n- **Variable Substitution**: Use `${variable}` and `${variable:-default}` syntax with `--args:variable value`\n- **Variable Validation**: Missing required variables cause script to exit with helpful error\n- **Interactive Mode**: If prompt is empty, drops into interactive mode (handy for setup scripts)\n- **Config Fallback**: If no `mcpServers` defined, uses default config\n- **Tool Filtering**: Supports `allowedTools`\u002F`excludedTools` per server\n- **Clean Exit**: Automatically exits after completion\n\n**Note**: The shebang line requires `env -S` to handle the multi-word command `mcphost script`. This is supported on most modern Unix-like systems.\n\n#### Script Examples\n\nSee `examples\u002Fscripts\u002F` for sample scripts:\n- `example-script.sh` - Script with custom MCP servers\n- `simple-script.sh` - Script using default config fallback\n\n### Hooks System\n\nMCPHost supports a powerful hooks system that allows you to execute custom commands at specific points during execution. This enables security policies, logging, custom integrations, and automated workflows.\n\n#### Quick Start\n\n1. Initialize a hooks configuration:\n   ```bash\n   mcphost hooks init\n   ```\n\n2. View active hooks:\n   ```bash\n   mcphost hooks list\n   ```\n\n3. Validate your configuration:\n   ```bash\n   mcphost hooks validate\n   ```\n\n#### Configuration\n\nHooks are configured in YAML files with the following precedence (highest to lowest):\n- `.mcphost\u002Fhooks.yml` (project-specific hooks)\n- `$XDG_CONFIG_HOME\u002Fmcphost\u002Fhooks.yml` (user global hooks, defaults to `~\u002F.config\u002Fmcphost\u002Fhooks.yml`)\n\nExample configuration:\n```yaml\nhooks:\n  PreToolUse:\n    - matcher: \"bash\"\n      hooks:\n        - type: command\n          command: \"\u002Fusr\u002Flocal\u002Fbin\u002Fvalidate-bash.py\"\n          timeout: 5\n  \n  UserPromptSubmit:\n    - hooks:\n        - type: command\n          command: \"~\u002F.mcphost\u002Fhooks\u002Flog-prompt.sh\"\n```\n\n#### Available Hook Events\n\n- **PreToolUse**: Before any tool execution (bash, fetch, todo, MCP tools)\n- **PostToolUse**: After tool execution completes\n- **UserPromptSubmit**: When user submits a prompt\n- **Stop**: When the agent finishes responding\n- **SubagentStop**: When a subagent (Task tool) finishes\n- **Notification**: When MCPHost sends notifications\n\n#### Security\n\n⚠️ **WARNING**: Hooks execute arbitrary commands on your system. Only use hooks from trusted sources and always review hook commands before enabling them.\n\nTo temporarily disable all hooks, use the `--no-hooks` flag:\n```bash\nmcphost --no-hooks\n```\n\nSee the example hook scripts in `examples\u002Fhooks\u002F`:\n- `bash-validator.py` - Validates and blocks dangerous bash commands\n- `prompt-logger.sh` - Logs all user prompts with timestamps\n- `mcp-monitor.py` - Monitors and enforces policies on MCP tool usage\n\n### Non-Interactive Mode\n\nRun a single prompt and exit - perfect for scripting and automation:\n\n```bash\n# Basic non-interactive usage\nmcphost -p \"What is the weather like today?\"\n\n# Quiet mode - only output the AI response (no UI elements)\nmcphost -p \"What is 2+2?\" --quiet\n\n# Use with different models\nmcphost -m ollama\u002Fqwen2.5:3b -p \"Explain quantum computing\" --quiet\n```\n\n### Model Generation Parameters\n\nMCPHost supports fine-tuning model behavior through various parameters:\n\n```bash\n# Control response length\nmcphost -p \"Explain AI\" --max-tokens 1000\n\n# Adjust creativity (0.0 = focused, 1.0 = creative)\nmcphost -p \"Write a story\" --temperature 0.9\n\n# Control diversity with nucleus sampling\nmcphost -p \"Generate ideas\" --top-p 0.8\n\n# Limit token choices for more focused responses\nmcphost -p \"Answer precisely\" --top-k 20\n\n# Set custom stop sequences\nmcphost -p \"Generate code\" --stop-sequences \"```\",\"END\"\n```\n\nThese parameters work with all supported providers (OpenAI, Anthropic, Google, Ollama) where supported by the underlying model.\n\n### Available Models\nModels can be specified using the `--model` (`-m`) flag:\n- **Anthropic Claude** (default): `anthropic\u002Fclaude-sonnet-4-5-20250929`, `anthropic\u002Fclaude-3-5-sonnet-latest`, `anthropic\u002Fclaude-3-5-haiku-latest`\n- **OpenAI**: `openai\u002Fgpt-4`, `openai\u002Fgpt-4-turbo`, `openai\u002Fgpt-3.5-turbo`\n- **Google Gemini**: `google\u002Fgemini-2.0-flash`, `google\u002Fgemini-1.5-pro`\n- **Ollama models**: `ollama\u002Fllama3.2`, `ollama\u002Fqwen2.5:3b`, `ollama\u002Fmistral`\n- **OpenAI-compatible**: Any model via custom endpoint with `--provider-url`\n\n### Examples\n\n#### Interactive Mode\n```bash\n# Use Ollama with Qwen model\nmcphost -m ollama\u002Fqwen2.5:3b\n\n# Use OpenAI's GPT-4\nmcphost -m openai\u002Fgpt-4\n\n# Use OpenAI-compatible model with custom URL and API key\nmcphost --model openai\u002F\u003Cyour-model-name> \\\n--provider-url \u003Cyour-base-url> \\\n--provider-api-key \u003Cyour-api-key>\n```\n\n#### Non-Interactive Mode\n```bash\n# Single prompt with full UI\nmcphost -p \"List files in the current directory\"\n\n# Compact mode for cleaner output without fancy styling\nmcphost -p \"List files in the current directory\" --compact\n\n# Quiet mode for scripting (only AI response output, no UI elements)\nmcphost -p \"What is the capital of France?\" --quiet\n\n# Use in shell scripts\nRESULT=$(mcphost -p \"Calculate 15 * 23\" --quiet)\necho \"The answer is: $RESULT\"\n\n# Pipe to other commands\nmcphost -p \"Generate a random UUID\" --quiet | tr '[:lower:]' '[:upper:]'\n```\n\n### Flags\n- `--provider-url string`: Base URL for the provider API (applies to OpenAI, Anthropic, Ollama, and Google)\n- `--provider-api-key string`: API key for the provider (applies to OpenAI, Anthropic, and Google)\n- `--tls-skip-verify`: Skip TLS certificate verification (WARNING: insecure, use only for self-signed certificates)\n- `--config string`: Config file location (default is $HOME\u002F.mcphost.yml)\n- `--system-prompt string`: system-prompt file location\n- `--debug`: Enable debug logging\n- `--max-steps int`: Maximum number of agent steps (0 for unlimited, default: 0)\n- `-m, --model string`: Model to use (format: provider\u002Fmodel) (default \"anthropic\u002Fclaude-sonnet-4-5-20250929\")\n- `-p, --prompt string`: **Run in non-interactive mode with the given prompt**\n- `--quiet`: **Suppress all output except the AI response (only works with --prompt)**\n- `--compact`: **Enable compact output mode without fancy styling (ideal for scripting and automation)**\n- `--stream`: Enable streaming responses (default: true, use `--stream=false` to disable)\n\n### Authentication Subcommands\n- `mcphost auth login anthropic`: Authenticate with Anthropic using OAuth (alternative to API keys)\n- `mcphost auth logout anthropic`: Remove stored OAuth credentials\n- `mcphost auth status`: Show authentication status\n\n**Note**: OAuth credentials (when present) take precedence over API keys from environment variables and `--provider-api-key` flags.\n\n#### Model Generation Parameters\n- `--max-tokens int`: Maximum number of tokens in the response (default: 4096)\n- `--temperature float32`: Controls randomness in responses (0.0-1.0, default: 0.7)\n- `--top-p float32`: Controls diversity via nucleus sampling (0.0-1.0, default: 0.95)\n- `--top-k int32`: Controls diversity by limiting top K tokens to sample from (default: 40)\n- `--stop-sequences strings`: Custom stop sequences (comma-separated)\n\n### Configuration File Support\n\nAll command-line flags can be configured via the config file. MCPHost will look for configuration in this order:\n1. `~\u002F.mcphost.yml` or `~\u002F.mcphost.json` (preferred)\n2. `~\u002F.mcp.yml` or `~\u002F.mcp.json` (backwards compatibility)\n\nExample config file (`~\u002F.mcphost.yml`):\n```yaml\n# MCP Servers - New Simplified Format\nmcpServers:\n  filesystem-local:\n    type: \"local\"\n    command: [\"npx\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"\u002Fpath\u002Fto\u002Ffiles\"]\n    environment:\n      DEBUG: \"true\"\n  filesystem-builtin:\n    type: \"builtin\"\n    name: \"fs\"\n    options:\n      allowed_directories: [\"\u002Ftmp\", \"\u002Fhome\u002Fuser\u002Fdocuments\"]\n  websearch:\n    type: \"remote\"\n    url: \"https:\u002F\u002Fapi.example.com\u002Fmcp\"\n\n# Application settings\nmodel: \"anthropic\u002Fclaude-sonnet-4-5-20250929\"\nmax-steps: 20\ndebug: false\nsystem-prompt: \"\u002Fpath\u002Fto\u002Fsystem-prompt.txt\"\n\n# Model generation parameters\nmax-tokens: 4096\ntemperature: 0.7\ntop-p: 0.95\ntop-k: 40\nstop-sequences: [\"Human:\", \"Assistant:\"]\n\n# Streaming configuration\nstream: false  # Disable streaming (default: true)\n\n# API Configuration\nprovider-api-key: \"your-api-key\"      # For OpenAI, Anthropic, or Google\nprovider-url: \"https:\u002F\u002Fapi.openai.com\u002Fv1\"  # Custom base URL\ntls-skip-verify: false  # Skip TLS certificate verification (default: false)\n```\n\n**Note**: Command-line flags take precedence over config file values.\n\n\n### Interactive Commands\n\nWhile chatting, you can use:\n- `\u002Fhelp`: Show available commands\n- `\u002Ftools`: List all available tools\n- `\u002Fservers`: List configured MCP servers\n- `\u002Fhistory`: Display conversation history\n- `\u002Fquit`: Exit the application\n- `Ctrl+C`: Exit at any time\n\n### Authentication Commands\n\nOptional OAuth authentication for Anthropic (alternative to API keys):\n- `mcphost auth login anthropic`: Authenticate using OAuth\n- `mcphost auth logout anthropic`: Remove stored OAuth credentials\n- `mcphost auth status`: Show authentication status\n\n### Global Flags\n- `--config`: Specify custom config file location\n\n## Automation & Scripting 🤖\n\nMCPHost's non-interactive mode makes it perfect for automation, scripting, and integration with other tools.\n\n### Use Cases\n\n#### Shell Scripts\n```bash\n#!\u002Fbin\u002Fbash\n# Get weather and save to file\nmcphost -p \"What's the weather in New York?\" --quiet > weather.txt\n\n# Process files with AI\nfor file in *.txt; do\n    summary=$(mcphost -p \"Summarize this file: $(cat $file)\" --quiet)\n    echo \"$file: $summary\" >> summaries.txt\ndone\n```\n\n#### CI\u002FCD Integration\n```bash\n# Code review automation\nDIFF=$(git diff HEAD~1)\nmcphost -p \"Review this code diff and suggest improvements: $DIFF\" --quiet\n\n# Generate release notes\nCOMMITS=$(git log --oneline HEAD~10..HEAD)\nmcphost -p \"Generate release notes from these commits: $COMMITS\" --quiet\n```\n\n#### Data Processing\n```bash\n# Process CSV data\nmcphost -p \"Analyze this CSV data and provide insights: $(cat data.csv)\" --quiet\n\n# Generate reports\nmcphost -p \"Create a summary report from this JSON: $(cat metrics.json)\" --quiet\n```\n\n#### API Integration\n```bash\n# Use as a microservice\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fprocess \\\n  -d \"$(mcphost -p 'Generate a UUID' --quiet)\"\n```\n\n### Tips for Scripting\n- Use `--quiet` flag to get clean output suitable for parsing (only AI response, no UI)\n- Use `--compact` flag for simplified output without fancy styling (when you want to see UI elements)\n- Note: `--compact` and `--quiet` are mutually exclusive - `--compact` has no effect with `--quiet`\n- **Use environment variables for sensitive data** like API keys instead of hardcoding them\n- **Use `${env:\u002F\u002FVAR}` syntax** in config files and scripts for environment variable substitution\n- Combine with standard Unix tools (`grep`, `awk`, `sed`, etc.)\n- Set appropriate timeouts for long-running operations\n- Handle errors appropriately in your scripts\n- Use environment variables for API keys in production\n\n#### Environment Variable Best Practices\n```bash\n# Set sensitive variables in environment\nexport GITHUB_TOKEN=\"ghp_your_token_here\"\nexport OPENAI_API_KEY=\"your_openai_key\"\nexport DATABASE_URL=\"postgresql:\u002F\u002Fuser:pass@localhost\u002Fdb\"\n\n# Use in config files\nmcpServers:\n  github:\n    environment:\n      GITHUB_TOKEN: \"${env:\u002F\u002FGITHUB_TOKEN}\"\n      DEBUG: \"${env:\u002F\u002FDEBUG:-false}\"\n\n# Use in scripts\nmcphost script my-script.sh --args:username alice\n```\n\n## MCP Server Compatibility 🔌\n\nMCPHost can work with any MCP-compliant server. For examples and reference implementations, see the [MCP Servers Repository](https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Fservers).\n\n## Contributing 🤝\n\nContributions are welcome! Feel free to:\n- Submit bug reports or feature requests through issues\n- Create pull requests for improvements\n- Share your custom MCP servers\n- Improve documentation\n\nPlease ensure your contributions follow good coding practices and include appropriate tests.\n\n## License 📄\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments 🙏\n\n- Thanks to the Anthropic team for Claude and the MCP specification\n- Thanks to the Ollama team for their local LLM runtime\n- Thanks to all contributors who have helped improve this tool\n","# MCPHost 🤖\n\n一个命令行主机应用程序，使大型语言模型（LLMs）能够通过模型上下文协议（MCP）与外部工具交互。目前支持Claude、OpenAI、Google Gemini和Ollama模型。\n\n在[Discord](https:\u002F\u002Fdiscord.gg\u002FRqSS2NQVsY)上讨论该项目\n\n## 目录\n\n- [概述](#overview-)\n- [功能](#features-)\n- [要求](#requirements-)\n- [环境设置](#environment-setup-)\n- [安装](#installation-)\n- [SDK 使用](#sdk-usage-)\n- [配置](#configuration-)\n  - [MCP 服务器](#mcp-servers)\n  - [环境变量替换](#environment-variable-substitution)\n  - [简化配置模式](#simplified-configuration-schema)\n  - [工具过滤](#tool-filtering)\n  - [旧版配置支持](#legacy-configuration-support)\n  - [传输类型](#transport-types)\n  - [系统提示](#system-prompt)\n- [使用](#usage-)\n  - [交互模式](#interactive-mode-default)\n  - [脚本模式](#script-mode)\n  - [钩子系统](#hooks-system)\n  - [非交互模式](#non-interactive-mode)\n  - [模型生成参数](#model-generation-parameters)\n  - [可用模型](#available-models)\n  - [示例](#examples)\n  - [标志](#flags)\n  - [认证子命令](#authentication-subcommands)\n  - [配置文件支持](#configuration-file-support)\n  - [交互式命令](#interactive-commands)\n- [自动化与脚本](#automation--scripting-)\n- [MCP 服务器兼容性](#mcp-server-compatibility-)\n- [贡献](#contributing-)\n- [许可证](#license-)\n- [致谢](#acknowledgments-)\n\n## 概述 🌟\n\nMCPHost 在 MCP 客户端-服务器架构中充当主机角色，其中：\n- **主机**（如 MCPHost）是管理连接和交互的 LLM 应用程序\n- **客户端**与 MCP 服务器保持一对一连接\n- **服务器**为 LLM 提供上下文、工具和能力\n\n这种架构允许语言模型：\n- 访问外部工具和数据源 🛠️\n- 在多次交互中保持一致的上下文 🔄\n- 安全地执行命令并获取信息 🔒\n\n目前支持：\n- Anthropic Claude 模型（Claude 3.5 Sonnet、Claude 3.5 Haiku 等）\n- OpenAI 模型（GPT-4、GPT-4 Turbo、GPT-3.5 等）\n- Google Gemini 模型（Gemini 2.0 Flash、Gemini 1.5 Pro 等）\n- 任何支持函数调用的 Ollama 兼容模型\n- 任何 OpenAI 兼容的 API 端点\n\n## 功能 ✨\n\n- 与多个 AI 模型进行交互式对话\n- **非交互模式**，用于脚本和自动化\n- **脚本模式**，用于基于 YAML 的可执行自动化脚本\n- 支持多个并发的 MCP 服务器\n- **工具过滤**，可通过每个服务器的 `allowedTools` 和 `excludedTools` 进行配置\n- 动态工具发现与集成\n- 所有支持的模型均具备工具调用能力\n- 可配置的 MCP 服务器位置和参数\n- 跨模型类型的统一命令接口\n- 可配置的消息历史窗口，用于管理上下文\n- **OAuth 认证**支持 Anthropic（替代 API 密钥）\n- **钩子系统**，用于自定义集成和安全策略\n- 配置和脚本中的**环境变量替换**\n- **内置服务器**，用于常见功能（文件系统、bash、待办事项、http）\n\n## 要求 📋\n\n- Go 1.23 或更高版本\n- 对于 OpenAI\u002FAnthropic：相应提供商的 API 密钥\n- 对于 Ollama：本地安装的 Ollama 及所需模型\n- 对于 Google\u002FGemini：Google API 密钥（详见 https:\u002F\u002Faistudio.google.com\u002Fapp\u002Fapikey）\n- 一个或多个与 MCP 兼容的工具服务器\n\n## 环境设置 🔧\n\n1. API 密钥：\n```bash\n# 适用于所有提供商（使用 --provider-api-key 标志或以下环境变量）\nexport OPENAI_API_KEY='your-openai-key'        # 用于 OpenAI\nexport ANTHROPIC_API_KEY='your-anthropic-key'  # 用于 Anthropic\nexport GOOGLE_API_KEY='your-google-key'        # 用于 Google\u002FGemini\n```\n\n2. Ollama 设置：\n- 从 https:\u002F\u002Follama.ai 安装 Ollama\n- 拉取所需模型：\n```bash\nollama pull mistral\n```\n- 确保 Ollama 正在运行：\n```bash\nollama serve\n```\n\n您还可以使用标准环境变量配置 Ollama 客户端，例如 `OLLAMA_HOST` 用于 Ollama 基础 URL。\n\n3. Google API 密钥（用于 Gemini）：\n```bash\nexport GOOGLE_API_KEY='your-api-key'\n```\n\n4. OpenAI 兼容设置：\n- 获取您的 API 服务器基础 URL、API 密钥和模型名称\n- 使用 `--provider-url` 和 `--provider-api-key` 标志，或设置环境变量\n\n5. 自签名证书（TLS）：\n如果您使用的提供商采用自签名证书（例如本地 Ollama 使用 HTTPS），可以跳过证书验证：\n```bash\nmcphost --provider-url https:\u002F\u002F192.168.1.100:443 --tls-skip-verify\n```\n⚠️ **警告**：仅在开发阶段或连接到受信任的自签名证书服务器时使用 `--tls-skip-verify`。这会禁用 TLS 证书验证，在生产环境中不安全。\n\n## 安装 📦\n\n```bash\ngo install github.com\u002Fmark3labs\u002Fmcphost@latest\n```\n\n## SDK 使用 🛠️\n\nMCPHost 还提供了一个 Go SDK，用于无需启动操作系统进程即可进行编程访问。该 SDK 与 CLI 保持完全相同的行为，包括配置加载、环境变量和默认值。\n\n### 快速示例\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"github.com\u002Fmark3labs\u002Fmcphost\u002Fsdk\"\n)\n\nfunc main() {\n    ctx := context.Background()\n    \n    \u002F\u002F 创建具有默认配置的 MCPHost 实例\n    host, err := sdk.New(ctx, nil)\n    if err != nil {\n        panic(err)\n    }\n    defer host.Close()\n    \n    \u002F\u002F 发送提示并获取响应\n    response, err := host.Prompt(ctx, \"2+2 是多少？\")\n    if err != nil {\n        panic(err)\n    }\n    \n    fmt.Println(response)\n}\n```\n\n### SDK 特性\n\n- ✅ 无需启动进程即可进行编程访问\n- ✅ 配置行为与 CLI 完全一致\n- ✅ 会话管理（保存\u002F加载\u002F清除）\n- ✅ 工具执行回调，用于监控\n- ✅ 流式传输支持\n- ✅ 与所有提供商和 MCP 服务器完全兼容\n\n有关详细的 SDK 文档、示例和 API 参考，请参阅 [SDK README](sdk\u002FREADME.md)。\n\n## 配置 ⚙️\n\n### MCP 服务器\n如果 MCPHost 的主目录中不存在配置文件，它将自动创建一个。它会按以下顺序查找配置文件：\n- `.mcphost.yml` 或 `.mcphost.json`（首选）\n- `.mcp.yml` 或 `.mcp.json`（向后兼容）\n\n**各操作系统上的配置文件位置：**\n- **Linux\u002FmacOS**：`~\u002F.mcphost.yml`、`~\u002F.mcphost.json`、`~\u002F.mcp.yml`、`~\u002F.mcp.json`\n- **Windows**：`%USERPROFILE%\\.mcphost.yml`、`%USERPROFILE%\\.mcphost.json`、`%USERPROFILE%\\.mcp.yml`、`%USERPROFILE%\\.mcp.json`\n\n您也可以使用 `--config` 标志指定自定义位置。\n\n### 环境变量替换\n\nMCPHost 支持在配置文件和脚本的 Frontmatter 中使用环境变量替换，语法如下：\n- **`${env:\u002F\u002FVAR}`** - 必需的环境变量（未设置时会失败）\n- **`${env:\u002F\u002FVAR:-default}`** - 可选的环境变量，带有默认值\n\n这使得您可以将 API 密钥等敏感信息保存在环境变量中，同时保持配置的灵活性。\n\n**示例：**\n```yaml\nmcpServers:\n  github:\n    type: local\n    command: [\"docker\", \"run\", \"-i\", \"--rm\", \"-e\", \"GITHUB_PERSONAL_ACCESS_TOKEN=${env:\u002F\u002FGITHUB_TOKEN}\", \"ghcr.io\u002Fgithub\u002Fgithub-mcp-server\"]\n    environment:\n      DEBUG: \"${env:\u002F\u002FDEBUG:-false}\"\n      LOG_LEVEL: \"${env:\u002F\u002FLOG_LEVEL:-info}\"\n\nmodel: \"${env:\u002F\u002FMODEL:-anthropic\u002Fclaude-sonnet-4-5-20250929}\"\nprovider-api-key: \"${env:\u002F\u002FOPENAI_API_KEY}\"  # 必需 - 未设置时会失败\n```\n\n**使用方法：**\n```bash\n# 设置必需的环境变量\nexport GITHUB_TOKEN=\"ghp_your_token_here\"\nexport OPENAI_API_KEY=\"your_openai_key\"\n\n# 可选地覆盖默认值\nexport DEBUG=\"true\"\nexport MODEL=\"openai\u002Fgpt-4\"\n\n# 运行 mcphost\nmcphost\n```\n\n### 简化配置模式\n\nMCPHost 现在支持一种简化的配置模式，包含三种服务器类型：\n\n#### 本地服务器\n用于在您的机器上运行命令的本地 MCP 服务器：\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"type\": \"local\",\n      \"command\": [\"npx\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"${env:\u002F\u002FWORK_DIR:-\u002Ftmp}\"],\n      \"environment\": {\n        \"DEBUG\": \"${env:\u002F\u002FDEBUG:-false}\",\n        \"LOG_LEVEL\": \"${env:\u002F\u002FLOG_LEVEL:-info}\",\n        \"API_TOKEN\": \"${env:\u002F\u002FFS_API_TOKEN}\"\n      },\n      \"allowedTools\": [\"read_file\", \"write_file\"],\n      \"excludedTools\": [\"delete_file\"]\n    },\n    \"github\": {\n      \"type\": \"local\",\n      \"command\": [\"docker\", \"run\", \"-i\", \"--rm\", \"-e\", \"GITHUB_PERSONAL_ACCESS_TOKEN=${env:\u002F\u002FGITHUB_TOKEN}\", \"ghcr.io\u002Fgithub\u002Fgithub-mcp-server\"],\n      \"environment\": {\n        \"DEBUG\": \"${env:\u002F\u002FDEBUG:-false}\"\n      }\n    },\n    \"sqlite\": {\n      \"type\": \"local\",\n      \"command\": [\"uvx\", \"mcp-server-sqlite\", \"--db-path\", \"${env:\u002F\u002FDB_PATH:-\u002Ftmp\u002Ffoo.db}\"],\n      \"environment\": {\n        \"SQLITE_DEBUG\": \"${env:\u002F\u002FDEBUG:-0}\",\n        \"DATABASE_URL\": \"${env:\u002F\u002FDATABASE_URL:-sqlite:\u002F\u002F\u002Ftmp\u002Ffoo.db}\"\n      }\n    }\n  }\n}\n```\n\n每个本地服务器条目需要：\n- `type`：必须设置为 `\"local\"`\n- `command`：包含命令及其所有参数的数组\n- `environment`：（可选）环境变量键值对对象\n- `allowedTools`：（可选）要包含的工具名称数组（白名单）\n- `excludedTools`：（可选）要排除的工具名称数组（黑名单）\n\n#### 远程服务器\n用于通过 HTTP 访问的远程 MCP 服务器：\n```json\n{\n  \"mcpServers\": {\n    \"websearch\": {\n      \"type\": \"remote\",\n      \"url\": \"${env:\u002F\u002FWEBSEARCH_URL:-https:\u002F\u002Fapi.example.com\u002Fmcp}\",\n      \"headers\": [\"Authorization: Bearer ${env:\u002F\u002FWEBSEARCH_TOKEN}\"]\n    },\n    \"weather\": {\n      \"type\": \"remote\", \n      \"url\": \"${env:\u002F\u002FWEATHER_URL:-https:\u002F\u002Fweather-mcp.example.com}\"\n    }\n  }\n}\n```\n\n每个远程服务器条目需要：\n- `type`：必须设置为 `\"remote\"`\n- `url`：MCP 服务器可访问的 URL\n- `headers`：（可选）用于身份验证和其他自定义头的 HTTP 头数组\n\n远程服务器会自动使用 StreamableHTTP 传输方式以获得最佳性能。\n\n#### 内置服务器\n用于在进程中运行以获得最佳性能的内置 MCP 服务器：\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\",\n      \"options\": {\n        \"allowed_directories\": [\"${env:\u002F\u002FWORK_DIR:-\u002Ftmp}\", \"${env:\u002F\u002FHOME}\u002Fdocuments\"]\n      },\n      \"allowedTools\": [\"read_file\", \"write_file\", \"list_directory\"]\n    },\n    \"filesystem-cwd\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\"\n    }\n  }\n}\n```\n\n每个内置服务器条目需要：\n- `type`：必须设置为 `\"builtin\"`\n- `name`：内置服务器的内部名称（例如，`\"fs\"` 表示文件系统）\n- `options`：特定于内置服务器的配置选项\n\n**可用的内置服务器：**\n- `fs`（文件系统）：具有可配置允许目录的安全文件系统访问\n  - `allowed_directories`：服务器可以访问的目录路径数组（未指定时默认为当前工作目录）\n- `bash`：执行带有安全限制和超时控制的 Bash 命令\n  - 无需任何配置选项\n- `todo`：管理会话期间的任务跟踪临时待办事项列表\n  - 无需任何配置选项（待办事项存储在内存中，重启后会重置）\n- `http`：获取网页内容并将其转换为文本、Markdown 或 HTML 格式\n  - 工具：`fetch`（获取并转换网页内容）、`fetch_summarize`（使用 AI 获取并总结网页内容）、`fetch_extract`（使用 AI 提取特定数据）、`fetch_filtered_json`（获取 JSON 并使用 gjson 路径语法进行过滤）\n  - 无需任何配置选项\n\n#### 内置服务器示例\n\n```json\n{\n  \"mcpServers\": {\n    \"filesystem\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\",\n      \"options\": {\n        \"allowed_directories\": [\"\u002Ftmp\", \"\u002Fhome\u002Fuser\u002Fdocuments\"]\n      }\n    },\n    \"bash-commands\": {\n      \"type\": \"builtin\", \n      \"name\": \"bash\"\n    },\n    \"task-manager\": {\n      \"type\": \"builtin\",\n      \"name\": \"todo\"\n    },\n    \"web-fetcher\": {\n      \"type\": \"builtin\",\n      \"name\": \"http\"\n    }\n  }\n}\n```\n\n### 工具过滤\n\n所有类型的 MCP 服务器都支持工具过滤，以限制可用的工具：\n\n- **`allowedTools`**：白名单 - 仅允许服务器提供指定的工具\n- **`excludedTools`**：黑名单 - 除指定工具外，其他所有工具均可使用\n\n```json\n{\n  \"mcpServers\": {\n    \"filesystem-readonly\": {\n      \"type\": \"builtin\",\n      \"name\": \"fs\",\n      \"allowedTools\": [\"read_file\", \"list_directory\"]\n    },\n    \"filesystem-safe\": {\n      \"type\": \"local\", \n      \"command\": [\"npx\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"\u002Ftmp\"],\n      \"excludedTools\": [\"delete_file\"]\n    }\n  }\n}\n```\n\n**注意**：`allowedTools` 和 `excludedTools` 是互斥的，每个服务器只能使用其中之一。\n\n### 遗留配置支持\n\nMCPHost 保持与先前配置格式的完全向后兼容性。**注意**：最近的一项错误修复提高了外部 MCP 服务器（Docker、NPX 等）的旧版 stdio 传输可靠性。\n\n#### 遗留 STDIO 格式\n```json\n{\n  \"mcpServers\": {\n    \"sqlite\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-server-sqlite\", \"--db-path\", \"\u002Ftmp\u002Ffoo.db\"],\n      \"env\": {\n        \"DEBUG\": \"true\"\n      }\n    }\n  }\n}\n```\n\n#### 遗留 SSE 格式\n```json\n{\n  \"mcpServers\": {\n    \"server_name\": {\n      \"url\": \"http:\u002F\u002Fsome_host:8000\u002Fsse\",\n      \"headers\": [\"Authorization: Bearer my-token\"]\n    }\n  }\n}\n```\n\n#### 遗留 Docker\u002F容器格式\n```json\n{\n  \"mcpServers\": {\n    \"phalcon\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"ghcr.io\u002Fmark3labs\u002Fphalcon-mcp:latest\",\n        \"serve\"\n      ]\n    }\n  }\n}\n```\n\n#### 遗留可流式 HTTP 格式\n```json\n{\n  \"mcpServers\": {\n    \"websearch\": {\n      \"transport\": \"streamable\",\n      \"url\": \"https:\u002F\u002Fapi.example.com\u002Fmcp\",\n      \"headers\": [\"Authorization: Bearer your-api-token\"]\n    }\n  }\n}\n```\n\n### 传输类型\n\nMCPHost 支持四种传输类型：\n- **`stdio`**：启动本地进程并通过 stdin\u002Fstdout 进行通信（用于 `\"local\"` 服务器）\n- **`sse`**：使用 Server-Sent Events 连接到服务器（遗留格式）\n- **`streamable`**：使用可流式 HTTP 协议连接到服务器（用于 `\"remote\"` 服务器）\n- **`inprocess`**：在进程中运行内置服务器以获得最佳性能（用于 `\"builtin\"` 服务器）\n\n简化后的模式会自动映射：\n- `\"local\"` 类型 → `stdio` 传输\n- `\"remote\"` 类型 → `streamable` 传输\n- `\"builtin\"` 类型 → `inprocess` 传输\n\n### 系统提示\n\n您可以使用 `--system-prompt` 标志指定自定义系统提示。您可以通过以下两种方式之一：\n\n1. **直接传递提示文本：**\n   ```bash\n   mcphost --system-prompt \"你是一位以友好语气回应的帮助型助手。\"\n   ```\n\n2. **传递包含提示的文本文件路径：**\n   ```bash\n   mcphost --system-prompt .\u002Fprompts\u002Fassistant.md\n   ```\n\n   示例 `assistant.md` 文件：\n   ```markdown\n   你是一位有用编码助手。\n   \n   请：\n   - 编写整洁易读的代码\n   - 添加有用的注释\n   - 遵循最佳实践\n   - 解释你的思路\n   ```\n\n\n## 使用方法 🚀\n\nMCPHost 是一个 CLI 工具，允许您通过统一的界面与各种 AI 模型交互。它通过 MCP 服务器支持多种工具，并且可以在交互式和非交互式模式下运行。\n\n### 交互模式（默认）\n\n开始一次交互式对话会话：\n\n```bash\nmcphost\n```\n\n### 脚本模式\n\n运行支持变量替换的 YAML 基础自动化脚本：\n\n```bash\n# 使用 script 子命令\nmcphost script myscript.sh\n\n# 带有变量\nmcphost script myscript.sh --args:directory \u002Ftmp --args:name \"John\"\n\n# 直接执行（如果具有可执行权限且包含 shebang）\n.\u002Fmyscript.sh\n```\n\n#### 脚本格式\n\n脚本将 YAML 配置与提示结合在一个可执行文件中。配置必须用 frontmatter 分隔符（`---`）包裹起来。您可以将提示包含在 YAML 配置中，也可以将其放在结束的 frontmatter 分隔符之后：\n\n```yaml\n#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script\n---\n# 此脚本使用来自 https:\u002F\u002Fgithub.com\u002Fdagger\u002Fcontainer-use 的 container-use MCP 服务器\nmcpServers:\n  container-use:\n    type: \"local\"\n    command: [\"cu\", \"stdio\"]\nprompt: |\n  使用 Flask 和 FastAPI 创建两个简单的 Hello World 应用程序变体。每个应用都在各自的环境中运行。请给我这两个应用的 URL。\n---\n```\n\n或者，您也可以省略 `prompt:` 字段，将提示放在 frontmatter 之后：\n\n```yaml\n#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script\n---\n# 此脚本使用来自 https:\u002F\u002Fgithub.com\u002Fdagger\u002Fcontainer-use 的 container-use MCP 服务器\nmcpServers:\n  container-use:\n    type: \"local\"\n    command: [\"cu\", \"stdio\"]\n---\n使用 Flask 和 FastAPI 创建两个简单的 Hello World 应用程序变体。每个应用都在各自的环境中运行。请给我这两个应用的 URL。\n```\n\n#### 变量替换\n\n脚本同时支持环境变量替换和脚本参数替换：\n\n1. **环境变量**：`${env:\u002F\u002FVAR}` 和 `${env:\u002F\u002FVAR:-default}` —— 优先处理\n2. **脚本参数**：`${variable}` 和 `${variable:-default}` —— 在环境变量之后处理\n\n变量可以通过命令行参数提供：\n\n```bash\n# 带有变量的脚本\nmcphost script myscript.sh --args:directory \u002Ftmp --args:name \"John\"\n```\n\n##### 变量语法\n\nMCPHost 支持以下变量语法：\n\n1. **必需的环境变量**：`${env:\u002F\u002FVAR}` —— 必须在环境中设置\n2. **可选的环境变量**：`${env:\u002F\u002FVAR:-default}` —— 如果未设置则使用默认值\n3. **必需的脚本参数**：`${variable}` —— 必须通过 `--args:variable value` 提供\n4. **可选的脚本参数**：`${variable:-default}` —— 如果未提供则使用默认值\n\n示例脚本，混合了环境变量和脚本参数：\n```yaml\n#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script\n---\nmcpServers:\n  github:\n    type: \"local\"\n    command: [\"gh\", \"api\"]\n    environment:\n      GITHUB_TOKEN: \"${env:\u002F\u002FGITHUB_TOKEN}\"\n      DEBUG: \"${env:\u002F\u002FDEBUG:-false}\"\n  \n  filesystem:\n    type: \"local\"\n    command: [\"npx\", \"-y\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"${env:\u002F\u002FWORK_DIR:-\u002Ftmp}\"]\n\nmodel: \"${env:\u002F\u002FMODEL:-anthropic\u002Fclaude-sonnet-4-5-20250929}\"\n---\n你好 ${name:-World}！请列出 ${repo_type:-public} 用户 ${username} 的仓库。工作目录是 ${env:\u002F\u002FWORK_DIR:-\u002Ftmp}。使用 ${command:-gh} 命令获取 ${count:-10} 个仓库。\n```\n\n##### 使用示例\n\n```bash\n# 先设置环境变量\nexport GITHUB_TOKEN=\"ghp_your_token_here\"\nexport DEBUG=\"true\"\nexport WORK_DIR=\"\u002Fhome\u002Fuser\u002Fprojects\"\n\n# 使用环境变量和默认值：name=\"World\"，repo_type=\"public\"，command=\"gh\"，count=\"10\"\nmcphost script myscript.sh\n\n# 覆盖特定脚本参数\nmcphost script myscript.sh --args:name \"John\" --args:username \"alice\"\n\n# 覆盖多个脚本参数\nmcphost script myscript.sh --args:name \"John\" --args:username \"alice\" --args:repo_type \"private\"\n\n# 环境变量、提供的参数与默认值的混合\nmcphost script myscript.sh --args:name \"Alice\" --args:command \"gh api\" --args:count \"5\"\n```\n\n##### 默认值特性\n\n- **空默认值**: `${var:-}` - 如果未提供则使用空字符串\n- **复杂默认值**: `${path:-\u002Ftmp\u002Fdefault\u002Fpath}` - 支持路径、URL等\n- **默认值中的空格**: `${msg:-Hello World}` - 支持默认值中包含空格\n- **向后兼容性**: 现有的`${variable}`语法仍可正常使用，无需更改\n\n**重要提示**:\n- 无默认值的环境变量（如`${env:\u002F\u002FGITHUB_TOKEN}`）为必填项，必须在环境中设置。\n- 无默认值的脚本参数（如`${username}`）为必填项，必须通过`--args:variable value`语法提供。\n- 有默认值的变量为可选，若未提供则使用默认值。\n- 环境变量会优先处理，随后才是脚本参数。\n\n#### 脚本特性\n\n- **可执行性**: 使用 shebang 行可直接执行（`#!\u002Fusr\u002Fbin\u002Fenv -S mcphost script`）\n- **YAML 配置**: 可在脚本中直接定义 MCP 服务器\n- **嵌入式提示**: 提示信息可直接包含在 YAML 文件中\n- **变量替换**: 使用`${variable}`和`${variable:-default}`语法，并配合`--args:variable value`\n- **变量验证**: 缺少必填变量时，脚本将退出并显示有用的错误信息。\n- **交互模式**: 若提示为空，则进入交互模式（适用于设置脚本）\n- **配置回退**: 若未定义`mcpServers`，则使用默认配置。\n- **工具过滤**: 支持按服务器设置`allowedTools`\u002F`excludedTools`\n- **干净退出**: 完成后自动退出\n\n**注意**: Shebang 行需要使用`env -S`来处理多单词命令`mcphost script`。这在大多数现代类 Unix 系统上都支持。\n\n#### 脚本示例\n\n请参阅`examples\u002Fscripts\u002F`目录下的示例脚本：\n- `example-script.sh` - 自定义 MCP 服务器的脚本\n- `simple-script.sh` - 使用默认配置回退的脚本\n\n### 钩子系统\n\nMCPHost 支持强大的钩子系统，允许您在执行过程中的特定点执行自定义命令。这使得安全策略、日志记录、自定义集成以及自动化工作流成为可能。\n\n#### 快速入门\n\n1. 初始化钩子配置：\n   ```bash\n   mcphost hooks init\n   ```\n\n2. 查看当前生效的钩子：\n   ```bash\n   mcphost hooks list\n   ```\n\n3. 验证您的配置：\n   ```bash\n   mcphost hooks validate\n   ```\n\n#### 配置\n\n钩子通过 YAML 文件进行配置，优先级从高到低如下：\n- `.mcphost\u002Fhooks.yml`（项目专用钩子）\n- `$XDG_CONFIG_HOME\u002Fmcphost\u002Fhooks.yml`（用户全局钩子，默认为`~\u002F.config\u002Fmcphost\u002Fhooks.yml`）\n\n示例配置：\n```yaml\nhooks:\n  PreToolUse:\n    - matcher: \"bash\"\n      hooks:\n        - type: command\n          command: \"\u002Fusr\u002Flocal\u002Fbin\u002Fvalidate-bash.py\"\n          timeout: 5\n  \n  UserPromptSubmit:\n    - hooks:\n        - type: command\n          command: \"~\u002F.mcphost\u002Fhooks\u002Flog-prompt.sh\"\n```\n\n#### 可用钩子事件\n\n- **PreToolUse**: 在任何工具执行之前（bash、fetch、todo、MCP 工具）\n- **PostToolUse**: 工具执行完成后\n- **UserPromptSubmit**: 用户提交提示时\n- **Stop**: 代理完成响应时\n- **SubagentStop**: 子代理（Task 工具）完成时\n- **Notification**: 当 MCPHost 发送通知时\n\n#### 安全性\n\n⚠️ **警告**: 钩子会在您的系统上执行任意命令。请仅使用来自可信来源的钩子，并在启用前始终检查钩子命令。\n\n要临时禁用所有钩子，请使用`--no-hooks`标志：\n```bash\nmcphost --no-hooks\n```\n\n请参阅`examples\u002Fhooks\u002F`目录下的示例钩子脚本：\n- `bash-validator.py` - 验证并阻止危险的 bash 命令\n- `prompt-logger.sh` - 记录所有用户提示及时间戳\n- `mcp-monitor.py` - 监控并执行关于 MCP 工具使用的政策\n\n### 非交互模式\n\n运行单个提示并退出——非常适合脚本编写和自动化：\n\n```bash\n# 基本非交互式用法\nmcphost -p \"今天天气怎么样？\"\n\n# 静默模式——仅输出 AI 回答，不显示 UI 元素\nmcphost -p \"2+2等于多少？\" --quiet\n\n# 使用不同模型\nmcphost -m ollama\u002Fqwen2.5:3b -p \"解释量子计算\" --quiet\n```\n\n### 模型生成参数\n\nMCPHost 支持通过多种参数微调模型行为：\n\n```bash\n# 控制回答长度\nmcphost -p \"解释人工智能\" --max-tokens 1000\n\n# 调整创造力（0.0 = 专注，1.0 = 创意）\nmcphost -p \"写一个故事\" --temperature 0.9\n\n# 使用核采样控制多样性\nmcphost -p \"生成创意\" --top-p 0.8\n\n# 限制候选词数量以获得更聚焦的回答\nmcphost -p \"精确作答\" --top-k 20\n\n# 设置自定义停止序列\nmcphost -p \"生成代码\" --stop-sequences \"```\",\"END\"\n```\n\n这些参数适用于所有受支持的提供商（OpenAI、Anthropic、Google、Ollama），前提是底层模型支持。\n\n### 可用模型\n\n可通过`--model`（`-m`）选项指定模型：\n- **Anthropic Claude**（默认）：`anthropic\u002Fclaude-sonnet-4-5-20250929`、`anthropic\u002Fclaude-3-5-sonnet-latest`、`anthropic\u002Fclaude-3-5-haiku-latest`\n- **OpenAI**: `openai\u002Fgpt-4`、`openai\u002Fgpt-4-turbo`、`openai\u002Fgpt-3.5-turbo`\n- **Google Gemini**: `google\u002Fgemini-2.0-flash`、`google\u002Fgemini-1.5-pro`\n- **Ollama 模型**: `ollama\u002Fllama3.2`、`ollama\u002Fqwen2.5:3b`、`ollama\u002Fmistral`\n- **OpenAI 兼容模型**: 通过自定义端点和`--provider-url`指定的任何模型\n\n### 示例\n\n#### 交互模式\n```bash\n# 使用 Ollama 的 Qwen 模型\nmcphost -m ollama\u002Fqwen2.5:3b\n\n# 使用 OpenAI 的 GPT-4\nmcphost -m openai\u002Fgpt-4\n\n# 使用 OpenAI 兼容模型，自定义 URL 和 API 密钥\nmcphost --model openai\u002F\u003Cyour-model-name> \\\n--provider-url \u003Cyour-base-url> \\\n--provider-api-key \u003Cyour-api-key>\n```\n\n#### 非交互模式\n```bash\n# 单一提示，完整 UI\nmcphost -p \"列出当前目录下的文件\"\n\n# 简洁模式，输出更干净，无花哨样式\nmcphost -p \"列出当前目录下的文件\" --compact\n\n# 静默模式，适合脚本编写（仅输出 AI 回答，无 UI 元素）\nmcphost -p \"法国的首都是哪里？\" --quiet\n\n# 在 shell 脚本中使用\nRESULT=$(mcphost -p \"计算 15 * 23\" --quiet)\necho \"答案是: $RESULT\"\n\n# 与其他命令管道连接\nmcphost -p \"生成一个随机 UUID\" --quiet | tr '[:lower:]' '[:upper:]'\n```\n\n### 标志\n- `--provider-url string`: 提供商 API 的基础 URL（适用于 OpenAI、Anthropic、Ollama 和 Google）\n- `--provider-api-key string`: 提供商的 API 密钥（适用于 OpenAI、Anthropic 和 Google）\n- `--tls-skip-verify`: 跳过 TLS 证书验证（警告：不安全，仅用于自签名证书）\n- `--config string`: 配置文件位置（默认为 $HOME\u002F.mcphost.yml）\n- `--system-prompt string`: 系统提示文件位置\n- `--debug`: 启用调试日志\n- `--max-steps int`: 代理的最大步骤数（0 表示无限制，默认：0）\n- `-m, --model string`: 要使用的模型（格式：提供商\u002F模型）（默认为 \"anthropic\u002Fclaude-sonnet-4-5-20250929\"）\n- `-p, --prompt string`: **以非交互模式运行，并使用给定的提示**\n- `--quiet`: **抑制所有输出，仅保留 AI 响应（仅与 --prompt 一起使用）**\n- `--compact`: **启用简洁输出模式，不带花哨的样式（非常适合脚本和自动化）**\n- `--stream`: 启用流式响应（默认：true，使用 `--stream=false` 可禁用）\n\n### 身份验证子命令\n- `mcphost auth login anthropic`: 使用 OAuth 认证 Anthropic（替代 API 密钥）\n- `mcphost auth logout anthropic`: 删除存储的 OAuth 凭据\n- `mcphost auth status`: 显示身份验证状态\n\n**注意**：OAuth 凭据（如果存在）优先于环境变量和 `--provider-api-key` 标志中的 API 密钥。\n\n#### 模型生成参数\n- `--max-tokens int`: 响应中最大令牌数（默认：4096）\n- `--temperature float32`: 控制响应的随机性（0.0-1.0，默认：0.7）\n- `--top-p float32`: 通过核采样控制多样性（0.0-1.0，默认：0.95）\n- `--top-k int32`: 通过限制从前 K 个令牌中采样来控制多样性（默认：40）\n- `--stop-sequences strings`: 自定义停止序列（逗号分隔）\n\n### 配置文件支持\n\n所有命令行标志都可以通过配置文件进行配置。MCPHost 将按以下顺序查找配置：\n1. `~\u002F.mcphost.yml` 或 `~\u002F.mcphost.json`（首选）\n2. `~\u002F.mcp.yml` 或 `~\u002F.mcp.json`（向后兼容）\n\n配置文件示例（`~\u002F.mcphost.yml`）：\n```yaml\n# MCP 服务器 - 新简化格式\nmcpServers:\n  filesystem-local:\n    type: \"local\"\n    command: [\"npx\", \"@modelcontextprotocol\u002Fserver-filesystem\", \"\u002Fpath\u002Fto\u002Ffiles\"]\n    environment:\n      DEBUG: \"true\"\n  filesystem-builtin:\n    type: \"builtin\"\n    name: \"fs\"\n    options:\n      allowed_directories: [\"\u002Ftmp\", \"\u002Fhome\u002Fuser\u002Fdocuments\"]\n  websearch:\n    type: \"remote\"\n    url: \"https:\u002F\u002Fapi.example.com\u002Fmcp\"\n\n# 应用程序设置\nmodel: \"anthropic\u002Fclaude-sonnet-4-5-20250929\"\nmax-steps: 20\ndebug: false\nsystem-prompt: \"\u002Fpath\u002Fto\u002Fsystem-prompt.txt\"\n\n# 模型生成参数\nmax-tokens: 4096\ntemperature: 0.7\ntop-p: 0.95\ntop-k: 40\nstop-sequences: [\"Human:\", \"Assistant:\"]\n\n# 流式配置\nstream: false  # 禁用流式传输（默认：true）\n\n# API 配置\nprovider-api-key: \"your-api-key\"      # 对于 OpenAI、Anthropic 或 Google\nprovider-url: \"https:\u002F\u002Fapi.openai.com\u002Fv1\"  # 自定义基础 URL\ntls-skip-verify: false  # 跳过 TLS 证书验证（默认：false）\n```\n\n**注意**：命令行标志优先于配置文件中的值。\n\n### 交互式命令\n\n聊天时，您可以使用：\n- `\u002Fhelp`: 显示可用命令\n- `\u002Ftools`: 列出所有可用工具\n- `\u002Fservers`: 列出已配置的 MCP 服务器\n- `\u002Fhistory`: 显示对话历史\n- `\u002Fquit`: 退出应用程序\n- `Ctrl+C`: 随时退出\n\n### 认证命令\n\n可选的 Anthropic OAuth 认证（替代 API 密钥）：\n- `mcphost auth login anthropic`: 使用 OAuth 进行认证\n- `mcphost auth logout anthropic`: 删除存储的 OAuth 凭据\n- `mcphost auth status`: 显示身份验证状态。\n\n### 全局标志\n- `--config`: 指定自定义配置文件位置\n\n## 自动化与脚本 🤖\n\nMCPHost 的非交互模式使其非常适合自动化、脚本编写以及与其他工具的集成。\n\n### 使用场景\n\n#### Shell 脚本\n```bash\n#!\u002Fbin\u002Fbash\n# 获取天气并保存到文件\nmcphost -p \"纽约的天气如何？\" --quiet > weather.txt\n\n# 使用 AI 处理文件\nfor file in *.txt; do\n    summary=$(mcphost -p \"请总结此文件内容：$(cat $file)\" --quiet)\n    echo \"$file: $summary\" >> summaries.txt\ndone\n```\n\n#### CI\u002FCD 集成\n```bash\n# 代码审查自动化\nDIFF=$(git diff HEAD~1)\nmcphost -p \"请审查这段代码差异并提出改进建议：$DIFF\" --quiet\n\n# 生成发布说明\nCOMMITS=$(git log --oneline HEAD~10..HEAD)\nmcphost -p \"请根据这些提交记录生成发布说明：$COMMITS\" --quiet\n```\n\n#### 数据处理\n```bash\n# 处理 CSV 数据\nmcphost -p \"请分析这份 CSV 数据并提供见解：$(cat data.csv)\" --quiet\n\n# 生成报告\nmcphost -p \"请根据这份 JSON 数据创建摘要报告：$(cat metrics.json)\" --quiet\n```\n\n#### API 集成\n```bash\n# 作为微服务使用\ncurl -X POST http:\u002F\u002Flocalhost:8080\u002Fprocess \\\n  -d \"$(mcphost -p '生成一个 UUID' --quiet)\"\n```\n\n### 脚本编写技巧\n- 使用 `--quiet` 标志获取适合解析的干净输出（仅 AI 响应，无 UI）\n- 使用 `--compact` 标志获得简化输出，去除花哨的样式（当您希望看到 UI 元素时）\n- 注意：`--compact` 和 `--quiet` 互斥——使用 `--quiet` 时，`--compact` 无效\n- **对于敏感数据，如 API 密钥，使用环境变量代替硬编码**\n- 在配置文件和脚本中使用 `${env:\u002F\u002FVAR}` 语法进行环境变量替换\n- 结合标准 Unix 工具（`grep`、`awk`、`sed` 等）\n- 为长时间运行的操作设置适当的超时时间\n- 在脚本中妥善处理错误\n- 生产环境中使用环境变量存储 API 密钥\n\n#### 环境变量最佳实践\n```bash\n# 在环境中设置敏感变量\nexport GITHUB_TOKEN=\"ghp_your_token_here\"\nexport OPENAI_API_KEY=\"your_openai_key\"\nexport DATABASE_URL=\"postgresql:\u002F\u002Fuser:pass@localhost\u002Fdb\"\n\n# 在配置文件中使用\nmcpServers:\n  github:\n    environment:\n      GITHUB_TOKEN: \"${env:\u002F\u002FGITHUB_TOKEN}\"\n      DEBUG: \"${env:\u002F\u002FDEBUG:-false}\"\n\n# 在脚本中使用\nmcphost script my-script.sh --args:username alice\n```\n\n## MCP 服务器兼容性 🔌\n\nMCPHost 可以与任何符合 MCP 标准的服务器配合使用。有关示例和参考实现，请参阅 [MCP 服务器仓库](https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Fservers)。\n\n## 贡献 🤝\n\n欢迎贡献！您可以：\n- 通过问题提交 bug 报告或功能请求\n- 创建拉取请求以改进功能\n- 分享您自定义的 MCP 服务器\n- 改进文档\n\n请确保您的贡献遵循良好的编码实践，并包含适当的测试。\n\n## 许可证 📄\n\n本项目采用 MIT 许可证授权——详情请参阅 [LICENSE](LICENSE) 文件。\n\n## 致谢 🙏\n\n- 感谢 Anthropic 团队提供的 Claude 模型和 MCP 规范\n- 感谢 Ollama 团队提供的本地大模型运行时\n- 感谢所有帮助改进这款工具的贡献者","# MCPHost 快速上手指南\n\nMCPHost 是一个命令行宿主应用，基于模型上下文协议（MCP），让大语言模型（LLM）能够安全地调用外部工具。它支持 Claude、OpenAI、Google Gemini 以及 Ollama 等主流模型。\n\n## 环境准备\n\n在开始之前，请确保满足以下系统要求和依赖：\n\n*   **操作系统**：Linux, macOS 或 Windows\n*   **Go 语言环境**：需安装 Go 1.23 或更高版本\n*   **模型访问凭证**（根据选择的模型准备其一）：\n    *   **OpenAI**: `OPENAI_API_KEY`\n    *   **Anthropic (Claude)**: `ANTHROPIC_API_KEY`\n    *   **Google (Gemini)**: `GOOGLE_API_KEY`\n    *   **Ollama**: 本地安装 Ollama 并拉取支持函数调用的模型（如 `mistral`）\n*   **MCP 服务端**：至少一个兼容 MCP 协议的工具服务器（MCPHost 内置了文件系统、Bash、Todo 和 HTTP 等基础服务器，也可连接远程或本地自定义服务器）。\n\n### 环境变量配置示例\n\n在终端中设置你的 API Key（以 OpenAI 为例）：\n\n```bash\nexport OPENAI_API_KEY='your-openai-key'\n# Anthropic\nexport ANTHROPIC_API_KEY='your-anthropic-key'\n# Google\nexport GOOGLE_API_KEY='your-google-key'\n```\n\n若使用 Ollama，请确保服务正在运行：\n```bash\nollama serve\n```\n\n## 安装步骤\n\n推荐使用 Go 官方包管理器进行安装：\n\n```bash\ngo install github.com\u002Fmark3labs\u002Fmcphost@latest\n```\n\n安装完成后，确保 `$GOPATH\u002Fbin` 已添加到你的系统 PATH 环境变量中，以便在任何目录下执行 `mcphost` 命令。\n\n> **提示**：国内开发者若遇到网络问题，可配置 `GOPROXY` 加速下载：\n> ```bash\n> export GOPROXY=https:\u002F\u002Fgoproxy.cn,direct\n> go install github.com\u002Fmark3labs\u002Fmcphost@latest\n> ```\n\n## 基本使用\n\n### 1. 交互式对话（默认模式）\n\n直接运行命令即可进入交互模式。MCPHost 会自动加载内置的基础工具服务器（如文件系统操作、Bash 执行等），你可以直接与大模型对话并让它调用工具。\n\n```bash\nmcphost\n```\n\n启动后，你可以输入类似以下的指令：\n> \"列出当前目录下的文件，并读取 README.md 的内容。\"\n\n### 2. 指定模型与提供商\n\n默认情况下，它会尝试检测环境变量中的 API Key 来选择模型。你也可以通过参数显式指定：\n\n```bash\n# 使用 OpenAI GPT-4\nmcphost --model openai\u002Fgpt-4\n\n# 使用本地 Ollama 模型\nmcphost --model ollama\u002Fmistral --provider-url http:\u002F\u002Flocalhost:11434\n\n# 跳过 TLS 验证（仅用于本地自签名证书开发环境）\nmcphost --provider-url https:\u002F\u002F192.168.1.100:443 --tls-skip-verify\n```\n\n### 3. 非交互式脚本模式\n\n你可以将提示词作为参数传入，用于自动化脚本或管道操作：\n\n```bash\necho \"计算 25 乘以 4 的结果\" | mcphost --non-interactive\n```\n\n或者直接使用 `-p` 标志：\n\n```bash\nmcphost -p \"查看当前系统的内存使用情况\" --non-interactive\n```\n\n### 4. 配置文件进阶（可选）\n\nMCPHost 会在用户主目录自动生成配置文件（`~\u002F.mcphost.yml` 或 `~\u002F.mcphost.json`）。你可以编辑该文件来配置自定义的 MCP 服务器。\n\n**示例：配置一个本地文件系统 MCP 服务器**\n\n创建或编辑 `~\u002F.mcphost.yml`：\n\n```yaml\nmcpServers:\n  filesystem:\n    type: builtin\n    name: fs\n    options:\n      allowed_directories: [\"\u002Ftmp\", \"${env:\u002F\u002FHOME}\u002Fdocuments\"]\n    allowedTools: [\"read_file\", \"write_file\", \"list_directory\"]\n\nmodel: \"anthropic\u002Fclaude-sonnet-4-5-20250929\"\nprovider-api-key: \"${env:\u002F\u002FANTHROPIC_API_KEY}\"\n```\n\n配置完成后，再次运行 `mcphost` 即可生效。支持使用 `${env:\u002F\u002FVAR}` 语法在配置文件中引用环境变量，保障密钥安全。","某后端开发团队需要让 AI 助手自动执行复杂的本地运维任务，包括读取日志文件、运行诊断脚本并更新任务看板。\n\n### 没有 mcphost 时\n- **能力割裂**：AI 只能生成代码或命令文本，开发者必须手动复制粘贴到终端执行，无法形成闭环。\n- **上下文丢失**：每次执行新命令都需要重新向 AI 描述之前的报错信息和环境状态，沟通效率极低。\n- **安全隐患**：为了让 AI 操作本地文件，开发者往往被迫将敏感数据上传至云端对话窗口，存在泄露风险。\n- **集成困难**：若要实现自动化，需编写大量胶水代码来连接 LLM API 与本地工具，维护成本高昂。\n\n### 使用 mcphost 后\n- **原生工具调用**：mcphost 作为主机直接挂载本地文件系统、Bash 和 HTTP 等 MCP 服务器，AI 可直接安全地读取日志或执行脚本。\n- **状态自动保持**：工具执行结果自动回传给模型作为上下文，AI 能基于实时输出连续决策，无需人工重复陈述背景。\n- **数据本地闭环**：所有敏感数据和命令执行均保留在本地环境中，仅通过标准协议交互，彻底杜绝数据外泄。\n- **脚本化自动化**：利用 YAML 脚本模式，可将“检查日志 - 重启服务 - 通知团队”的复杂流程固化为一键执行的自动化任务。\n\nmcphost 通过标准化的 Model Context Protocol，将大语言模型从单纯的“聊天机器人”升级为能安全操控本地环境的“智能运维代理”。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmark3labs_mcphost_daf6737f.png","mark3labs","Mark III Labs","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmark3labs_eee8e60e.png",null,"https:\u002F\u002Fmark3labs.com","https:\u002F\u002Fgithub.com\u002Fmark3labs",[22,26],{"name":23,"color":24,"percentage":25},"Go","#00ADD8",100,{"name":27,"color":28,"percentage":29},"Shell","#89e051",0,1596,230,"2026-04-10T04:28:16","MIT",2,"Linux, macOS, Windows","未说明",{"notes":38,"python":39,"dependencies":40},"该工具基于 Go 语言开发，无需 Python 环境。若使用 Ollama 模型需本地安装 Ollama；若使用云端模型（OpenAI, Anthropic, Google Gemini）需配置对应的 API Key。支持通过 Docker 运行部分 MCP 服务器。","不需要",[41],"Go 1.23+",[43,44,45],"语言模型","Agent","插件","ready","2026-03-27T02:49:30.150509","2026-04-10T22:19:41.034769",[50,55,60,65,70,75],{"id":51,"question_zh":52,"answer_zh":53,"source_url":54},28462,"运行 mcphost 时遇到 'fatal error: all goroutines are asleep - deadlock!' 错误怎么办？","该错误通常发生在配置的 stdio 工具路径错误或服务器启动后立即以非零状态码退出时。请检查配置文件中的 MCP 服务器命令路径是否正确，并确保服务器进程能正常启动且不立即崩溃（退出码应为 0）。如果服务器返回错误的退出码，也会触发此死锁错误。","https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fissues\u002F74",{"id":56,"question_zh":57,"answer_zh":58,"source_url":59},28463,"使用 Ollama 模型时提示 'Anthropic API key not provided' 错误如何解决？","即使使用 Ollama 等本地模型，如果未显式指定模型参数，程序默认会尝试使用 Anthropic  provider 从而报错。请在命令行中使用 `-m` 标志明确指定模型，例如：`-m ollama:qwen2.5:3` 或 `-m openai:gpt-4o-mini`。也可以在 `.mcphost.yml` 配置文件中设置 `model` 字段来解决此问题。建议升级到最新版本以修复相关逻辑。","https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fissues\u002F70",{"id":61,"question_zh":62,"answer_zh":63,"source_url":64},28464,"为什么使用 Ollama 的 Mistral 模型时提示不支持函数调用（function calling）？","部分 Ollama 模型（如 mistral:7b）可能未被识别为支持函数调用，导致工具功能被禁用。虽然某些用户反馈在其他工具中同一模型可用，但在 mcphost 中可能需要特定的模型版本或配置。建议尝试更换为已知支持良好的模型（如 llama3.2），或检查 Ollama 是否为最新版本。如果问题依旧，可能是当前版本对该模型的支持有限。","https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fissues\u002F4",{"id":66,"question_zh":67,"answer_zh":68,"source_url":69},28465,"终端在使用 mcphost 时出现闪烁现象如何解决？","终端闪烁是因为 UI 包在每次接收到 LLM 流式返回结果时都会重绘整个消息历史。目前的临时解决方案是修改内部 UI 逻辑，避免全量重绘。开发者建议未来采用 bubbletea 框架来优化渲染性能。普通用户可尝试更新到最新版本看是否有修复，或者暂时避免使用流式输出模式以减少闪烁。","https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fissues\u002F96",{"id":71,"question_zh":72,"answer_zh":73,"source_url":74},28466,"如何减少 mcphost 的 Token 消耗过快问题？","为了解决上下文过载导致 Token 消耗过快的问题，新版本已默认添加了消息窗口限制，仅保留最近的 10 条消息参与上下文。这将有效减少发送给模型的 token 数量。如果需要更精细的控制，可以关注后续关于 prompt caching（提示词缓存）的功能更新或自行实现相关逻辑。","https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fissues\u002F1",{"id":76,"question_zh":77,"answer_zh":78,"source_url":74},28467,"mcphost 是否支持 OpenRouter 作为模型提供商？","是的，mcphost 已经通过 Pull Request #5 添加了对 OpenRouter 的集成支持。OpenRouter 支持 MCP 协议（兼容 Anthropic 格式），适合需要低成本 API 访问的用户。使用时请按照文档配置相应的 API Key 和基础 URL 即可。",[80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175],{"id":81,"version":82,"summary_zh":83,"released_at":84},189401,"v0.34.0-beta.1","## 更改日志\n* bf2f441 btca\n* be91626 杂项：将所有依赖升级到最新版本\n* ce32cea 新功能：将 charmbracelet 库升级至 v2（bubbletea、lipgloss、bubbles）\n* 0703dd1 修复：消除 spinner tea.Program 实例中的转义序列泄漏问题\n\n","2026-02-25T15:26:24",{"id":86,"version":87,"summary_zh":88,"released_at":89},189402,"v0.34.0","## 更改日志\n* bf2f441 btca\n* be91626 杂项：将所有依赖项升级到最新版本\n* ce32cea 功能：将 charmbracelet 库升级到 v2（bubbletea、lipgloss、bubbles）\n* 0703dd1 修复：消除 spinner tea.Program 实例中的转义序列泄漏\n\n","2026-02-25T15:25:10",{"id":91,"version":92,"summary_zh":93,"released_at":94},189403,"v0.33.4","## 更改日志\n* 191dcea 杂项：更新依赖包以解决安全问题 (#154)\n\n## 变更内容\n* 杂项：由 @ramizpolic 在 https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F154 中更新依赖包，以解决安全问题\n\n## 新贡献者\n* @ramizpolic 在 https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F154 中完成了首次贡献\n\n**完整更改日志**：https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fcompare\u002Fv0.33.3...v0.33.4","2026-02-15T17:06:03",{"id":96,"version":97,"summary_zh":98,"released_at":99},189404,"v0.33.3","## 更改日志\n* c4aa911 特性：为 Claude 模型添加 Google Vertex AI 支持 (#146)\n* a77aab3 修复：将 sonic 升级至 v1.15.0，以兼容 Go 1.26\n","2026-02-02T08:14:43",{"id":101,"version":102,"summary_zh":103,"released_at":104},189405,"v0.33.2","## 更改日志\n* 7ece291 修复 Anthropic API 问题\n\n**完整更改日志**: https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fcompare\u002Fv0.33.1...v0.33.2","2026-01-09T14:43:54",{"id":106,"version":107,"summary_zh":108,"released_at":109},189406,"v0.33.1","## 更改日志\n* f9485cb 新增模型\n\n**完整更改日志**: https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fcompare\u002Fv0.33.0...v0.33.1","2026-01-09T14:35:13",{"id":111,"version":112,"summary_zh":113,"released_at":114},189407,"v0.33.0","## 更改日志\n* 1b3a8c1 修复：将 JSON Schema draft-07 的独占边界转换为 draft-04 格式（#147）\n* c284a20 升级依赖\n\n## 变更内容\n* 修复：由 @corylanou 在 https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F147 中实现，将 JSON Schema draft-07 的独占边界转换为 draft-04 格式\n\n## 新贡献者\n* @corylanou 在 https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F147 中完成了首次贡献\n\n**完整更改日志**：https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fcompare\u002Fv0.32.0...v0.33.0","2026-01-09T14:30:51",{"id":116,"version":117,"summary_zh":118,"released_at":119},189408,"v0.32.0","## 变更内容\n* 功能：新增选项，可在工具执行前要求审批，由 @djoreilly 在 https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F140 中实现。\n* 升级 github.com\u002Fcloudwego\u002Feino 以修复 panic 问题，由 @djoreilly 在 https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F142 中完成。\n\n## 新贡献者\n* @djoreilly 在 https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F140 中完成了首次贡献。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fcompare\u002Fv0.31.4...v0.32.0","2025-12-09T18:38:37",{"id":121,"version":122,"summary_zh":123,"released_at":124},189409,"v0.31.4","## 更改记录\n* 63704f5 godoc\n* 8c1f548 更新依赖\n\n","2025-11-14T14:10:50",{"id":126,"version":127,"summary_zh":128,"released_at":129},189410,"v0.31.3","## 更改日志\n* d3281a2 格式化\n* 1b7cc2e 更新模型\n\n","2025-10-16T13:40:20",{"id":131,"version":132,"summary_zh":133,"released_at":134},189411,"v0.31.2","## Changelog\n* 13acf44 add AGENTS.md\n* d56335e fix: suppress health check logging to debug output only (#135)\n\n","2025-10-16T13:39:03",{"id":136,"version":137,"summary_zh":138,"released_at":139},189412,"v0.31.1","## Changelog\n* 81ec644 Update deps\n* dec5f08 update mcp-go\n\n","2025-10-07T07:40:09",{"id":141,"version":142,"summary_zh":143,"released_at":144},189413,"v0.31.0","## Changelog\n* 4709716 Let viper handle precedence\n* f778379 feat: Add SDK package for programmatic MCPHost usage (#129)\n\n","2025-09-02T12:48:58",{"id":146,"version":147,"summary_zh":148,"released_at":149},189414,"v0.30.1","## Changelog\n* 433bdec fix `--version` output (#128)\n\n","2025-09-02T10:57:54",{"id":151,"version":152,"summary_zh":153,"released_at":154},189415,"v0.30.0","## Changelog\r\n* 4efc2e2 Theme config (#127)\r\n* cc1ab91 Update mcp-go\r\n\r\n## What's Changed\r\n* Theme config by @matscalia in https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F127\r\n\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fcompare\u002Fv0.29.0...v0.30.0","2025-09-02T10:50:38",{"id":156,"version":157,"summary_zh":158,"released_at":159},189416,"v0.29.0","## Changelog\r\n* bce9221 Session flag (#123)\r\n* 4f2f61c Update mcp-go\r\n* 2f42899 Use fang\r\n* d3c04b1 add ollama api key (#124)\r\n\r\n## What's Changed\r\n* Ollama api key by @matscalia in https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F124\r\n* Session flag by @matscalia in https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F123\r\n\r\n## New Contributors\r\n* @matscalia made their first contribution in https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fpull\u002F124\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fmark3labs\u002Fmcphost\u002Fcompare\u002Fv0.28.1...v0.29.0","2025-08-11T17:25:03",{"id":161,"version":162,"summary_zh":163,"released_at":164},189417,"v0.28.1","## Changelog\n* 4808ed2 Upgrade github.com\u002Fbytedance\u002Fsonic to v1.14.0 for Go 1.25 support (#122)\n\n","2025-08-10T06:55:59",{"id":166,"version":167,"summary_zh":168,"released_at":169},189418,"v0.28.0","## Changelog\n* d3f9759 refactor debug messages\n\n","2025-08-08T06:35:49",{"id":171,"version":172,"summary_zh":173,"released_at":174},189419,"v0.27.1","## Changelog\n* 5d83df4 update models\n\n","2025-08-08T05:06:11",{"id":176,"version":177,"summary_zh":178,"released_at":179},189420,"v0.27.0","## Changelog\n* 76741ab Feature\u002Fadd connection pool (#120)\n* fe4db19 feat: add --tls-skip-verify flag for self-signed certificates (#115)\n\n","2025-08-05T14:05:40",[181,193,201,209,217,225],{"id":182,"name":183,"github_repo":184,"description_zh":185,"stars":186,"difficulty_score":187,"last_commit_at":188,"category_tags":189,"status":46},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[44,190,191,192],"开发框架","图像","数据工具",{"id":194,"name":195,"github_repo":196,"description_zh":197,"stars":198,"difficulty_score":187,"last_commit_at":199,"category_tags":200,"status":46},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[190,191,44],{"id":202,"name":203,"github_repo":204,"description_zh":205,"stars":206,"difficulty_score":34,"last_commit_at":207,"category_tags":208,"status":46},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",149489,"2026-04-10T11:32:46",[190,44,43],{"id":210,"name":211,"github_repo":212,"description_zh":213,"stars":214,"difficulty_score":34,"last_commit_at":215,"category_tags":216,"status":46},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[190,191,44],{"id":218,"name":219,"github_repo":220,"description_zh":221,"stars":222,"difficulty_score":34,"last_commit_at":223,"category_tags":224,"status":46},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,44,191,190],{"id":226,"name":227,"github_repo":228,"description_zh":229,"stars":230,"difficulty_score":34,"last_commit_at":231,"category_tags":232,"status":46},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[45,190]]