@idealyst/mcp-server 1.2.128 → 1.2.129

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/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  storageGuides,
8
8
  toolDefinitions,
9
9
  translateGuides
10
- } from "./chunk-PLKNERFG.js";
10
+ } from "./chunk-RZIMKJRB.js";
11
11
 
12
12
  // src/index.ts
13
13
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -85,6 +85,8 @@ __export(tools_exports, {
85
85
  getPackageDocsDefinition: () => getPackageDocsDefinition,
86
86
  getPaymentsGuide: () => getPaymentsGuide,
87
87
  getPaymentsGuideDefinition: () => getPaymentsGuideDefinition,
88
+ getPdfGuide: () => getPdfGuide,
89
+ getPdfGuideDefinition: () => getPdfGuideDefinition,
88
90
  getRecipe: () => getRecipe,
89
91
  getRecipeDefinition: () => getRecipeDefinition,
90
92
  getRegistryThemeValues: () => getRegistryThemeValues,
@@ -532,6 +534,21 @@ var getNotificationsGuideDefinition = {
532
534
  required: ["topic"]
533
535
  }
534
536
  };
537
+ var getPdfGuideDefinition = {
538
+ name: "get_pdf_guide",
539
+ description: "Get documentation for @idealyst/pdf cross-platform PDF viewer package. Covers PDFViewer component, PDFViewerRef imperative methods, and examples.",
540
+ inputSchema: {
541
+ type: "object",
542
+ properties: {
543
+ topic: {
544
+ type: "string",
545
+ description: "Topic to get docs for: 'overview', 'api', 'examples'",
546
+ enum: ["overview", "api", "examples"]
547
+ }
548
+ },
549
+ required: ["topic"]
550
+ }
551
+ };
535
552
  var listPackagesDefinition = {
536
553
  name: "list_packages",
537
554
  description: "List all available Idealyst packages with descriptions, categories, and documentation status. Use this to discover what packages are available in the framework.",
@@ -722,6 +739,7 @@ var toolDefinitions = [
722
739
  getNotificationsGuideDefinition,
723
740
  getLiveActivityGuideDefinition,
724
741
  getNetworkGuideDefinition,
742
+ getPdfGuideDefinition,
725
743
  // Package tools
726
744
  listPackagesDefinition,
727
745
  getPackageDocsDefinition,
@@ -10573,6 +10591,305 @@ async function quickHealthCheck() {
10573
10591
  `
10574
10592
  };
10575
10593
 
10594
+ // src/data/pdf-guides.ts
10595
+ var pdfGuides = {
10596
+ "idealyst://pdf/overview": `# @idealyst/pdf
10597
+
10598
+ Cross-platform PDF viewer for React and React Native.
10599
+
10600
+ ## Installation
10601
+
10602
+ \`\`\`bash
10603
+ yarn add @idealyst/pdf
10604
+ \`\`\`
10605
+
10606
+ ### Platform peer dependencies
10607
+
10608
+ | Platform | Peer Dependency | Install |
10609
+ |----------|----------------|---------|
10610
+ | Web | \`pdfjs-dist\` | \`yarn add pdfjs-dist\` |
10611
+ | Native | \`react-native-pdf\` | \`yarn add react-native-pdf react-native-blob-util\` |
10612
+
10613
+ **Web**: Uses Mozilla PDF.js to render PDF pages to canvas.
10614
+ **Native**: Uses react-native-pdf (PDFKit on iOS, PdfRenderer on Android).
10615
+
10616
+ ## Key Exports
10617
+
10618
+ | Export | Type | Description |
10619
+ |--------|------|-------------|
10620
+ | \`PDFViewer\` | Component | PDF viewer with zoom, page nav, scroll |
10621
+ | \`PDFViewerRef\` | Ref type | Imperative: \`goToPage()\`, \`setZoom()\` |
10622
+ | \`PDFSource\` | Type | \`string \\| { uri: string } \\| { base64: string }\` |
10623
+ | \`PDFDocumentInfo\` | Type | \`{ totalPages: number }\` |
10624
+ | \`FitPolicy\` | Type | \`'width' \\| 'height' \\| 'both'\` |
10625
+ | \`PDFDirection\` | Type | \`'horizontal' \\| 'vertical'\` |
10626
+
10627
+ ## Quick Start
10628
+
10629
+ \`\`\`tsx
10630
+ import { PDFViewer } from '@idealyst/pdf';
10631
+
10632
+ function DocumentScreen() {
10633
+ return (
10634
+ <PDFViewer
10635
+ source="https://example.com/document.pdf"
10636
+ onLoad={({ totalPages }) => console.log('Pages:', totalPages)}
10637
+ onPageChange={(page, total) => console.log(page, '/', total)}
10638
+ style={{ flex: 1 }}
10639
+ />
10640
+ );
10641
+ }
10642
+ \`\`\`
10643
+
10644
+ ## Common Mistakes
10645
+
10646
+ 1. **Forgetting peer deps** \u2014 Web needs \`pdfjs-dist\`, native needs \`react-native-pdf\` + \`react-native-blob-util\`
10647
+ 2. **PDF.js worker not configured** \u2014 On web, the worker URL is auto-configured from CDN. If using a custom bundler setup, set \`pdfjs.GlobalWorkerOptions.workerSrc\` before rendering.
10648
+ 3. **page is 1-indexed** \u2014 First page is \`1\`, not \`0\`
10649
+ 4. **fitPolicy is a string** \u2014 Use \`'width'\`, \`'height'\`, or \`'both'\` (NOT numeric values)
10650
+ 5. **base64 source** \u2014 Use \`{ base64: 'JVBERi...' }\` without the data URI prefix
10651
+ `,
10652
+ "idealyst://pdf/api": `# @idealyst/pdf \u2014 API Reference
10653
+
10654
+ ## PDFViewerProps
10655
+
10656
+ \`\`\`typescript
10657
+ interface PDFViewerProps {
10658
+ /** PDF source \u2014 URL string, { uri } object, or { base64 } data */
10659
+ source: PDFSource;
10660
+
10661
+ /** Current page (1-indexed). Default: 1 */
10662
+ page?: number;
10663
+
10664
+ /** Called when page changes */
10665
+ onPageChange?: (page: number, totalPages: number) => void;
10666
+
10667
+ /** Called when document loads */
10668
+ onLoad?: (info: PDFDocumentInfo) => void;
10669
+
10670
+ /** Called on error */
10671
+ onError?: (error: Error) => void;
10672
+
10673
+ /** Enable zoom. Default: true */
10674
+ zoomEnabled?: boolean;
10675
+
10676
+ /** Min zoom. Default: 1 */
10677
+ minZoom?: number;
10678
+
10679
+ /** Max zoom. Default: 5 */
10680
+ maxZoom?: number;
10681
+
10682
+ /** Scroll direction. Default: 'vertical' */
10683
+ direction?: PDFDirection;
10684
+
10685
+ /** Show page indicator. Default: true */
10686
+ showPageIndicator?: boolean;
10687
+
10688
+ /** Fit policy. Default: 'width' */
10689
+ fitPolicy?: FitPolicy;
10690
+
10691
+ /** Container style */
10692
+ style?: ViewStyle;
10693
+
10694
+ /** Test ID */
10695
+ testID?: string;
10696
+ }
10697
+ \`\`\`
10698
+
10699
+ ## Types
10700
+
10701
+ \`\`\`typescript
10702
+ type PDFSource = string | { uri: string } | { base64: string };
10703
+
10704
+ type FitPolicy = 'width' | 'height' | 'both';
10705
+
10706
+ type PDFDirection = 'horizontal' | 'vertical';
10707
+
10708
+ interface PDFDocumentInfo {
10709
+ totalPages: number;
10710
+ }
10711
+ \`\`\`
10712
+
10713
+ ## PDFViewerRef (Imperative)
10714
+
10715
+ \`\`\`typescript
10716
+ interface PDFViewerRef {
10717
+ /** Navigate to page (1-indexed) */
10718
+ goToPage: (page: number) => void;
10719
+
10720
+ /** Set zoom level */
10721
+ setZoom: (level: number) => void;
10722
+ }
10723
+ \`\`\`
10724
+
10725
+ Usage:
10726
+ \`\`\`tsx
10727
+ const pdfRef = useRef<PDFViewerRef>(null);
10728
+
10729
+ <PDFViewer ref={pdfRef} source="..." />
10730
+
10731
+ pdfRef.current?.goToPage(5);
10732
+ pdfRef.current?.setZoom(2);
10733
+ \`\`\`
10734
+ `,
10735
+ "idealyst://pdf/examples": `# @idealyst/pdf \u2014 Examples
10736
+
10737
+ ## Basic URL Viewer
10738
+
10739
+ \`\`\`tsx
10740
+ import { PDFViewer } from '@idealyst/pdf';
10741
+ import { View } from '@idealyst/components';
10742
+
10743
+ function BasicPDFScreen() {
10744
+ return (
10745
+ <View style={{ flex: 1 }}>
10746
+ <PDFViewer
10747
+ source="https://example.com/document.pdf"
10748
+ style={{ flex: 1 }}
10749
+ />
10750
+ </View>
10751
+ );
10752
+ }
10753
+ \`\`\`
10754
+
10755
+ ## With Page Navigation Controls
10756
+
10757
+ \`\`\`tsx
10758
+ import { useRef, useState } from 'react';
10759
+ import { PDFViewer, PDFViewerRef } from '@idealyst/pdf';
10760
+ import { View, Text, Button } from '@idealyst/components';
10761
+
10762
+ function PDFWithControls() {
10763
+ const pdfRef = useRef<PDFViewerRef>(null);
10764
+ const [currentPage, setCurrentPage] = useState(1);
10765
+ const [totalPages, setTotalPages] = useState(0);
10766
+
10767
+ return (
10768
+ <View style={{ flex: 1 }}>
10769
+ <PDFViewer
10770
+ ref={pdfRef}
10771
+ source="https://example.com/document.pdf"
10772
+ onLoad={({ totalPages: total }) => setTotalPages(total)}
10773
+ onPageChange={(page) => setCurrentPage(page)}
10774
+ showPageIndicator={false}
10775
+ style={{ flex: 1 }}
10776
+ />
10777
+ <View direction="row" justify="center" align="center" gap="md" padding="md">
10778
+ <Button
10779
+ label="Previous"
10780
+ size="sm"
10781
+ onPress={() => pdfRef.current?.goToPage(Math.max(1, currentPage - 1))}
10782
+ />
10783
+ <Text>{currentPage} / {totalPages}</Text>
10784
+ <Button
10785
+ label="Next"
10786
+ size="sm"
10787
+ onPress={() => pdfRef.current?.goToPage(Math.min(totalPages, currentPage + 1))}
10788
+ />
10789
+ </View>
10790
+ </View>
10791
+ );
10792
+ }
10793
+ \`\`\`
10794
+
10795
+ ## Base64 Source
10796
+
10797
+ \`\`\`tsx
10798
+ import { PDFViewer } from '@idealyst/pdf';
10799
+
10800
+ function Base64PDF({ base64Data }: { base64Data: string }) {
10801
+ return (
10802
+ <PDFViewer
10803
+ source={{ base64: base64Data }}
10804
+ fitPolicy="both"
10805
+ style={{ flex: 1 }}
10806
+ />
10807
+ );
10808
+ }
10809
+ \`\`\`
10810
+
10811
+ ## Horizontal Mode
10812
+
10813
+ \`\`\`tsx
10814
+ import { PDFViewer } from '@idealyst/pdf';
10815
+
10816
+ function HorizontalPDF() {
10817
+ return (
10818
+ <PDFViewer
10819
+ source="https://example.com/slides.pdf"
10820
+ direction="horizontal"
10821
+ fitPolicy="both"
10822
+ style={{ flex: 1 }}
10823
+ />
10824
+ );
10825
+ }
10826
+ \`\`\`
10827
+
10828
+ ## With Error Handling
10829
+
10830
+ \`\`\`tsx
10831
+ import { useState } from 'react';
10832
+ import { PDFViewer } from '@idealyst/pdf';
10833
+ import { View, Text } from '@idealyst/components';
10834
+
10835
+ function SafePDFViewer({ url }: { url: string }) {
10836
+ const [error, setError] = useState<string | null>(null);
10837
+
10838
+ if (error) {
10839
+ return (
10840
+ <View style={{ flex: 1 }} align="center" justify="center">
10841
+ <Text intent="danger">Failed to load PDF: {error}</Text>
10842
+ </View>
10843
+ );
10844
+ }
10845
+
10846
+ return (
10847
+ <PDFViewer
10848
+ source={url}
10849
+ onError={(err) => setError(err.message)}
10850
+ style={{ flex: 1 }}
10851
+ />
10852
+ );
10853
+ }
10854
+ \`\`\`
10855
+
10856
+ ## Zoom Controls
10857
+
10858
+ \`\`\`tsx
10859
+ import { useRef, useState } from 'react';
10860
+ import { PDFViewer, PDFViewerRef } from '@idealyst/pdf';
10861
+ import { View, Button } from '@idealyst/components';
10862
+
10863
+ function ZoomablePDF() {
10864
+ const pdfRef = useRef<PDFViewerRef>(null);
10865
+ const [zoom, setZoom] = useState(1);
10866
+
10867
+ const handleZoom = (level: number) => {
10868
+ setZoom(level);
10869
+ pdfRef.current?.setZoom(level);
10870
+ };
10871
+
10872
+ return (
10873
+ <View style={{ flex: 1 }}>
10874
+ <PDFViewer
10875
+ ref={pdfRef}
10876
+ source="https://example.com/document.pdf"
10877
+ minZoom={0.5}
10878
+ maxZoom={4}
10879
+ style={{ flex: 1 }}
10880
+ />
10881
+ <View direction="row" justify="center" gap="sm" padding="sm">
10882
+ <Button label="50%" size="sm" onPress={() => handleZoom(0.5)} />
10883
+ <Button label="100%" size="sm" onPress={() => handleZoom(1)} />
10884
+ <Button label="200%" size="sm" onPress={() => handleZoom(2)} />
10885
+ </View>
10886
+ </View>
10887
+ );
10888
+ }
10889
+ \`\`\`
10890
+ `
10891
+ };
10892
+
10576
10893
  // src/data/packages.ts
10577
10894
  var packages = {
10578
10895
  components: {
@@ -11801,6 +12118,50 @@ function App() {
11801
12118
  "NetworkState { isConnected, isInternetReachable, type, effectiveType, cellularGeneration, downlink, rtt, isDataSaving }"
11802
12119
  ],
11803
12120
  relatedPackages: ["storage", "config"]
12121
+ },
12122
+ pdf: {
12123
+ name: "PDF",
12124
+ npmName: "@idealyst/pdf",
12125
+ description: "Cross-platform PDF viewer for React and React Native. Renders PDFs from URL, local file, or base64 with page navigation, zoom, and scroll.",
12126
+ category: "media",
12127
+ platforms: ["web", "native"],
12128
+ documentationStatus: "full",
12129
+ installation: "yarn add @idealyst/pdf",
12130
+ peerDependencies: [
12131
+ "pdfjs-dist (web)",
12132
+ "react-native-pdf (native)",
12133
+ "react-native-blob-util (native)"
12134
+ ],
12135
+ features: [
12136
+ "Render PDFs from URL, file path, or base64",
12137
+ "Page navigation (controlled or free scroll)",
12138
+ "Pinch-to-zoom with configurable limits",
12139
+ "Horizontal and vertical scroll modes",
12140
+ "Page indicator overlay",
12141
+ "Fit-to-width, fit-to-height, fit-both modes",
12142
+ "PDFViewerRef for imperative control (goToPage, setZoom)"
12143
+ ],
12144
+ quickStart: `import { PDFViewer } from '@idealyst/pdf';
12145
+
12146
+ function DocumentScreen() {
12147
+ return (
12148
+ <PDFViewer
12149
+ source="https://example.com/document.pdf"
12150
+ onLoad={({ totalPages }) => console.log('Pages:', totalPages)}
12151
+ onPageChange={(page, total) => console.log(page, '/', total)}
12152
+ style={{ flex: 1 }}
12153
+ />
12154
+ );
12155
+ }`,
12156
+ apiHighlights: [
12157
+ "PDFViewer component",
12158
+ "PDFViewerRef \u2014 goToPage(page), setZoom(level)",
12159
+ "PDFSource = string | { uri: string } | { base64: string }",
12160
+ "fitPolicy: 'width' | 'height' | 'both'",
12161
+ "direction: 'horizontal' | 'vertical'",
12162
+ "onLoad, onPageChange, onError callbacks"
12163
+ ],
12164
+ relatedPackages: ["components"]
11804
12165
  }
11805
12166
  };
11806
12167
  function getPackagesByCategory() {
@@ -15985,6 +16346,79 @@ function Test() {
15985
16346
  solution: "Check that you're running on a supported platform (iOS 16.2+ or Android API 24+). On web, Live Activities are not supported and will always return not_supported."
15986
16347
  }
15987
16348
  ]
16349
+ },
16350
+ // =====================================================================
16351
+ // MEDIA PACKAGES — PDF
16352
+ // =====================================================================
16353
+ pdf: {
16354
+ packageName: "PDF",
16355
+ npmName: "@idealyst/pdf",
16356
+ description: "Cross-platform PDF viewer using pdfjs-dist (web) and react-native-pdf (native)",
16357
+ platforms: ["web", "native"],
16358
+ complexity: "moderate",
16359
+ installation: {
16360
+ yarn: "yarn add @idealyst/pdf",
16361
+ npm: "npm install @idealyst/pdf"
16362
+ },
16363
+ peerDependencies: [
16364
+ {
16365
+ name: "pdfjs-dist",
16366
+ required: true,
16367
+ platforms: ["web"],
16368
+ note: "Mozilla PDF.js for web rendering"
16369
+ },
16370
+ {
16371
+ name: "react-native-pdf",
16372
+ required: true,
16373
+ platforms: ["native"],
16374
+ note: "Native PDF renderer (PDFKit on iOS, PdfRenderer on Android)"
16375
+ },
16376
+ {
16377
+ name: "react-native-blob-util",
16378
+ required: true,
16379
+ platforms: ["native"],
16380
+ note: "Required peer dependency of react-native-pdf for file handling"
16381
+ }
16382
+ ],
16383
+ ios: {
16384
+ podInstallRequired: true,
16385
+ additionalSteps: [
16386
+ "cd ios && pod install",
16387
+ "Ensure minimum iOS deployment target is 13.0 or higher"
16388
+ ]
16389
+ },
16390
+ android: {
16391
+ permissions: [],
16392
+ additionalSteps: [
16393
+ "No special permissions required for PDF viewing",
16394
+ "Ensure minSdkVersion is 21 or higher"
16395
+ ]
16396
+ },
16397
+ web: {
16398
+ additionalDependencies: ["pdfjs-dist"],
16399
+ notes: [
16400
+ "The pdfjs-dist worker is auto-configured from CDN by default.",
16401
+ "For custom setups: set pdfjs.GlobalWorkerOptions.workerSrc before rendering PDFViewer.",
16402
+ "For Vite: import pdfjs-dist/build/pdf.worker.min.mjs and set as workerSrc."
16403
+ ]
16404
+ },
16405
+ verification: `import { PDFViewer } from '@idealyst/pdf';
16406
+ // Should render without errors:
16407
+ <PDFViewer source="https://example.com/sample.pdf" style={{ flex: 1 }} />`,
16408
+ troubleshooting: [
16409
+ {
16410
+ issue: "PDF.js worker not found on web",
16411
+ solution: "Set pdfjs.GlobalWorkerOptions.workerSrc to the correct worker URL before rendering PDFViewer. The package sets a CDN default, but custom bundler setups may need manual configuration."
16412
+ },
16413
+ {
16414
+ issue: "react-native-pdf not linking on iOS",
16415
+ solution: "Run cd ios && pod install and rebuild the project. Ensure minimum deployment target is iOS 13.0+."
16416
+ },
16417
+ {
16418
+ issue: "Blank screen on Android",
16419
+ solution: "Ensure minSdkVersion is 21+ in android/build.gradle. Also check that react-native-blob-util is installed as a peer of react-native-pdf."
16420
+ }
16421
+ ]
15988
16422
  }
15989
16423
  };
15990
16424
  function getInstallGuide(packageName) {
@@ -66975,6 +67409,17 @@ function getNetworkGuide(args) {
66975
67409
  }
66976
67410
  return textResponse(guide);
66977
67411
  }
67412
+ function getPdfGuide(args) {
67413
+ const topic = args.topic;
67414
+ const uri = `idealyst://pdf/${topic}`;
67415
+ const guide = pdfGuides[uri];
67416
+ if (!guide) {
67417
+ return textResponse(
67418
+ `Topic "${topic}" not found. Available topics: overview, api, examples`
67419
+ );
67420
+ }
67421
+ return textResponse(guide);
67422
+ }
66978
67423
  function listPackages(args = {}) {
66979
67424
  const category = args.category;
66980
67425
  if (category) {
@@ -67226,6 +67671,7 @@ var toolHandlers = {
67226
67671
  get_notifications_guide: getNotificationsGuide,
67227
67672
  get_live_activity_guide: getLiveActivityGuide,
67228
67673
  get_network_guide: getNetworkGuide,
67674
+ get_pdf_guide: getPdfGuide,
67229
67675
  list_packages: listPackages,
67230
67676
  get_package_docs: getPackageDocs,
67231
67677
  search_packages: searchPackages2,
@@ -67299,6 +67745,8 @@ function callTool(name, args = {}) {
67299
67745
  getPackageDocsDefinition,
67300
67746
  getPaymentsGuide,
67301
67747
  getPaymentsGuideDefinition,
67748
+ getPdfGuide,
67749
+ getPdfGuideDefinition,
67302
67750
  getRecipe,
67303
67751
  getRecipeDefinition,
67304
67752
  getRegistryThemeValues,