@nanogpt/mcp 1.0.0

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 (57) hide show
  1. package/dist/activeRequests.d.ts +26 -0
  2. package/dist/activeRequests.d.ts.map +1 -0
  3. package/dist/activeRequests.js +39 -0
  4. package/dist/activeRequests.js.map +1 -0
  5. package/dist/config.d.ts +35 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +136 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/httpClient.d.ts +36 -0
  10. package/dist/httpClient.d.ts.map +1 -0
  11. package/dist/httpClient.js +211 -0
  12. package/dist/httpClient.js.map +1 -0
  13. package/dist/index.d.ts +18 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +168 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/resources.d.ts +68 -0
  18. package/dist/resources.d.ts.map +1 -0
  19. package/dist/resources.js +198 -0
  20. package/dist/resources.js.map +1 -0
  21. package/dist/toolUtils.d.ts +115 -0
  22. package/dist/toolUtils.d.ts.map +1 -0
  23. package/dist/toolUtils.js +369 -0
  24. package/dist/toolUtils.js.map +1 -0
  25. package/dist/tools/balance.d.ts +48 -0
  26. package/dist/tools/balance.d.ts.map +1 -0
  27. package/dist/tools/balance.js +78 -0
  28. package/dist/tools/balance.js.map +1 -0
  29. package/dist/tools/chat.d.ts +89 -0
  30. package/dist/tools/chat.d.ts.map +1 -0
  31. package/dist/tools/chat.js +125 -0
  32. package/dist/tools/chat.js.map +1 -0
  33. package/dist/tools/imageGenerate.d.ts +116 -0
  34. package/dist/tools/imageGenerate.d.ts.map +1 -0
  35. package/dist/tools/imageGenerate.js +220 -0
  36. package/dist/tools/imageGenerate.js.map +1 -0
  37. package/dist/tools/index.d.ts +11 -0
  38. package/dist/tools/index.d.ts.map +1 -0
  39. package/dist/tools/index.js +11 -0
  40. package/dist/tools/index.js.map +1 -0
  41. package/dist/tools/listModels.d.ts +149 -0
  42. package/dist/tools/listModels.d.ts.map +1 -0
  43. package/dist/tools/listModels.js +224 -0
  44. package/dist/tools/listModels.js.map +1 -0
  45. package/dist/tools/scrapeUrls.d.ts +51 -0
  46. package/dist/tools/scrapeUrls.d.ts.map +1 -0
  47. package/dist/tools/scrapeUrls.js +100 -0
  48. package/dist/tools/scrapeUrls.js.map +1 -0
  49. package/dist/tools/webSearch.d.ts +69 -0
  50. package/dist/tools/webSearch.d.ts.map +1 -0
  51. package/dist/tools/webSearch.js +120 -0
  52. package/dist/tools/webSearch.js.map +1 -0
  53. package/dist/tools/youtubeTranscribe.d.ts +45 -0
  54. package/dist/tools/youtubeTranscribe.d.ts.map +1 -0
  55. package/dist/tools/youtubeTranscribe.js +88 -0
  56. package/dist/tools/youtubeTranscribe.js.map +1 -0
  57. package/package.json +48 -0
