fantsec-docmost-cli 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/mcp.js +14 -1
  2. package/package.json +1 -1
package/build/mcp.js CHANGED
@@ -3,6 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
+ import { realpathSync } from "fs";
6
7
  import { pathToFileURL } from "url";
7
8
  import { getVersion } from "./program.js";
8
9
  import { executeTool, listMcpTools, parseDocmostBearer, } from "./lib/mcp-tooling.js";
@@ -177,7 +178,19 @@ async function main() {
177
178
  const transport = new StdioServerTransport();
178
179
  await server.connect(transport);
179
180
  }
180
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
181
+ function isDirectExecution() {
182
+ const entrypoint = process.argv[1];
183
+ if (!entrypoint) {
184
+ return false;
185
+ }
186
+ try {
187
+ return import.meta.url === pathToFileURL(realpathSync(entrypoint)).href;
188
+ }
189
+ catch {
190
+ return import.meta.url === pathToFileURL(entrypoint).href;
191
+ }
192
+ }
193
+ if (isDirectExecution()) {
181
194
  main().catch((error) => {
182
195
  const message = error instanceof Error ? error.message : String(error);
183
196
  console.error(`Docmost MCP server error: ${message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fantsec-docmost-cli",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "A Docmost CLI and standard MCP server for documentation automation.",
5
5
  "main": "build/index.js",
6
6
  "bin": {