mr-magic-mcp-server 0.2.0 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-magic-mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Lyrics MCP server connecting LRCLIB, Genius, Musixmatch, and Melon",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -59,16 +59,39 @@
59
59
  "dependencies": {
60
60
  "@modelcontextprotocol/sdk": "^1.27.1",
61
61
  "axios": "^1.13.6",
62
- "cheerio": "^1.0.0-rc.12",
62
+ "cheerio": "^1.2.0",
63
63
  "commander": "^14.0.3",
64
- "dotenv": "^17.3.1",
65
- "hangul-js": "^0.2.6"
64
+ "dotenv": "^17.3.1"
66
65
  },
67
66
  "devDependencies": {
68
67
  "eslint": "^10.0.3",
69
68
  "eslint-config-prettier": "^10.1.8",
70
69
  "eslint-plugin-import-x": "^4.15.1",
71
- "playwright-chromium": "^1.58.2",
70
+ "playwright": "^1.58.2",
72
71
  "prettier": "^3.8.1"
72
+ },
73
+ "overrides": {
74
+ "es-define-property": "npm:@socketregistry/es-define-property@^1",
75
+ "es-set-tostringtag": "npm:@socketregistry/es-set-tostringtag@^1",
76
+ "function-bind": "npm:@socketregistry/function-bind@^1",
77
+ "gopd": "npm:@socketregistry/gopd@^1",
78
+ "has-symbols": "npm:@socketregistry/has-symbols@^1",
79
+ "has-tostringtag": "npm:@socketregistry/has-tostringtag@^1",
80
+ "hasown": "npm:@socketregistry/hasown@^1",
81
+ "object-assign": "npm:@socketregistry/object-assign@^1",
82
+ "safer-buffer": "npm:@socketregistry/safer-buffer@^1",
83
+ "side-channel": "npm:@socketregistry/side-channel@^1"
84
+ },
85
+ "resolutions": {
86
+ "es-define-property": "npm:@socketregistry/es-define-property@^1",
87
+ "es-set-tostringtag": "npm:@socketregistry/es-set-tostringtag@^1",
88
+ "function-bind": "npm:@socketregistry/function-bind@^1",
89
+ "gopd": "npm:@socketregistry/gopd@^1",
90
+ "has-symbols": "npm:@socketregistry/has-symbols@^1",
91
+ "has-tostringtag": "npm:@socketregistry/has-tostringtag@^1",
92
+ "hasown": "npm:@socketregistry/hasown@^1",
93
+ "object-assign": "npm:@socketregistry/object-assign@^1",
94
+ "safer-buffer": "npm:@socketregistry/safer-buffer@^1",
95
+ "side-channel": "npm:@socketregistry/side-channel@^1"
73
96
  }
74
97
  }
@@ -2,7 +2,7 @@
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
 
5
- import { chromium } from 'playwright-chromium';
5
+ import { chromium } from 'playwright';
6
6
  import '../src/utils/config.js';
7
7
 
8
8
  const AUTH_URL = 'https://auth.musixmatch.com/';
@@ -1,7 +1,44 @@
1
- import Hangul from 'hangul-js';
2
-
3
1
  const HANGUL_REGEX = /[\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF]/;
4
2
 
3
+ // Hangul syllable decomposition tables (Unicode standard)
4
+ const HANGUL_INITIALS = [
5
+ 'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ',
6
+ 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
7
+ ];
8
+ const HANGUL_VOWELS = [
9
+ 'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ',
10
+ 'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ'
11
+ ];
12
+ const HANGUL_FINALS = [
13
+ null, 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ',
14
+ 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ',
15
+ 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
16
+ ];
17
+
18
+ /**
19
+ * Decompose a word into grouped jamo arrays — one sub-array per syllable block.
20
+ * Non-Hangul characters are wrapped in a single-element array.
21
+ * Equivalent to hangul-js Hangul.disassemble(word, true).
22
+ */
23
+ function disassembleGrouped(word) {
24
+ const result = [];
25
+ for (const char of word) {
26
+ const cp = char.codePointAt(0);
27
+ if (cp >= 0xac00 && cp <= 0xd7a3) {
28
+ const syllable = cp - 0xac00;
29
+ const initialIdx = Math.floor(syllable / (21 * 28));
30
+ const vowelIdx = Math.floor((syllable % (21 * 28)) / 28);
31
+ const finalIdx = syllable % 28;
32
+ const jamo = [HANGUL_INITIALS[initialIdx], HANGUL_VOWELS[vowelIdx]];
33
+ if (finalIdx > 0) jamo.push(HANGUL_FINALS[finalIdx]);
34
+ result.push(jamo);
35
+ } else {
36
+ result.push([char]);
37
+ }
38
+ }
39
+ return result;
40
+ }
41
+
5
42
  const ROMAN_MAP = {
6
43
  ㄱ: 'g',
7
44
  ㄲ: 'kk',
@@ -69,7 +106,7 @@ function romanizeWord(word) {
69
106
  if (!word) return '';
70
107
  let grouped = [];
71
108
  try {
72
- grouped = Hangul.disassemble(word, true);
109
+ grouped = disassembleGrouped(word);
73
110
  } catch (error) {
74
111
  return word;
75
112
  }