@udondan/duolingo 1.0.2 → 2.0.1

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 (81) hide show
  1. package/README.md +278 -58
  2. package/dist/cli/config-file.d.ts +22 -0
  3. package/dist/cli/config-file.d.ts.map +1 -0
  4. package/dist/cli/config-file.js +68 -0
  5. package/dist/cli/config-file.js.map +1 -0
  6. package/dist/cli/program.d.ts +25 -0
  7. package/dist/cli/program.d.ts.map +1 -0
  8. package/dist/cli/program.js +190 -0
  9. package/dist/cli/program.js.map +1 -0
  10. package/dist/cli.d.ts +7 -0
  11. package/dist/cli.d.ts.map +1 -0
  12. package/dist/cli.js +8 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/client/duolingo.d.ts +13 -10
  15. package/dist/client/duolingo.d.ts.map +1 -1
  16. package/dist/client/duolingo.js +56 -159
  17. package/dist/client/duolingo.js.map +1 -1
  18. package/dist/client/errors.d.ts +9 -0
  19. package/dist/client/errors.d.ts.map +1 -1
  20. package/dist/client/errors.js +28 -0
  21. package/dist/client/errors.js.map +1 -1
  22. package/dist/client/tts.d.ts +34 -0
  23. package/dist/client/tts.d.ts.map +1 -0
  24. package/dist/client/tts.js +97 -0
  25. package/dist/client/tts.js.map +1 -0
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +2 -2
  28. package/dist/mcp.d.ts +14 -0
  29. package/dist/mcp.d.ts.map +1 -0
  30. package/dist/mcp.js +38 -0
  31. package/dist/mcp.js.map +1 -0
  32. package/dist/tools/account.d.ts.map +1 -1
  33. package/dist/tools/account.js +31 -621
  34. package/dist/tools/account.js.map +1 -1
  35. package/dist/tools/helpers.d.ts +11 -7
  36. package/dist/tools/helpers.d.ts.map +1 -1
  37. package/dist/tools/helpers.js +19 -50
  38. package/dist/tools/helpers.js.map +1 -1
  39. package/dist/tools/language.d.ts.map +1 -1
  40. package/dist/tools/language.js +63 -552
  41. package/dist/tools/language.js.map +1 -1
  42. package/dist/tools/shop.d.ts.map +1 -1
  43. package/dist/tools/shop.js +6 -93
  44. package/dist/tools/shop.js.map +1 -1
  45. package/dist/version.d.ts +3 -0
  46. package/dist/version.d.ts.map +1 -0
  47. package/dist/version.js +4 -0
  48. package/dist/version.js.map +1 -0
  49. package/dist/views/account.d.ts +15 -0
  50. package/dist/views/account.d.ts.map +1 -0
  51. package/dist/views/account.js +118 -0
  52. package/dist/views/account.js.map +1 -0
  53. package/dist/views/language.d.ts +38 -0
  54. package/dist/views/language.d.ts.map +1 -0
  55. package/dist/views/language.js +269 -0
  56. package/dist/views/language.js.map +1 -0
  57. package/dist/views/profile.d.ts +9 -0
  58. package/dist/views/profile.d.ts.map +1 -0
  59. package/dist/views/profile.js +77 -0
  60. package/dist/views/profile.js.map +1 -0
  61. package/dist/views/progress.d.ts +13 -0
  62. package/dist/views/progress.d.ts.map +1 -0
  63. package/dist/views/progress.js +142 -0
  64. package/dist/views/progress.js.map +1 -0
  65. package/dist/views/social.d.ts +9 -0
  66. package/dist/views/social.d.ts.map +1 -0
  67. package/dist/views/social.js +62 -0
  68. package/dist/views/social.js.map +1 -0
  69. package/dist/views/utils.d.ts +13 -0
  70. package/dist/views/utils.d.ts.map +1 -0
  71. package/dist/views/utils.js +30 -0
  72. package/dist/views/utils.js.map +1 -0
  73. package/dist/views/view.d.ts +44 -0
  74. package/dist/views/view.d.ts.map +1 -0
  75. package/dist/views/view.js +54 -0
  76. package/dist/views/view.js.map +1 -0
  77. package/package.json +23 -19
  78. package/dist/server.d.ts +0 -19
  79. package/dist/server.d.ts.map +0 -1
  80. package/dist/server.js +0 -40
  81. package/dist/server.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Utility views: convert between language names and abbreviations.
