@kakedashi/md-to-article-mcp 1.0.0 → 1.0.2

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/dist/index.js +11 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -33,12 +33,16 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  return result;
34
34
  };
35
35
  })();
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
36
39
  Object.defineProperty(exports, "__esModule", { value: true });
37
40
  const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
38
41
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
39
42
  const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
40
43
  const fs = __importStar(require("fs"));
41
44
  const path = __importStar(require("path"));
45
+ const os_1 = __importDefault(require("os"));
42
46
  const converter_js_1 = require("./converter.js");
43
47
  const clipboard_js_1 = require("./clipboard.js");
44
48
  const server = new index_js_1.Server({ name: "md-to-article-mcp", version: "1.0.0" }, { capabilities: { tools: {} } });
@@ -65,7 +69,13 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
65
69
  throw new Error(`Unknown tool: ${request.params.name}`);
66
70
  }
67
71
  const { filepath } = request.params.arguments;
68
- const resolvedPath = path.resolve(filepath);
72
+ const resolvedPath = path.resolve(filepath.replace(/^~/, os_1.default.homedir()));
73
+ if (path.extname(resolvedPath) !== ".md") {
74
+ return {
75
+ content: [{ type: "text", text: `ファイルの拡張子が .md ではありません: ${filepath}` }],
76
+ isError: true,
77
+ };
78
+ }
69
79
  // ファイル読み込み
70
80
  let markdown;
71
81
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kakedashi/md-to-article-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "MCP tool to convert Markdown files to rich text and copy to clipboard for X Article editor",
5
5
  "main": "dist/index.js",
6
6
  "bin": {