@iborymagic/aseprite-mcp 0.4.2 → 0.4.3

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/index.js +17 -13
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -8,29 +8,27 @@ import { readFileSync } from "node:fs";
8
8
  import { fileURLToPath } from "node:url";
9
9
  let version;
10
10
  try {
11
- // Get the directory of the current file (build/index.js)
12
11
  const __filename = fileURLToPath(import.meta.url);
13
12
  const __dirname = path.dirname(__filename);
14
- // Go up one level from build/ to package root
13
+ // Try to find package.json relative to the build directory
15
14
  const packageJsonPath = path.join(__dirname, "..", "package.json");
16
15
  const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
17
- version = packageJson.version;
16
+ version = packageJson.version || "unknown";
18
17
  }
19
18
  catch (error) {
20
- // Fallback: try process.cwd() if the above fails
19
+ // Fallback: try to read from process.cwd() if running from source
21
20
  try {
22
- const packageJsonPath = path.join(process.cwd(), "package.json");
23
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
24
- version = packageJson.version;
21
+ const fallbackPath = path.join(process.cwd(), "package.json");
22
+ const packageJson = JSON.parse(readFileSync(fallbackPath, "utf8"));
23
+ version = packageJson.version || "unknown";
25
24
  }
26
- catch (fallbackError) {
27
- // If both fail, use default version
28
- version = undefined;
25
+ catch {
26
+ version = "unknown";
29
27
  }
30
28
  }
31
29
  const server = new McpServer({
32
30
  name: "aseprite-mcp",
33
- version: version || "0.1.0"
31
+ version: version
34
32
  });
35
33
  const asepriteToolSchemas = createAsepriteToolSchemas();
36
34
  const luaToolSchemas = createLuaToolSchemas();
@@ -115,8 +113,14 @@ server.registerTool("aseprite_run_lua_script", {
115
113
  inputSchema: luaToolSchemas.aseprite_run_lua_script,
116
114
  }, luaToolHandlers.aseprite_run_lua_script);
117
115
  async function main() {
118
- const transport = new StdioServerTransport();
119
- await server.connect(transport);
116
+ try {
117
+ const transport = new StdioServerTransport();
118
+ await server.connect(transport);
119
+ }
120
+ catch (err) {
121
+ console.error("Failed to connect MCP server:", err);
122
+ process.exit(1);
123
+ }
120
124
  }
121
125
  main().catch(err => {
122
126
  console.error("MCP Error:", err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iborymagic/aseprite-mcp",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "MCP server for using Aseprite API",
5
5
  "main": "index.js",
6
6
  "type": "module",