@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.
- package/build/index.js +17 -13
- 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
|
-
//
|
|
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
|
|
19
|
+
// Fallback: try to read from process.cwd() if running from source
|
|
21
20
|
try {
|
|
22
|
-
const
|
|
23
|
-
const packageJson = JSON.parse(readFileSync(
|
|
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
|
|
27
|
-
|
|
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
|
|
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
|
-
|
|
119
|
-
|
|
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);
|