From 0f43e856cbd2030e0fb2e51e30da5519ef151d68 Mon Sep 17 00:00:00 2001 From: Nat Date: Wed, 28 Jan 2026 17:28:41 +0800 Subject: [PATCH 1/2] FIX: expand ~ in profile paths before reading file When passing --profile ~/.mcps/foo.json, the shell does not expand ~ if the argument is quoted or passed programmatically (e.g. from Claude Code MCP config). Use os.homedir() to resolve ~ at the start of the path so profile loading works regardless of how the argument arrives. --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 99a1ef0..4b66b07 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ #!/usr/bin/env node import { readFile } from "node:fs/promises"; import { createServer } from "node:http"; +import { homedir } from "node:os"; import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; @@ -82,7 +83,8 @@ type Profile = z.infer; async function loadProfile(path?: string): Promise> { if (!path) return {}; - const txt = await readFile(path, "utf8"); + const resolved = path.replace(/^~(?=$|\/)/, homedir()); + const txt = await readFile(resolved, "utf8"); const raw = JSON.parse(txt); const parsed = ProfileSchema.partial().safeParse(raw); if (!parsed.success) throw new Error(`Invalid profile JSON: ${parsed.error.message}`); From 62488e8b22786c3101ded5370cc4e04e7a2c5b38 Mon Sep 17 00:00:00 2001 From: Nat Date: Thu, 29 Jan 2026 16:08:20 +0800 Subject: [PATCH 2/2] bump version to 0.2.5 for release --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f90d3..5628809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.2.5](https://github.com/discourse/discourse-mcp/compare/v0.2.4...v0.2.5) (2026-01-29) + +### Bug Fixes + +* Expand `~` in `--profile` paths before reading file + ## [0.2.4](https://github.com/discourse/discourse-mcp/compare/v0.2.3...v0.2.4) (2026-01-20) ### Features diff --git a/package.json b/package.json index 3ae9ac4..30aa6f5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@discourse/mcp", "mcpName": "io.github.discourse/mcp", - "version": "0.2.4", + "version": "0.2.5", "description": "Discourse MCP CLI server (stdio) exposing Discourse tools via MCP", "author": "Discourse", "license": "MIT",