From e471fcbdca7d4237dc4b3026fb25bc1d1f2a1621 Mon Sep 17 00:00:00 2001 From: Morgan Funtowicz Date: Wed, 30 Apr 2025 22:37:37 +0200 Subject: [PATCH 1/3] fix(mcp): use a more generic folder to put mcp filesystem root --- packages/mcp-client/cli.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/mcp-client/cli.ts b/packages/mcp-client/cli.ts index a838689dd6..f275e52ea3 100644 --- a/packages/mcp-client/cli.ts +++ b/packages/mcp-client/cli.ts @@ -3,6 +3,7 @@ import * as readline from "node:readline/promises"; import { stdin, stdout } from "node:process"; import { join } from "node:path"; import { homedir } from "node:os"; +import { existsSync, mkdirSync } from "node:fs"; import type { StdioServerParameters } from "@modelcontextprotocol/sdk/client/stdio.js"; import type { InferenceProvider } from "@huggingface/inference"; import { ANSI } from "./src/utils"; @@ -12,12 +13,13 @@ import { version as packageVersion } from "./package.json"; const MODEL_ID = process.env.MODEL_ID ?? "Qwen/Qwen2.5-72B-Instruct"; const PROVIDER = (process.env.PROVIDER as InferenceProvider) ?? "nebius"; const BASE_URL = process.env.BASE_URL; +const MCP_LOCAL_FOLDER = join(homedir(), ".mcp"); const SERVERS: StdioServerParameters[] = [ { // Filesystem "official" mcp-server with access to your Desktop command: "npx", - args: ["-y", "@modelcontextprotocol/server-filesystem", join(homedir(), "Desktop")], + args: ["-y", "@modelcontextprotocol/server-filesystem", MCP_LOCAL_FOLDER], }, { // Playwright MCP @@ -31,7 +33,7 @@ if (process.env.EXPERIMENTAL_HF_MCP_SERVER) { // Early version of a HF-MCP server // you can download it from gist.github.com/julien-c/0500ba922e1b38f2dc30447fb81f7dc6 command: "node", - args: ["--disable-warning=ExperimentalWarning", join(homedir(), "Desktop/hf-mcp/index.ts")], + args: ["--disable-warning=ExperimentalWarning", join(MCP_LOCAL_FOLDER, "/hf-mcp/index.ts")], env: { HF_TOKEN: process.env.HF_TOKEN ?? "", }, @@ -49,6 +51,11 @@ async function main() { process.exit(1); } + if(!existsSync(MCP_LOCAL_FOLDER)) { + mkdirSync(MCP_LOCAL_FOLDER); + console.info("created folder", MCP_LOCAL_FOLDER); + } + const agent = new Agent( BASE_URL ? { From ff00c249b3ff99b28b79c8da7944621355d68320 Mon Sep 17 00:00:00 2001 From: Morgan Funtowicz Date: Wed, 30 Apr 2025 22:43:19 +0200 Subject: [PATCH 2/3] misc: lint --- packages/mcp-client/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mcp-client/cli.ts b/packages/mcp-client/cli.ts index f275e52ea3..287f23ecb5 100644 --- a/packages/mcp-client/cli.ts +++ b/packages/mcp-client/cli.ts @@ -51,7 +51,7 @@ async function main() { process.exit(1); } - if(!existsSync(MCP_LOCAL_FOLDER)) { + if (!existsSync(MCP_LOCAL_FOLDER)) { mkdirSync(MCP_LOCAL_FOLDER); console.info("created folder", MCP_LOCAL_FOLDER); } From 7aec4ceb2ceea3b0192755a5abb222dfd1586d5a Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Mon, 12 May 2025 15:29:21 +0200 Subject: [PATCH 3/3] tweak --- packages/mcp-client/cli.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/mcp-client/cli.ts b/packages/mcp-client/cli.ts index 287f23ecb5..ccba8fa8ba 100644 --- a/packages/mcp-client/cli.ts +++ b/packages/mcp-client/cli.ts @@ -3,7 +3,6 @@ import * as readline from "node:readline/promises"; import { stdin, stdout } from "node:process"; import { join } from "node:path"; import { homedir } from "node:os"; -import { existsSync, mkdirSync } from "node:fs"; import type { StdioServerParameters } from "@modelcontextprotocol/sdk/client/stdio.js"; import type { InferenceProvider } from "@huggingface/inference"; import { ANSI } from "./src/utils"; @@ -13,13 +12,13 @@ import { version as packageVersion } from "./package.json"; const MODEL_ID = process.env.MODEL_ID ?? "Qwen/Qwen2.5-72B-Instruct"; const PROVIDER = (process.env.PROVIDER as InferenceProvider) ?? "nebius"; const BASE_URL = process.env.BASE_URL; -const MCP_LOCAL_FOLDER = join(homedir(), ".mcp"); +const MCP_EXAMPLER_LOCAL_FOLDER = process.platform === "darwin" ? join(homedir(), "Desktop") : homedir(); const SERVERS: StdioServerParameters[] = [ { // Filesystem "official" mcp-server with access to your Desktop command: "npx", - args: ["-y", "@modelcontextprotocol/server-filesystem", MCP_LOCAL_FOLDER], + args: ["-y", "@modelcontextprotocol/server-filesystem", MCP_EXAMPLER_LOCAL_FOLDER], }, { // Playwright MCP @@ -32,8 +31,9 @@ if (process.env.EXPERIMENTAL_HF_MCP_SERVER) { SERVERS.push({ // Early version of a HF-MCP server // you can download it from gist.github.com/julien-c/0500ba922e1b38f2dc30447fb81f7dc6 + // and replace the local path below command: "node", - args: ["--disable-warning=ExperimentalWarning", join(MCP_LOCAL_FOLDER, "/hf-mcp/index.ts")], + args: ["--disable-warning=ExperimentalWarning", join(homedir(), "Desktop/hf-mcp/index.ts")], env: { HF_TOKEN: process.env.HF_TOKEN ?? "", }, @@ -51,11 +51,6 @@ async function main() { process.exit(1); } - if (!existsSync(MCP_LOCAL_FOLDER)) { - mkdirSync(MCP_LOCAL_FOLDER); - console.info("created folder", MCP_LOCAL_FOLDER); - } - const agent = new Agent( BASE_URL ? {