@@ -0,0 +1,88 @@
1
+ /**
2
+ * nanogpt_youtube_transcribe tool
3
+ *
4
+ * Get transcripts from YouTube videos.
5
+ */
6
+ import { z } from 'zod';
7
+ import { requestJson } from '../httpClient.js';
8
+ import { handleToolError, processRawResponse, buildContent, zodToJsonSchema } from '../toolUtils.js';
9
+ // Input schema - max 10 URLs per the spec
10
+ export const inputSchema = z.object({
11
+ urls: z.array(z.string()).min(1).max(10),
12
+ include_raw: z.boolean().optional().default(false),
13
+ });
14
+ // Output schema
15
+ export const outputSchema = z.object({
16
+ transcripts: z.array(z.record(z.unknown())),
17
+ summary: z.record(z.unknown()),
18
+ raw: z.union([z.record(z.unknown()), z.string()]).optional(),
19
+ });
20
+ // JSON Schemas for MCP registration
21
+ export const inputJsonSchema = zodToJsonSchema(inputSchema);
22
+ export const outputJsonSchema = zodToJsonSchema(outputSchema);
23
+ // Tool metadata
24
+ export const name = 'nanogpt_youtube_transcribe';
25
+ export const description = 'Get transcripts from YouTube videos. Supports up to 10 URLs per request.';
26
+ // Annotations
27
+ export const annotations = {
28
+ readOnlyHint: false,
29
+ openWorldHint: true,
30
+ };
31
+ /**
32
+ * Handler for nanogpt_youtube_transcribe
33
+ */
34
+ export async function handler(args) {
35
+ try {
36
+ // Validate input
37
+ const input = inputSchema.parse(args);
38
+ // Build request body
39
+ // Build request body
40
+ const requestBody = {
41
+ urls: input.urls,
42
+ };
43
+ // Call NanoGPT API
44
+ const response = await requestJson({
45
+ method: 'POST',
46
+ path: '/api/youtube-transcribe',
47
+ body: requestBody,
48
+ });
49
+ const data = response.json;
50
+ // Build output
51
+ const output = {
52
+ transcripts: data.transcripts || [],
53
+ summary: data.summary || {},
54
+ };
55
+ // Process raw response
56
+ const { raw, resourceLink } = processRawResponse({ status: response.status, headers: response.headers, body: data }, input.include_raw);
57
+ if (raw !== undefined) {
58
+ output.raw = raw;
59
+ }
60
+ // Build human-readable content
61
+ const transcripts = data.transcripts || [];
62
+ const summary = data.summary || {};
63
+ let displayText = `Transcribed ${transcripts.length} video(s):`;
64
+ for (const result of transcripts) {
65
+ if (result.success) {
66
+ displayText += `\n- ${result.url}: ${result.title || 'No title'}`;
67
+ if (result.transcript) {
68
+ const preview = result.transcript.slice(0, 100);
69
+ displayText += ` (${preview}${result.transcript.length > 100 ? '...' : ''})`;
70
+ }
71
+ }
72
+ else {
73
+ displayText += `\n- ${result.url}: FAILED - ${result.error || 'Unknown error'}`;
74
+ }
75
+ }
76
+ if (summary.successful !== undefined && summary.failed !== undefined) {
77
+ displayText += `\n\nSummary: ${summary.successful} succeeded, ${summary.failed} failed`;
78
+ }
79
+ return {
80
+ content: buildContent(displayText, resourceLink),
81
+ structuredContent: output,
82
+ };
83
+ }
84
+ catch (err) {
85
+ return handleToolError(err);
86
+ }
87
+ }
88
+ //# sourceMappingURL=youtubeTranscribe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtubeTranscribe.js","sourceRoot":"","sources":["../../src/tools/youtubeTranscribe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAA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I,OAAO,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC;gBAClE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;oBACtB,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;oBAChD,WAAW,IAAI,KAAK,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;gBAC/E,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,WAAW,IAAI,OAAO,MAAM,CAAC,GAAG,cAAc,MAAM,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC;YAClF,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACrE,WAAW,IAAI,gBAAgB,OAAO,CAAC,UAAU,eAAe,OAAO,CAAC,MAAM,SAAS,CAAC;QAC1F,CAAC;QAED,OAAO;YACL,OAAO,EAAE,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC;YAChD,iBAAiB,EAAE,MAAM;SAC1B,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@nanogpt/mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for NanoGPT API integration",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Nano-GPT-com/nanogpt-mcp.git"
12
+ },
13
+ "engines": {
14
+ "node": ">=22"
15
+ },
16
+ "main": "dist/index.js",
17
+ "bin": {
18
+ "nanogpt-mcp": "dist/index.js"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "prepublishOnly": "npm run build",
23
+ "start": "node dist/index.js",
24
+ "dev": "tsc --watch",
25
+ "test": "node --test tests/*.test.js",
26
+ "typecheck": "tsc --noEmit"
27
+ },
28
+ "dependencies": {
29
+ "@modelcontextprotocol/sdk": "^1.24.3",
30
+ "zod": "^3.23.8",
31
+ "lru-cache": "^11.0.2"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "^22.10.2",
35
+ "typescript": "^5.7.2"
36
+ },
37
+ "files": [
38
+ "dist/**/*"
39
+ ],
40
+ "keywords": [
41
+ "mcp",
42
+ "nanogpt",
43
+ "ai",
44
+ "llm",
45
+ "model-context-protocol"
46
+ ],
47
+ "license": "MIT"
48
+ }