YepCode MCP Server

官方

在 YepCode 安全且可擴展的沙箱環境中執行任何 LLM 生成的程式碼,並使用 JavaScript 或 Python 建立自己的 MCP 工具,完整支援 NPM 和 PyPI 套件。

文件

YepCode MCP Server Preview

NPM version NPM Downloads GitHub Workflow Status

Trust Score smithery badge

什麼是 YepCode MCP Server?

一個 MCP(模型上下文協定)伺服器,讓 AI 平台能夠與 YepCode 的基礎設施互動。執行 LLM 生成的腳本,並將您的 YepCode 流程轉變為 AI 助理可以直接使用的強大工具。YepCode 是建立動態 MCP 工具伺服器的完美環境:將每個流程作為一個工具公開(支援 OAuth、API 權杖或您的憑證),使用 JSON Schema 定義每個工具的參數以獲得完全的靈活性,並以 PythonNode.js 實作工具——全部在一個混合多種語言的伺服器中完成。

為什麼選擇 YepCode MCP Server?

  • 無縫 AI 整合:零設定將 YepCode 流程轉換為 AI 就緒的工具
  • 即時流程控制:讓 AI 系統與您的工作流程直接互動
  • 企業級安全性:在 YepCode 隔離的、生產就緒的環境中執行程式碼
  • 通用相容性:與任何支援模型上下文協定的 AI 平台整合

YepCode:動態 MCP 工具伺服器的完美環境

YepCode 是專為運行動態 MCP 工具伺服器而打造的理想平台:

  • 一個流程,一個工具:每個 YepCode 流程都可以作為 MCP 工具公開。為您的流程加上標籤(例如 mcp-toolcoreautomation),它們就會變成 AI 助理可以調用的工具。您可以使用 OAuthAPI 權杖或您現有的 YepCode 憑證來保護存取權——每個工具都在您的工作區中以相同的安全模型運行。

  • 完全控制工具參數:每個工具都可以使用 JSON Schema 定義自己的參數結構描述。您可以完全靈活地描述輸入(類型、描述、必填欄位、列舉、預設值等),讓 AI 獲得豐富的中繼資料,並能正確地調用您的工具。

  • 多語言工具實作:使用 PythonNode.js(或兩者兼具)實作工具。同一個 MCP 伺服器可以公開由不同執行環境支援的工具——將其視為一個混合多種語言實作的 MCP 伺服器。

如需完整文件,請參閱 YepCode MCP Server 文件

安裝

此套件讓您可以在本地或您自己的基礎設施中運行 YepCode MCP 伺服器(NPX、Docker 或自訂部署)。與 CursorClaude Desktop 等 AI 平台整合。

提示: 從您的 YepCode 帳戶,您也可以存取一個託管的 MCP 伺服器,無需本地安裝。連線 URL 始終為:https://cloud.yepcode.io/mcp

先決條件

取得您的 YepCode API 憑證:

  1. 註冊 YepCode Cloud
  2. 前往 Settings > API credentials 建立新的 API 權杖。

使用 NPX

請確保您已安裝 Node.js(版本 18 或更高),並使用類似以下的設定:

{
  "mcpServers": {
    "yepcode-mcp-server": {
      "command": "npx",
      "args": ["-y", "@yepcode/mcp-server"],
      "env": {
        "YEPCODE_API_TOKEN": "your_api_token_here"
      }
    }
  }
}

使用 Docker

  1. 建置容器映像檔:
docker build -t yepcode/mcp-server .
  1. 使用類似以下的設定:
{
  "mcpServers": {
    "yepcode-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-d",
        "-e",
        "YEPCODE_API_TOKEN=your_api_token_here",
        "yepcode/mcp-server"
      ]
    }
  }
}

除錯

由於 MCP 伺服器透過 stdio 進行通訊,除錯可能有些棘手。為了簡化此過程,我們建議使用 MCP Inspector,您可以透過以下指令執行:

npm run inspector

這將啟動一個伺服器,您可以直接在瀏覽器中存取除錯工具。

YepCode MCP 工具參考

MCP 伺服器提供多個工具來與 YepCode 的基礎設施互動:

程式碼執行

run_code

在 YepCode 的安全環境中執行程式碼。

