diff --git a/extensions/mcp/CHANGELOG.md b/extensions/mcp/CHANGELOG.md index d83f08e2bc..0e153d86e0 100644 --- a/extensions/mcp/CHANGELOG.md +++ b/extensions/mcp/CHANGELOG.md @@ -1,6 +1,9 @@ # Model Context Protocol Changelog -## [Initial Version] - {PR_MERGE_DATE} +## [Fix env issues] - 2025-03-24 +* Fix issue caused by passing `env` in `mcp-config.json` + +## [Initial Version] - 2025-03-24 Introducing the Model Context Protocol integration for Raycast. diff --git a/extensions/mcp/package.json b/extensions/mcp/package.json index 72343246a3..4c669b47df 100644 --- a/extensions/mcp/package.json +++ b/extensions/mcp/package.json @@ -5,6 +5,9 @@ "description": "Interact with the Model Context Protocol (MCP) in Raycast AI", "icon": "mcp-icon.png", "author": "EvanZhouDev", + "contributors": [ + "radzio" + ], "categories": [ "Developer Tools", "Productivity" diff --git a/extensions/mcp/src/getProcessedClients.ts b/extensions/mcp/src/getProcessedClients.ts index 3e5872f1b3..90f1d93f31 100644 --- a/extensions/mcp/src/getProcessedClients.ts +++ b/extensions/mcp/src/getProcessedClients.ts @@ -6,9 +6,27 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; export default async function (clientName?: string) { + function initEnv() { + const shell = os.userInfo().shell || "/bin/sh"; + const command = `LC_ALL=en_US.UTF-8 ${shell} -L -i -c 'printenv'`; + try { + const variables = execSync(command, { encoding: "utf8" }); + variables.split("\n").forEach((line) => { + const [key, value] = line.split("="); + if (key && value) { + process.env[key] = value; + } + }); + } catch (error) { + console.error("Error retrieving shell PATH:", error); + process.env.PATH = process.env.PATH || ""; + } + } + initEnv(); + function getUserShellPath() { const shell = os.userInfo().shell || "/bin/sh"; - const command = `${shell} -l -i -c 'echo $PATH'`; + const command = `${shell} -l -c 'echo $PATH'`; try { const path = execSync(command).toString().trim();