@yepcode/mcp-server
Advanced tools
+5
-3
@@ -8,10 +8,12 @@ #!/usr/bin/env node | ||
| const main = async () => { | ||
| let disableRunCodeTool = false; | ||
| let tools; | ||
| let runCodeCleanup = false; | ||
| if (process.env.YEPCODE_MCP_OPTIONS) { | ||
| const mcpOptions = process.env.YEPCODE_MCP_OPTIONS.split(","); | ||
| disableRunCodeTool = mcpOptions.includes("disableRunCodeTool"); | ||
| runCodeCleanup = mcpOptions.includes("runCodeCleanup"); | ||
| } | ||
| const server = new YepCodeMcpServer({}, { logsToStderr: true, disableRunCodeTool, runCodeCleanup }); | ||
| if (process.env.YEPCODE_MCP_TOOLS) { | ||
| tools = process.env.YEPCODE_MCP_TOOLS.split(",").map((tool) => tool.trim()); | ||
| } | ||
| const server = new YepCodeMcpServer({}, { logsToStderr: true, tools, runCodeCleanup }); | ||
| try { | ||
@@ -18,0 +20,0 @@ const transport = new StdioServerTransport(); |
+3
-3
@@ -8,7 +8,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; | ||
| private logger; | ||
| private disableRunCodeTool; | ||
| private tools; | ||
| private runCodeCleanup; | ||
| constructor(config: YepCodeApiConfig, { logsToStderr, disableRunCodeTool, runCodeCleanup, }?: { | ||
| constructor(config: YepCodeApiConfig, { logsToStderr, tools, runCodeCleanup, }?: { | ||
| logsToStderr?: boolean; | ||
| disableRunCodeTool?: boolean; | ||
| tools?: string[]; | ||
| runCodeCleanup?: boolean; | ||
@@ -15,0 +15,0 @@ }); |
+31
-13
@@ -14,5 +14,16 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js"; | ||
| const RUN_PROCESS_TOOL_TAG = "mcp-tool"; | ||
| const RUN_CODE_TOOL_TAG = "run_code"; | ||
| const EXECUTIONS_TOOL_TAG = "executions"; | ||
| const ENV_VARS_TOOL_TAG = "env_vars"; | ||
| const STORAGE_TOOL_TAG = "storage"; | ||
| const DEFAULT_TOOL_TAGS = [ | ||
| RUN_CODE_TOOL_TAG, | ||
| EXECUTIONS_TOOL_TAG, | ||
| ENV_VARS_TOOL_TAG, | ||
| STORAGE_TOOL_TAG, | ||
| RUN_PROCESS_TOOL_TAG, | ||
| ]; | ||
| dotenv.config(); | ||
| class YepCodeMcpServer extends Server { | ||
| constructor(config, { logsToStderr = false, disableRunCodeTool = false, runCodeCleanup = false, } = {}) { | ||
| constructor(config, { logsToStderr = false, tools = DEFAULT_TOOL_TAGS, runCodeCleanup = false, } = {}) { | ||
| super({ | ||
@@ -28,3 +39,3 @@ name: "yepcode-mcp-server", | ||
| }); | ||
| this.disableRunCodeTool = disableRunCodeTool; | ||
| this.tools = tools; | ||
| this.runCodeCleanup = runCodeCleanup; | ||
@@ -128,8 +139,13 @@ this.setupHandlers(); | ||
| this.logger.info(`Handling ListTools request`); | ||
| const tools = [ | ||
| ...envVarsToolDefinitions, | ||
| ...storageToolDefinitions, | ||
| ...getExecutionToolDefinitions, | ||
| ]; | ||
| if (!this.disableRunCodeTool) { | ||
| const tools = []; | ||
| if (this.tools.includes(EXECUTIONS_TOOL_TAG)) { | ||
| tools.push(...getExecutionToolDefinitions); | ||
| } | ||
| if (this.tools.includes(STORAGE_TOOL_TAG)) { | ||
| tools.push(...storageToolDefinitions); | ||
| } | ||
| if (this.tools.includes(ENV_VARS_TOOL_TAG)) { | ||
| tools.push(...envVarsToolDefinitions); | ||
| } | ||
| if (this.tools.includes(RUN_CODE_TOOL_TAG)) { | ||
| const envVars = await this.yepCodeEnv.getEnvVars(); | ||
@@ -141,3 +157,7 @@ tools.push(...(await runCodeToolDefinitions(envVars))); | ||
| while (true) { | ||
| const processes = await this.yepCodeApi.getProcesses({ page, limit }); | ||
| const processes = await this.yepCodeApi.getProcesses({ | ||
| page, | ||
| limit, | ||
| tags: this.tools, | ||
| }); | ||
| this.logger.info(`Found ${processes?.data?.length} processes`); | ||
@@ -147,5 +167,3 @@ if (!processes.data) { | ||
| } | ||
| tools.push(...processes.data | ||
| .filter((process) => process.tags?.includes(RUN_PROCESS_TOOL_TAG)) | ||
| .map((process) => { | ||
| tools.push(...processes.data.map((process) => { | ||
| const inputSchema = zodToJsonSchema(RunProcessSchema); | ||
@@ -201,3 +219,3 @@ if (!isEmpty(process.parametersSchema)) { | ||
| case runCodeToolNames.runCode: | ||
| if (this.disableRunCodeTool) { | ||
| if (!this.tools.includes(RUN_CODE_TOOL_TAG)) { | ||
| this.logger.error("Run code tool is disabled"); | ||
@@ -204,0 +222,0 @@ throw new McpError(ErrorCode.MethodNotFound, "Run code tool is disabled"); |
+2
-2
| { | ||
| "name": "@yepcode/mcp-server", | ||
| "version": "0.10.0", | ||
| "version": "0.11.0", | ||
| "description": "MCP server for YepCode", | ||
@@ -53,3 +53,3 @@ "main": "dist/index.js", | ||
| "@modelcontextprotocol/sdk": "^1.17.0", | ||
| "@yepcode/run": "^1.8.0", | ||
| "@yepcode/run": "^1.9.0", | ||
| "dotenv": "^16.4.7", | ||
@@ -56,0 +56,0 @@ "zod": "^3.24.2" |
+42
-11
@@ -1,2 +0,2 @@ | ||
|  | ||
|  | ||
@@ -8,2 +8,4 @@ <div align="center"> | ||
| [](https://github.com/yepcode/mcp-server-js/actions) | ||
| [](https://archestra.ai/mcp-catalog/yepcode__mcp-server-js) | ||
| [](https://smithery.ai/server/@yepcode/mcp-server) | ||
@@ -15,3 +17,3 @@ | ||
| An MCP ([Model Context Protocol](https://modelcontextprotocol.io/introduction)) server that enables AI platforms to interact with [YepCode](https://yepcode.io)'s infrastructure. Run LLM generated scripts and turn your YepCode processes into powerful tools that AI assistants can use directly. | ||
| An MCP ([Model Context Protocol](https://modelcontextprotocol.io/introduction)) server that enables AI platforms to interact with [YepCode](https://yepcode.io/l/LQUKe)'s infrastructure. Run LLM generated scripts and turn your YepCode processes into powerful tools that AI assistants can use directly. | ||
@@ -31,3 +33,3 @@ ### Why YepCode MCP Server? | ||
| 1. Sign up to [YepCode Cloud](https://cloud.yepcode.io) | ||
| 1. Sign up to [YepCode Cloud](https://yepcode.io/l/LQUKe) | ||
| 2. Visit `Settings` > `API credentials` to create a new API token. | ||
@@ -154,13 +156,29 @@ | ||
| - Disable the run_code tool: In some cases, you may want to disable the `run_code` tool. For example, if you want to use the MCP server as a provider only for the existing tools in your YepCode account. | ||
| - Skip the run_code cleanup: By default, run_code processes source code is removed after execution. If you want to keep it for audit purposes, you can use this option. | ||
| - `runCodeCleanup`: Skip the run_code cleanup. By default, run_code processes source code is removed after execution. If you want to keep it for audit purposes, you can use this option. | ||
| Options can be passed as a comma-separated list in the `YEPCODE_MCP_OPTIONS` environment variable or as a query parameter in the MCP server URL. | ||
| Options can be passed as a comma-separated list in the `YEPCODE_MCP_OPTIONS` environment variable. | ||
| ##### Tool Selection | ||
| You can control which tools are enabled by setting the `YEPCODE_MCP_TOOLS` environment variable with a comma-separated list of tool categories and process tags: | ||
| **Built-in tool categories:** | ||
| - `run_code`: Enables the code execution tool | ||
| - `executions`: Enables execution management tools | ||
| - `env_vars`: Enables environment variable management tools | ||
| - `storage`: Enables storage management tools | ||
| **Process tags:** | ||
| - Any tag used in your YepCode processes (e.g., `mcp-tool`, `core`, `api`, `automation`, etc.) | ||
| - When you specify a process tag, all processes with that tag will be exposed as individual MCP tools | ||
| - Process tools will be named `run_ycp_<process_slug>` (or `run_ycp_<process_id>` if the name is longer than 60 characters) | ||
| If not specified, all built-in tools are enabled by default, but no process tools will be exposed. | ||
| ```typescript | ||
| // SSE server configuration | ||
| // SSE server configuration with options | ||
| { | ||
| "mcpServers": { | ||
| "yepcode-mcp-server": { | ||
| "url": "https://cloud.yepcode.io/mcp/sk-c2E....RD/sse?mcpOptions=disableRunCodeTool,runCodeCleanup" | ||
| "url": "https://cloud.yepcode.io/mcp/sk-c2E....RD/sse?mcpOptions=runCodeCleanup&tools=run_code,storage,env_vars,core,api" | ||
| } | ||
@@ -170,3 +188,3 @@ } | ||
| // NPX configuration | ||
| // NPX configuration with options | ||
| { | ||
@@ -179,3 +197,4 @@ "mcpServers": { | ||
| "YEPCODE_API_TOKEN": "your_api_token_here", | ||
| "YEPCODE_MCP_OPTIONS": "disableRunCodeTool,runCodeCleanup" | ||
| "YEPCODE_MCP_OPTIONS": "runCodeCleanup", | ||
| "YEPCODE_MCP_TOOLS": "run_code,storage,env_vars,core,api" | ||
| } | ||
@@ -187,2 +206,7 @@ } | ||
| **Example scenarios:** | ||
| - `YEPCODE_MCP_TOOLS=run_code,storage` - Only enables built-in code execution and storage tools | ||
| - `YEPCODE_MCP_TOOLS=core,automation` - Only exposes processes tagged with "core" or "automation" as tools | ||
| - `YEPCODE_MCP_TOOLS=run_code,storage,core` - Enables built-in tools plus all processes tagged with "core" | ||
| ### Environment Management | ||
@@ -296,6 +320,13 @@ | ||
| The MCP server can expose your YepCode Processes as individual MCP tools, making them directly accessible to AI assistants. This feature is enabled by just adding the `mcp-tool` tag to your process (see our docs to learn more about [process tags](https://yepcode.io/docs/processes/tags)). | ||
| The MCP server can expose your YepCode Processes as individual MCP tools, making them directly accessible to AI assistants. This feature is enabled by specifying process tags in the `YEPCODE_MCP_TOOLS` environment variable. | ||
| **How it works:** | ||
| 1. Tag your YepCode processes with any tag (e.g., `core`, `api`, `automation`, `mcp-tool`, etc.) | ||
| 2. Add those tags to the `YEPCODE_MCP_TOOLS` environment variable | ||
| 3. All processes with the specified tags will be exposed as individual MCP tools | ||
| There will be a tool for each exposed process: `run_ycp_<process_slug>` (or `run_ycp_<process_id>` if tool name is longer than 60 characters). | ||
| For more information about process tags, see our [process tags documentation](https://yepcode.io/docs/processes/tags). | ||
| #### run_ycp_<process_slug> | ||
@@ -302,0 +333,0 @@ |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
51727
4.24%1021
2%373
9.06%1
-50%6
50%Updated