// Input
{
  code: string;                          // The code to execute
  options?: {
    language?: string;                   // Programming language (default: 'javascript')
    comment?: string;                    // Execution context
    settings?: Record<string, unknown>;  // Runtime settings
  }
}

// Response
{
  returnValue?: unknown;                 // Execution result
  logs?: string[];                       // Console output
  error?: string;                        // Error message if execution failed
}
MCP 選項

YepCode MCP 伺服器支援以下選項:

  • runCodeCleanup:跳過 run_code 清理。預設情況下,run_code 流程的原始碼會在執行後移除。如果您想保留它以用於稽核目的,可以使用此選項。
  • skipCodingRules:跳過在 run_code 工具定義中包含編碼規則。預設情況下,YepCode 文件中的 JavaScript 和 Python 編碼規則會包含在工具結構描述中,以引導 AI 生成的程式碼。如果您想跳過此項以加快工具初始化或縮小工具定義,可以使用此選項。

選項可以作為逗號分隔的清單,透過 YEPCODE_MCP_OPTIONS 環境變數傳遞。

工具選擇

您可以透過設定 YEPCODE_MCP_TOOLS 環境變數來控制啟用哪些工具,該變數接受以逗號分隔的工具類別和流程標籤清單:

內建工具類別:

  • run_code:啟用程式碼執行工具
  • yc_api:啟用所有基本的 API 管理工具(流程、排程、變數、儲存、執行、模組)
  • yc_api_full:啟用所有 API 管理工具,包括版本相關工具(擴展 yc_api,增加額外的流程和模組版本管理工具)
  • 任何特定的 API 工具名稱(例如 execute_process_syncget_execution 等)

流程標籤:

  • 您在 YepCode 流程中使用的任何標籤(例如 mcp-toolcoreautomation 等)
  • 當您指定流程標籤時,所有帶有該標籤的流程將作為獨立的 MCP 工具公開
  • 流程工具將使用流程 slug 命名(如果名稱超過 60 個字元,則會加上 yc_ 前綴和流程 ID)

如果未指定,預設會啟用所有內建工具,但不會公開任何流程工具。

// NPX configuration with options
{
  "mcpServers": {
    "yepcode-mcp-server": {
      "command": "npx",
      "args": ["-y", "@yepcode/mcp-server"],
      "env": {
        "YEPCODE_API_TOKEN": "your_api_token_here",
        "YEPCODE_MCP_OPTIONS": "runCodeCleanup,skipCodingRules",
        "YEPCODE_MCP_TOOLS": "run_code,yc_api,mcp-tool,core"
      }
    }
  }
}

範例情境:

  • YEPCODE_MCP_TOOLS=run_code,yc_api - 啟用內建的程式碼執行和基本 API 管理工具
  • YEPCODE_MCP_TOOLS=run_code,yc_api_full - 啟用內建的程式碼執行和所有 API 管理工具(包括版本管理)
  • YEPCODE_MCP_TOOLS=core,automation - 僅將標記為 "core" 或 "automation" 的流程公開為工具
  • YEPCODE_MCP_TOOLS=run_code,yc_api,core - 啟用內建工具以及所有標記為 "core" 的流程

環境管理

set_env_var

在 YepCode 工作區中設定環境變數。

// Input
{
  key: string;                           // Variable name
  value: string;                         // Variable value
  isSensitive?: boolean;                 // Whether to mask the value in logs (default: true)
}

remove_env_var

從 YepCode 工作區中移除環境變數。

// Input
{
  key: string;                           // Name of the variable to remove
}

儲存管理

YepCode 提供內建的儲存系統,讓您可以上傳、列出、下載和刪除檔案。這些檔案可以在您的程式碼執行中透過 yepcode.storage 輔助方法存取。

list_files

列出您 YepCode 儲存中的所有檔案。

// Input
{
  prefix?: string;                       // Optional prefix to filter files
}

// Response
{
  files: Array<{
    filename: string;                    // File name or path
    size: number;                        // File size in bytes
    lastModified: string;                // Last modification date
  }>;
}

upload_file

上傳檔案到 YepCode 儲存。

// Input
{
  filename: string;                      // File path (e.g., 'file.txt' or 'folder/file.txt')
  content: string | {                   // File content
    data: string;                        // Base64 encoded content for binary files
    encoding: "base64";
  };
}

