mulmocast-vision 0.1.2 → 0.1.4

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.
package/lib/commons.d.ts CHANGED
@@ -27,3 +27,4 @@ export declare const convertTools: (tools: OpenAITool[]) => {
27
27
  };
28
28
  }[];
29
29
  export declare const generateUniqueId: () => string;
30
+ export declare const formattedDate: () => string;
package/lib/commons.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateUniqueId = exports.convertTools = exports.openAIToolsToAnthropicTools = exports.toolsToTemplateNames = exports.templateNameTofunctionName = exports.functionNameToTemplateName = void 0;
3
+ exports.formattedDate = exports.generateUniqueId = exports.convertTools = exports.openAIToolsToAnthropicTools = exports.toolsToTemplateNames = exports.templateNameTofunctionName = exports.functionNameToTemplateName = void 0;
4
4
  const functionNameToTemplateName = (functionName) => {
5
5
  const tmpName = functionName.replace(/^create/, "");
6
6
  const fileName = tmpName.charAt(0).toLowerCase() + tmpName.slice(1);
@@ -58,3 +58,16 @@ const generateUniqueId = () => {
58
58
  return `${now}-${random}`;
59
59
  };
60
60
  exports.generateUniqueId = generateUniqueId;
61
+ const formattedDate = () => {
62
+ const now = new Date();
63
+ const formatted = [
64
+ now.getFullYear(),
65
+ String(now.getMonth() + 1).padStart(2, "0"),
66
+ String(now.getDate()).padStart(2, "0"),
67
+ String(now.getHours()).padStart(2, "0"),
68
+ String(now.getMinutes()).padStart(2, "0"),
69
+ String(now.getSeconds()).padStart(2, "0"),
70
+ ].join("-");
71
+ return formatted;
72
+ };
73
+ exports.formattedDate = formattedDate;
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.getServer = void 0;
5
5
  const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
6
6
  const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
7
- const tools_1 = require("../tools");
8
- const html_class_1 = require("../presentationHandlers/html_class");
9
- const commons_1 = require("../commons");
7
+ const tools_1 = require("./tools");
8
+ const html_class_1 = require("./presentationHandlers/html_class");
9
+ const commons_1 = require("./commons");
10
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
11
+ const utils_1 = require("./utils");
10
12
  const getServer = (rootDir, outputDir) => {
11
13
  const server = new index_js_1.Server({
12
14
  name: "mulmocast-vision-mcp",
13
- version: "0.1.0",
15
+ version: "0.1.4",
14
16
  }, {
15
17
  capabilities: {
16
18
  tools: {},
@@ -24,6 +26,7 @@ const getServer = (rootDir, outputDir) => {
24
26
  // Handle tool calls
25
27
  server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
26
28
  const { name, arguments: args } = request.params;
29
+ console.error([...tools_1.tools, ...tools_1.mcp_tools]);
27
30
  try {
28
31
  if (args) {
29
32
  const fileName = (0, commons_1.generateUniqueId)();
@@ -55,3 +58,11 @@ const getServer = (rootDir, outputDir) => {
55
58
  return server;
56
59
  };
57
60
  exports.getServer = getServer;
61
+ const main = async () => {
62
+ const rootDir = (0, utils_1.getRootDir)();
63
+ const outputDir = (0, utils_1.getOutDir)();
64
+ const server = (0, exports.getServer)(rootDir, outputDir);
65
+ const transport = new stdio_js_1.StdioServerTransport();
66
+ await server.connect(transport);
67
+ };
68
+ main();
@@ -1,3 +1,2 @@
1
1
  import { type PluginOptionParams, type ToolArgs } from "../type";
2
- export declare const baseDir: string;
3
2
  export declare const callNamedFunction: (functionName: string, args: ToolArgs, options: PluginOptionParams) => Promise<void>;
@@ -3,14 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.callNamedFunction = exports.baseDir = void 0;
6
+ exports.callNamedFunction = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const utils_1 = require("../utils");
9
9
  const commons_1 = require("../commons");
10
10
  const nunjucks_1 = __importDefault(require("nunjucks"));
11
11
  const rootDir = (0, utils_1.getRootDir)();
12
- exports.baseDir = (0, utils_1.getOutDir)();
13
- (0, utils_1.mkdir)(exports.baseDir);
12
+ const baseDir = (0, utils_1.getOutDir)();
14
13
  const filePath = (filename) => {
15
14
  return path_1.default.resolve(rootDir, "./html/html/", `${filename}.html`);
16
15
  };
@@ -19,8 +18,9 @@ const generateHtml = async (args, options) => {
19
18
  if (!functionName) {
20
19
  throw new Error("functionName is required");
21
20
  }
21
+ (0, utils_1.mkdir)(baseDir);
22
22
  const templateFileName = (0, commons_1.functionNameToTemplateName)(functionName);
23
- const outfile = imageFilePath ?? path_1.default.resolve(exports.baseDir, `${outputFileName}.png`);
23
+ const outfile = imageFilePath ?? path_1.default.resolve(baseDir, `${outputFileName}.png`);
24
24
  await (0, utils_1.createPage)(rootDir, outfile, nunjucks_1.default.render(filePath(templateFileName), args));
25
25
  };
26
26
  const callNamedFunction = async (functionName, args, options) => {
@@ -2,19 +2,21 @@ import { type PluginOptionParams, type ToolArgs } from "../type";
2
2
  export declare class htmlPlugin {
3
3
  protected outputDir: string;
4
4
  protected rootDir: string;
5
+ protected htmlDir: string;
5
6
  protected sessionDir: string;
6
7
  protected templateOptions: any;
7
- constructor({ outputDir, rootDir, templateOptions }: {
8
+ constructor({ outputDir, rootDir, templateOptions, htmlDir }: {
8
9
  outputDir?: string;
9
10
  rootDir?: string;
10
11
  templateOptions?: any;
12
+ htmlDir?: string;
11
13
  });
12
14
  callNamedFunction: (functionName: string, args: ToolArgs, options: PluginOptionParams) => Promise<any>;
13
15
  private generateHtml;
14
16
  setDirectory: (args: ToolArgs, __options: PluginOptionParams) => Promise<{
15
17
  text: string;
16
18
  }>;
17
- createPDF: (__args: ToolArgs, __options: PluginOptionParams) => Promise<{
19
+ createPDF: (args: ToolArgs, __options: PluginOptionParams) => Promise<{
18
20
  text: string;
19
21
  } | undefined>;
20
22
  }
@@ -11,7 +11,7 @@ const utils_1 = require("../utils");
11
11
  const commons_1 = require("../commons");
12
12
  const nunjucks_1 = __importDefault(require("nunjucks"));
13
13
  class htmlPlugin {
14
- constructor({ outputDir, rootDir, templateOptions }) {
14
+ constructor({ outputDir, rootDir, templateOptions, htmlDir }) {
15
15
  this.callNamedFunction = async (functionName, args, options) => {
16
16
  const member = this[functionName];
17
17
  if (member && typeof member === "function") {
@@ -25,7 +25,7 @@ class htmlPlugin {
25
25
  throw new Error("functionName is required");
26
26
  }
27
27
  const templateFileName = (0, commons_1.functionNameToTemplateName)(functionName);
28
- const templateFilePath = path_1.default.resolve(this.rootDir, "./html/html2", `${templateFileName}.html`);
28
+ const templateFilePath = path_1.default.resolve(this.rootDir, `./html/${this.htmlDir}`, `${templateFileName}.html`);
29
29
  const outfile = imageFilePath ?? path_1.default.resolve(this.outputDir, this.sessionDir, `${outputFileName}.png`);
30
30
  const htmlFile = htmlFilePath ?? path_1.default.resolve(this.outputDir, this.sessionDir, `${outputFileName}.html`);
31
31
  await (0, utils_1.createPage)(this.rootDir, outfile, nunjucks_1.default.render(templateFilePath, args), { htmlFile, ...this.templateOptions });
@@ -43,7 +43,8 @@ class htmlPlugin {
43
43
  text: `set directory: ${this.sessionDir}`,
44
44
  };
45
45
  };
46
- this.createPDF = async (__args, __options) => {
46
+ this.createPDF = async (args, __options) => {
47
+ const { filename } = args;
47
48
  const imageWidth = 1536;
48
49
  const imageHeight = 1024;
49
50
  const pageWidth = imageWidth * 0.75; // 1152pt
@@ -66,7 +67,7 @@ class htmlPlugin {
66
67
  right: 0,
67
68
  },
68
69
  });
69
- doc.pipe(fs_1.default.createWriteStream(path_1.default.resolve(outputDir, "result.pdf")));
70
+ doc.pipe(fs_1.default.createWriteStream(path_1.default.resolve(outputDir, filename)));
70
71
  files.forEach((f, i) => {
71
72
  if (i > 0) {
72
73
  doc.addPage({
@@ -87,6 +88,7 @@ class htmlPlugin {
87
88
  this.outputDir = outputDir ?? (0, utils_1.getOutDir)();
88
89
  this.rootDir = rootDir ?? (0, utils_1.getRootDir)();
89
90
  this.sessionDir = "";
91
+ this.htmlDir = htmlDir ?? "html2";
90
92
  this.templateOptions = templateOptions ?? {};
91
93
  }
92
94
  }
@@ -66,9 +66,9 @@ exports.mcp_tools = [
66
66
  parameters: {
67
67
  type: "object",
68
68
  properties: {
69
- status: { type: "string", description: "statis" },
69
+ filename: { type: "string", description: "pdf file name" },
70
70
  },
71
- required: ["status"],
71
+ required: ["filename"],
72
72
  },
73
73
  },
74
74
  },
@@ -1,2 +1,2 @@
1
- import { OpenAITool } from "./type";
1
+ import { OpenAITool } from "../type";
2
2
  export declare const mcp_tools: OpenAITool[];
@@ -1,11 +1,11 @@
1
- import { OpenAITool } from "./type";
1
+ import { OpenAITool } from "../type";
2
2
  export declare const toolsBase: OpenAITool[];
3
3
  export declare const tools: {
4
4
  type: "function";
5
5
  function: {
6
6
  name: string;
7
7
  description: string;
8
- parameters: import("./type").ToolParametersSchema;
8
+ parameters: import("../type").ToolParametersSchema;
9
9
  };
10
10
  }[];
11
11
  export declare const toolsForBeat: {
@@ -13,6 +13,6 @@ export declare const toolsForBeat: {
13
13
  function: {
14
14
  name: string;
15
15
  description: string;
16
- parameters: import("./type").ToolParametersSchema;
16
+ parameters: import("../type").ToolParametersSchema;
17
17
  };
18
18
  }[];
package/lib/utils.js CHANGED
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.debugLogger = exports.getOutDir = exports.getRootDir = exports.writeJSONData = exports.mkdir = exports.createPage = exports.getHTMLFile = exports.interpolate = exports.renderHTMLToImage = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
+ const os_1 = __importDefault(require("os"));
9
10
  const puppeteer_1 = __importDefault(require("puppeteer"));
11
+ const commons_1 = require("./commons");
10
12
  const isCI = process.env.CI === "true";
11
13
  const renderHTMLToImage = async (html, outputPath, width, height) => {
12
14
  // Use Puppeteer to render HTML to an image
@@ -70,8 +72,8 @@ const getRootDir = () => {
70
72
  };
71
73
  exports.getRootDir = getRootDir;
72
74
  const getOutDir = () => {
73
- const now = Date.now();
74
- return path_1.default.resolve((0, exports.getRootDir)(), "outdir", String(now));
75
+ const documentsDir = path_1.default.join(os_1.default.homedir(), "Documents");
76
+ return path_1.default.join(documentsDir, "mulmocast-vision", (0, commons_1.formattedDate)());
75
77
  };
76
78
  exports.getOutDir = getOutDir;
77
79
  const debugLogger = (data) => {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "mulmocast-vision",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Slide geneartor",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
7
- "mulmocast-vision": "lib/mcp/cli.js"
7
+ "mulmocast-vision": "lib/mcp.js"
8
8
  },
9
9
  "files": [
10
10
  "./lib",
@@ -33,7 +33,6 @@
33
33
  "license": "AGPL-3.0-or-later",
34
34
  "dependencies": {
35
35
  "@modelcontextprotocol/sdk": "^1.17.5",
36
- "graphai": "^2.0.14",
37
36
  "nunjucks": "^3.2.4",
38
37
  "pdfkit": "^0.17.2",
39
38
  "puppeteer": "^24.19.0"
@@ -44,6 +43,7 @@
44
43
  "eslint": "^9.35.0",
45
44
  "eslint-config-prettier": "^10.1.8",
46
45
  "eslint-plugin-prettier": "^5.5.4",
46
+ "graphai": "^2.0.14",
47
47
  "prettier": "^3.6.2",
48
48
  "ts-node": "^10.9.2",
49
49
  "typescript": "^5.9.2",
package/lib/mcp/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/lib/mcp/cli.js DELETED
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
8
- const utils_1 = require("../utils");
9
- const core_1 = require("./core");
10
- const os_1 = __importDefault(require("os"));
11
- const path_1 = __importDefault(require("path"));
12
- const main = async () => {
13
- const rootDir = (0, utils_1.getRootDir)();
14
- const documentsDir = path_1.default.join(os_1.default.homedir(), "Documents");
15
- const now = Date.now();
16
- const outputDir = path_1.default.join(documentsDir, "mulmocast-vision", String(now));
17
- (0, utils_1.mkdir)(outputDir);
18
- const server = (0, core_1.getServer)(rootDir, outputDir);
19
- const transport = new stdio_js_1.StdioServerTransport();
20
- await server.connect(transport);
21
- };
22
- main();
package/lib/mcp/test.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/lib/mcp/test.js DELETED
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
4
- const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
5
- const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
6
- const server = new index_js_1.Server({
7
- name: "mock-mcp-server",
8
- version: "0.1.0",
9
- }, {
10
- capabilities: {
11
- tools: {},
12
- },
13
- });
14
- // Tool 一覧を返す
15
- server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
16
- return {
17
- tools: [
18
- {
19
- name: "hello",
20
- description: "Return a simple greeting",
21
- inputSchema: { type: "object", properties: {} },
22
- },
23
- {
24
- name: "createSectionDividerPage",
25
- description: "Insert a new slide in the presentation that serves as a section divider. This slide must include both a large main heading and a subtitle. Use this when the user wants to create a single slide that clearly introduces or separates a new section in their presentation.",
26
- inputSchema: {
27
- type: "object",
28
- properties: {
29
- heading: { type: "string", description: "Main section title, shown prominently on the slide" },
30
- subheading: { type: "string", description: "Subtitle that provides context or explanation for the section" },
31
- },
32
- required: ["heading", "subheading"],
33
- },
34
- },
35
- ],
36
- };
37
- });
38
- // Tool 呼び出しを処理
39
- server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
40
- if (request.params.name === "hello") {
41
- return {
42
- content: [{ type: "text", text: "Hello from MCP mock server!" }],
43
- };
44
- }
45
- throw new Error(`Unknown tool: ${request.params.name}`);
46
- });
47
- // エントリポイント
48
- async function main() {
49
- const transport = new stdio_js_1.StdioServerTransport();
50
- await server.connect(transport);
51
- console.error("✅ MCP Mock Server running on stdio");
52
- }
53
- main().catch((err) => {
54
- console.error("❌ Failed to start server:", err);
55
- process.exit(1);
56
- });
File without changes
File without changes
File without changes