3
+ */
4
+ import { getClient } from '../client/duolingo.js';
5
+ import { notFound, resolveUserId, textView } from './view.js';
6
+ async function languageCourses(username) {
7
+ const client = getClient();
8
+ const userId = await resolveUserId(client, username);
9
+ const v2 = await client.getUserDataV2(userId);
10
+ return v2.courses.filter((c) => c.subject === 'language');
11
+ }
12
+ export async function languageFromAbbrView(opts) {
13
+ const { language_abbr } = opts;
14
+ const course = (await languageCourses(opts.username)).find((c) => c.learningLanguage === language_abbr || c.topic === language_abbr);
15
+ if (!course) {
16
+ return notFound(`No language found for abbreviation '${language_abbr}'. ` +
17
+ 'Make sure the user is learning this language.');
18
+ }
19
+ return textView(course.title ?? course.learningLanguage ?? language_abbr);
20
+ }
21
+ export async function abbreviationOfView(opts) {
22
+ const { language_name } = opts;
23
+ const course = (await languageCourses(opts.username)).find((c) => (c.title ?? '').toLowerCase() === language_name.toLowerCase());
24
+ if (!course) {
25
+ return notFound(`No abbreviation found for language '${language_name}'. ` +
26
+ 'Make sure the user is learning this language.');
27
+ }
28
+ return textView(course.learningLanguage ?? course.topic);
29
+ }
30
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/views/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEzE,KAAK,UAAU,eAAe,CAAC,QAAiB;IAC9C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAG1C;IACC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CACxD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,KAAK,aAAa,IAAI,CAAC,CAAC,KAAK,KAAK,aAAa,CACzE,CAAC;IACF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,QAAQ,CACb,uCAAuC,aAAa,KAAK;YACvD,+CAA+C,CAClD,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,gBAAgB,IAAI,aAAa,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAGxC;IACC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CACxD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CACrE,CAAC;IACF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,QAAQ,CACb,uCAAuC,aAAa,KAAK;YACvD,+CAA+C,CAClD,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The result of a query, ready to be rendered as JSON or markdown.
3
+ *
4
+ * The MCP tools and the CLI share these views, so both show the same data.
5
+ */
6
+ import type { DuolingoClient } from '../client/duolingo.js';
7
+ export type ResponseFormat = 'markdown' | 'json';
8
+ export interface View {
9
+ /**
10
+ * The JSON payload. `undefined` when the query found nothing to show,
11
+ * `message` then says why.
12
+ */
13
+ data: unknown;
14
+ /** Render the data as markdown. */
15
+ markdown: () => string;
16
+ /**
17
+ * Replaces the JSON and the markdown in MCP replies, e.g. when a list is
18
+ * empty or a language was not found.
19
+ */
20
+ message?: string;
21
+ }
22
+ /** A view that only carries a message, e.g. for an unknown language. */
23
+ export declare function notFound(message: string): View;
24
+ /** A view whose data is a single line of text, such as a URL. */
25
+ export declare function textView(text: string): View;
26
+ export declare function toJson(data: unknown): string;
27
+ /** Render a view the way the MCP tools reply. */
28
+ export declare function renderView(view: View, format: ResponseFormat): string;
29
+ /** Turn a snake_case key into a heading, e.g. `notify_comment` → `Notify Comment`. */
30
+ export declare function titleCase(key: string): string;
31
+ /** The string itself, or `undefined` when it is missing or empty. */
32
+ export declare function nonEmpty(value: string | null | undefined): string | undefined;
33
+ /**
34
+ * A markdown list item `- **Label**: value` as a one-element array, ready to
35
+ * spread into a list of lines. Only numbers and non-empty strings are shown,
36
+ * anything else gives an empty array.
37
+ */
38
+ export declare function bullet(label: string, value: unknown): string[];
39
+ /**
40
+ * Resolve the numeric user ID: the authenticated user when no username is
41
+ * given, otherwise the given user.
42
+ */
43
+ export declare function resolveUserId(client: DuolingoClient, username?: string): Promise<number>;
44
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/views/view.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,IAAI;IACnB;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wEAAwE;AACxE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAE5C;AAED,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAGrE;AAED,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,qEAAqE;AACrE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAI7E;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI9D;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAMjB"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The result of a query, ready to be rendered as JSON or markdown.
3
+ *
4
+ * The MCP tools and the CLI share these views, so both show the same data.
5
+ */
6
+ /** A view that only carries a message, e.g. for an unknown language. */
7
+ export function notFound(message) {
8
+ return { data: undefined, markdown: () => message, message };
9
+ }
10
+ /** A view whose data is a single line of text, such as a URL. */
11
+ export function textView(text) {
12
+ return { data: text, markdown: () => text };
13
+ }
14
+ export function toJson(data) {
15
+ return JSON.stringify(data, null, 2);
16
+ }
17
+ /** Render a view the way the MCP tools reply. */
18
+ export function renderView(view, format) {
19
+ if (view.message !== undefined)
20
+ return view.message;
21
+ return format === 'json' ? toJson(view.data) : view.markdown();
22
+ }
23
+ /** Turn a snake_case key into a heading, e.g. `notify_comment` → `Notify Comment`. */
24
+ export function titleCase(key) {
25
+ return key.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
26
+ }
27
+ /** The string itself, or `undefined` when it is missing or empty. */
28
+ export function nonEmpty(value) {
29
+ return value === null || value === undefined || value === ''
30
+ ? undefined
31
+ : value;
32
+ }
33
+ /**
34
+ * A markdown list item `- **Label**: value` as a one-element array, ready to
35
+ * spread into a list of lines. Only numbers and non-empty strings are shown,
36
+ * anything else gives an empty array.
37
+ */
38
+ export function bullet(label, value) {
39
+ if (typeof value === 'number' || (typeof value === 'string' && value !== ''))
40
+ return [`- **${label}**: ${value}`];
41
+ return [];
42
+ }
43
+ /**
44
+ * Resolve the numeric user ID: the authenticated user when no username is
45
+ * given, otherwise the given user.
46
+ */
47
+ export async function resolveUserId(client, username) {
48
+ if (!username) {
49
+ const userData = await client.getUserData();
50
+ return userData.id;
51
+ }
52
+ return client.getUserIdByUsername(username);
53
+ }
54
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/views/view.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH,wEAAwE;AACxE,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;AAC/D,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAa;IAClC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,UAAU,CAAC,IAAU,EAAE,MAAsB;IAC3D,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC;IACpD,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjE,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,QAAQ,CAAC,KAAgC;IACvD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAC1D,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa,EAAE,KAAc;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC;QAC1E,OAAO,CAAC,OAAO,KAAK,OAAO,KAAK,EAAE,CAAC,CAAC;IACtC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAsB,EACtB,QAAiB;IAEjB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC5C,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@udondan/duolingo",
3
- "version": "1.0.2",
4
- "description": "Duolingo API client library and MCP server",
3
+ "version": "2.0.1",
4
+ "description": "Unofficial SDK, CLI and MCP server for Duolingo",
5
5
  "author": {
6
6
  "name": "Daniel Schroeder",
7
7
  "url": "https://www.udondan.com/"
@@ -23,21 +23,21 @@
23
23
  "keywords": [
24
24
  "duolingo",
25
25
  "api",
26
- "mcp"
26
+ "sdk",
27
+ "cli",
28
+ "mcp",
29
+ "mcp-server"
27
30
  ],
28
31
  "type": "module",
29
32
  "main": "dist/index.js",
30
33
  "types": "dist/index.d.ts",
31
34
  "bin": {
32
- "duolingo-mcp": "dist/server.js"
35
+ "duolingo": "dist/cli.js"
33
36
  },
34
37
  "exports": {
35
38
  ".": {
36
39
  "import": "./dist/index.js",
37
40
  "types": "./dist/index.d.ts"
38
- },
39
- "./server": {
40
- "import": "./dist/server.js"
41
41
  }
42
42
  },
43
43
  "files": [
@@ -50,8 +50,8 @@
50
50
  ],
51
51
  "scripts": {
52
52
  "build": "tsc",
53
- "start": "node dist/server.js",
54
- "dev": "tsx src/server.ts",
53
+ "start": "node dist/cli.js mcp",
54
+ "dev": "tsx src/cli.ts mcp",
55
55
  "test": "vitest run",
56
56
  "test:watch": "vitest",
57
57
  "test:coverage": "vitest run --coverage",
@@ -62,24 +62,28 @@
62
62
  "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\""
63
63
  },
64
64
  "dependencies": {
65
- "@modelcontextprotocol/sdk": "1.32.1",
66
- "axios": "1.20.0",
67
- "zod": "4.6.6"
65
+ "@modelcontextprotocol/sdk": "1.32.2",
66
+ "axios": "1.21.0",
67
+ "commander": "15.0.0",
68
+ "zod": "4.6.7"
68
69
  },
69
70
  "devDependencies": {
70
- "@types/node": "24.19.2",
71
- "@vitest/coverage-v8": "5.0.3",
71
+ "@types/node": "26.6.6",
72
+ "@vitest/coverage-v8": "5.1.0",
72
73
  "axios-mock-adapter": "2.1.0",
73
- "eslint": "10.12.0",
74
+ "eslint": "10.14.0",
74
75
  "eslint-config-prettier": "10.1.8",
75
- "eslint-plugin-prettier": "5.5.6",
76
+ "eslint-plugin-prettier": "5.5.7",
76
77
  "prettier": "3.9.10",
77
78
  "tsx": "4.23.15",
78
79
  "typescript": "5.9.3",
79
- "typescript-eslint": "8.71.1",
80
- "vitest": "5.0.3"
80
+ "typescript-eslint": "8.72.1",
81
+ "vitest": "5.1.0"
81
82
  },
82
83
  "engines": {
83
- "node": "26.11.1"
84
+ "node": ">=22.12.0"
85
+ },
86
+ "overrides": {
87
+ "minimatch": "^11.0.3"
84
88
  }
85
89
  }