// Response
{
  success: boolean;                      // Upload success status
  filename: string;                      // Uploaded file path
}

download_file

從 YepCode 儲存下載檔案。

// Input
{
  filename: string;                      // File path to download
}

// Response
{
  filename: string;                      // File path
  content: string;                       // File content (base64 for binary files)
  encoding?: string;                     // Encoding type if binary
}

delete_file

從 YepCode 儲存刪除檔案。

// Input
{
  filename: string;                      // File path to delete
}

// Response
{
  success: boolean;                      // Deletion success status
  filename: string;                      // Deleted file path
}

流程執行

MCP 伺服器可以將您的 YepCode 流程公開為獨立的 MCP 工具,讓 AI 助理可以直接存取。此功能透過在 YEPCODE_MCP_TOOLS 環境變數中指定流程標籤來啟用。

運作方式:

  1. 為您的 YepCode 流程加上任何標籤(例如 coreapiautomationmcp-tool 等)
  2. 將這些標籤新增到 YEPCODE_MCP_TOOLS 環境變數中
  3. 所有帶有指定標籤的流程將作為獨立的 MCP 工具公開

每個公開的流程都會有一個工具,使用流程 slug 命名(如果工具名稱超過 60 個字元,則會加上 yc_ 前綴和流程 ID)。

如需更多關於流程標籤的資訊,請參閱我們的流程標籤文件

<process_slug>

// Input
{
  parameters?: any;                      // This should match the input parameters specified in the process
  options?: {
    tag?: string;                        // Process version to execute
    comment?: string;                    // Execution context
  };
  synchronousExecution?: boolean;        // Whether to wait for completion (default: true)
}

// Response (synchronous execution)
{
  executionId: string;                   // Unique execution identifier
  logs: string[];                        // Process execution logs
  returnValue?: unknown;                 // Process output
  error?: string;                        // Error message if execution failed
}

// Response (asynchronous execution)
{
  executionId: string;                   // Unique execution identifier
}

API 管理工具

API 管理工具類別(yc_apiyc_api_full)提供全面的 API 存取權,以管理工作區的各個方面:

基本 API 工具(yc_api): yc_api 標籤啟用標準的 API 管理工具,用於工作區的核心操作。

擴展 API 工具(yc_api_full): yc_api_full 標籤包含 yc_api 的所有功能,外加用於管理流程和模組版本的額外工具。

流程管理:

  • get_processes - 列出流程,可選過濾
  • create_process - 使用原始碼建立新流程
  • get_process - 取得流程詳細資訊
  • update_process - 更新現有流程
  • delete_process - 刪除流程
  • get_process_versions - 取得流程版本(需要 yc_api_full
  • execute_process_async - 非同步執行流程
  • execute_process_sync - 同步執行流程
  • schedule_process - 排程自動執行流程

排程管理:

  • get_schedules - 列出已排程的流程
  • get_schedule - 取得排程詳細資訊
  • pause_schedule - 暫停已排程的流程
  • resume_schedule - 恢復已暫停的排程
  • delete_schedule - 刪除排程
  • update_schedule - 更新已排程的流程

變數管理:

  • get_variables - 列出團隊變數
  • create_variable - 建立新變數
  • update_variable - 更新現有變數
  • delete_variable - 刪除變數

儲存管理:

  • get_storage_objects - 列出儲存物件
  • upload_storage_object - 上傳檔案到儲存
  • download_storage_object - 從儲存下載檔案
  • delete_storage_object - 從儲存刪除檔案

執行管理:

  • get_executions - 列出執行,可選過濾
  • get_execution - 從 API 取得執行詳細資訊
  • kill_execution - 終止正在執行的執行
  • rerun_execution - 重新執行先前的執行
  • get_execution_logs - 取得執行日誌

模組管理:

  • get_modules - 列出腳本庫模組
  • create_module - 建立新模組
  • get_module - 取得模組詳細資訊
  • delete_module - 刪除模組
  • get_module_versions - 取得模組版本(需要 yc_api_full
  • get_module_version - 取得特定模組版本(需要 yc_api_full
  • delete_module_version - 刪除模組版本(需要 yc_api_full
  • get_module_aliases - 取得模組版本別名(需要 yc_api_full

授權

本專案採用 MIT 授權條款 - 詳情請參閱 LICENSE 檔案。