mcp-use 1.0.4 → 1.0.6

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 (34) hide show
  1. package/README.md +98 -1
  2. package/dist/index.cjs +118 -689
  3. package/dist/index.d.ts +10 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +118 -54
  6. package/dist/src/agents/mcp_agent.d.ts +1 -1
  7. package/dist/src/agents/mcp_agent.d.ts.map +1 -1
  8. package/dist/src/server/adapters/mcp-ui-adapter.d.ts +66 -0
  9. package/dist/src/server/adapters/mcp-ui-adapter.d.ts.map +1 -0
  10. package/dist/src/server/index.cjs +292 -14
  11. package/dist/src/server/index.d.ts +4 -2
  12. package/dist/src/server/index.d.ts.map +1 -1
  13. package/dist/src/server/index.js +913 -4
  14. package/dist/src/server/mcp-server.d.ts +91 -2
  15. package/dist/src/server/mcp-server.d.ts.map +1 -1
  16. package/dist/src/server/types/common.d.ts +27 -0
  17. package/dist/src/server/types/common.d.ts.map +1 -0
  18. package/dist/src/server/types/index.d.ts +8 -0
  19. package/dist/src/server/types/index.d.ts.map +1 -0
  20. package/dist/src/server/types/prompt.d.ts +14 -0
  21. package/dist/src/server/types/prompt.d.ts.map +1 -0
  22. package/dist/src/server/types/resource.d.ts +155 -0
  23. package/dist/src/server/types/resource.d.ts.map +1 -0
  24. package/dist/src/server/types/tool.d.ts +14 -0
  25. package/dist/src/server/types/tool.d.ts.map +1 -0
  26. package/dist/src/server/types.d.ts +3 -76
  27. package/dist/src/server/types.d.ts.map +1 -1
  28. package/dist/tests/helpers/widget-generators.d.ts +24 -0
  29. package/dist/tests/helpers/widget-generators.d.ts.map +1 -0
  30. package/dist/tests/mcp-ui-adapter.test.d.ts +8 -0
  31. package/dist/tests/mcp-ui-adapter.test.d.ts.map +1 -0
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +33 -36
  34. package/dist/chunk-MZPKOZE4.js +0 -644
package/README.md CHANGED
@@ -532,7 +532,104 @@ server.listen(3000)
532
532
  | **♻️ Hot Reload** | Development mode with automatic reloading |
533
533
  | **📊 Observability** | Built-in logging and monitoring capabilities |
534
534
 
535
- ### Building UI Widgets
535
+ ### MCP-UI Resources
536
+
537
+ MCP-Use provides a unified `uiResource()` method for registering interactive UI widgets that are compatible with MCP-UI clients. This automatically creates both a tool (for dynamic parameters) and a resource (for static access).
538
+
539
+ #### Quick Start
540
+
541
+ ```ts
542
+ import { createMCPServer } from 'mcp-use/server'
543
+
544
+ const server = createMCPServer('my-server', { version: '1.0.0' })
545
+
546
+ // Register a widget - creates both tool and resource automatically
547
+ server.uiResource({
548
+ type: 'externalUrl',
549
+ name: 'kanban-board',
550
+ widget: 'kanban-board',
551
+ title: 'Kanban Board',
552
+ description: 'Interactive task management board',
553
+ props: {
554
+ initialTasks: {
555
+ type: 'array',
556
+ description: 'Initial tasks',
557
+ required: false
558
+ },
559
+ theme: {
560
+ type: 'string',
561
+ default: 'light'
562
+ }
563
+ },
564
+ size: ['900px', '600px']
565
+ })
566
+
567
+ server.listen(3000)
568
+ ```
569
+
570
+ This automatically creates:
571
+ - **Tool**: `ui_kanban-board` - Accepts parameters and returns UIResource
572
+ - **Resource**: `ui://widget/kanban-board` - Static access with defaults
573
+
574
+ #### Three Resource Types
575
+
576
+ **1. External URL (Iframe)**
577
+ Serve widgets from your filesystem via iframe:
578
+
579
+ ```ts
580
+ server.uiResource({
581
+ type: 'externalUrl',
582
+ name: 'dashboard',
583
+ widget: 'dashboard',
584
+ props: { userId: { type: 'string', required: true } }
585
+ })
586
+ ```
587
+
588
+ **2. Raw HTML**
589
+ Direct HTML content rendering:
590
+
591
+ ```ts
592
+ server.uiResource({
593
+ type: 'rawHtml',
594
+ name: 'welcome-card',
595
+ htmlContent: `
596
+ <!DOCTYPE html>
597
+ <html>
598
+ <body><h1>Welcome!</h1></body>
599
+ </html>
600
+ `
601
+ })
602
+ ```
603
+
604
+ **3. Remote DOM**
605
+ Interactive components using MCP-UI React components:
606
+
607
+ ```ts
608
+ server.uiResource({
609
+ type: 'remoteDom',
610
+ name: 'quick-poll',
611
+ script: `
612
+ const button = document.createElement('ui-button');
613
+ button.setAttribute('label', 'Vote');
614
+ root.appendChild(button);
615
+ `,
616
+ framework: 'react'
617
+ })
618
+ ```
619
+
620
+ #### Get Started with Templates
621
+
622
+ ```bash
623
+ # Create a new project with UIResource examples
624
+ npx create-mcp-use-app my-app
625
+ # Select: "MCP Server with UIResource widgets"
626
+
627
+ cd my-app
628
+ npm install
629
+ npm run dev
630
+ ```
631
+
632
+ ### Building Custom UI Widgets
536
633
 
537
634
  MCP-Use supports building custom UI widgets for your MCP tools using React:
538
635