package/dist/server.d.ts DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Duolingo MCP Server
4
- *
5
- * A TypeScript MCP server that exposes Duolingo learning data and actions to
6
- * LLM agents via the unofficial Duolingo REST API.
7
- *
8
- * Authentication:
9
- * Set the following environment variables before starting the server:
10
- * - DUOLINGO_USERNAME: Your Duolingo username
11
- * - DUOLINGO_JWT: Your Duolingo JWT token (extracted from browser)
12
- *
13
- * Usage:
14
- * npm run build && npm start
15
- * # or in development:
16
- * npx tsx src/server.ts
17
- */
18
- export {};
19
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG"}
package/dist/server.js DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Duolingo MCP Server
4
- *
5
- * A TypeScript MCP server that exposes Duolingo learning data and actions to
6
- * LLM agents via the unofficial Duolingo REST API.
7
- *
8
- * Authentication:
9
- * Set the following environment variables before starting the server:
10
- * - DUOLINGO_USERNAME: Your Duolingo username
11
- * - DUOLINGO_JWT: Your Duolingo JWT token (extracted from browser)
12
- *
13
- * Usage:
14
- * npm run build && npm start
15
- * # or in development:
16
- * npx tsx src/server.ts
17
- */
18
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
19
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
20
- import { registerAccountTools } from './tools/account.js';
21
- import { registerLanguageTools } from './tools/language.js';
22
- import { registerShopTools } from './tools/shop.js';
23
- const server = new McpServer({
24
- name: 'duolingo_mcp',
25
- version: '1.0.0',
26
- }, {
27
- instructions: 'This server provides access to Duolingo learning data via the unofficial ' +
28
- 'Duolingo API. You can query user profiles, streak information, language ' +
29
- 'progress, topics, words, TTS audio, and more. ' +
30
- 'Authentication requires DUOLINGO_USERNAME and DUOLINGO_JWT environment variables. ' +
31
- 'To get your JWT token: log in to Duolingo in a browser, open the developer ' +
32
- 'console, and run: ' +
33
- "document.cookie.match(new RegExp('(^| )jwt_token=([^;]+)'))[0].slice(11)",
34
- });
35
- registerAccountTools(server);
36
- registerLanguageTools(server);
37
- registerShopTools(server);
38
- const transport = new StdioServerTransport();
39
- await server.connect(transport);
40
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;IACE,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EACV,2EAA2E;QAC3E,0EAA0E;QAC1E,gDAAgD;QAChD,oFAAoF;QACpF,6EAA6E;QAC7E,oBAAoB;QACpB,0EAA0E;CAC7E,CACF,CAAC;AAEF,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC7B,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC9B,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAE1B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}