Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mcp extension #17978

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions extensions/mcp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Model Context Protocol Changelog

## [Fix env issues] - {PR_MERGE_DATE}
* Fix issue caused by passing `env` in `mcp-config.json`

## [Initial Version] - {PR_MERGE_DATE}

Introducing the Model Context Protocol integration for Raycast.
Expand Down
3 changes: 3 additions & 0 deletions extensions/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
20 changes: 19 additions & 1 deletion extensions/mcp/src/getProcessedClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading