@assistant-ui/mcp-docs-server 0.1.8 → 0.1.9
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/.docs/organized/code-examples/with-ai-sdk-v5.md +21 -14
- package/.docs/organized/code-examples/with-assistant-transport.md +1599 -0
- package/.docs/organized/code-examples/with-cloud.md +9 -9
- package/.docs/organized/code-examples/with-external-store.md +7 -7
- package/.docs/organized/code-examples/with-ffmpeg.md +14 -13
- package/.docs/organized/code-examples/with-langgraph.md +17 -9
- package/.docs/organized/code-examples/with-parent-id-grouping.md +7 -7
- package/.docs/organized/code-examples/with-react-hook-form.md +14 -13
- package/.docs/raw/docs/copilots/assistant-frame.mdx +18 -16
- package/.docs/raw/docs/devtools.mdx +51 -0
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +2 -2
- package/.docs/raw/docs/runtimes/custom/local.mdx +1 -1
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +6 -5
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +13 -13
- package/package.json +6 -6
|
@@ -1087,27 +1087,27 @@ export default nextConfig;
|
|
|
1087
1087
|
"dev": "next dev --turbo",
|
|
1088
1088
|
"build": "next build",
|
|
1089
1089
|
"start": "next start",
|
|
1090
|
-
"lint": "
|
|
1090
|
+
"lint": "eslint ."
|
|
1091
1091
|
},
|
|
1092
1092
|
"dependencies": {
|
|
1093
|
-
"@ai-sdk/openai": "^2.0.
|
|
1093
|
+
"@ai-sdk/openai": "^2.0.38",
|
|
1094
1094
|
"@assistant-ui/react": "workspace:*",
|
|
1095
1095
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
1096
1096
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1097
1097
|
"@radix-ui/react-slot": "^1.2.3",
|
|
1098
1098
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1099
|
-
"ai": "^5.0.
|
|
1099
|
+
"ai": "^5.0.56",
|
|
1100
1100
|
"class-variance-authority": "^0.7.1",
|
|
1101
1101
|
"clsx": "^2.1.1",
|
|
1102
1102
|
"jsonwebtoken": "^9.0.2",
|
|
1103
|
-
"lucide-react": "^0.
|
|
1104
|
-
"nanoid": "5.1.
|
|
1105
|
-
"next": "15.4
|
|
1103
|
+
"lucide-react": "^0.544.0",
|
|
1104
|
+
"nanoid": "5.1.6",
|
|
1105
|
+
"next": "15.5.4",
|
|
1106
1106
|
"react": "19.1.1",
|
|
1107
1107
|
"react-dom": "19.1.1",
|
|
1108
1108
|
"remark-gfm": "^4.0.1",
|
|
1109
1109
|
"tailwind-merge": "^3.3.1",
|
|
1110
|
-
"tw-animate-css": "^1.
|
|
1110
|
+
"tw-animate-css": "^1.4.0"
|
|
1111
1111
|
},
|
|
1112
1112
|
"devDependencies": {
|
|
1113
1113
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
@@ -1116,9 +1116,9 @@ export default nextConfig;
|
|
|
1116
1116
|
"@types/react": "^19",
|
|
1117
1117
|
"@types/react-dom": "^19",
|
|
1118
1118
|
"eslint": "^9",
|
|
1119
|
-
"eslint-config-next": "15.4
|
|
1119
|
+
"eslint-config-next": "15.5.4",
|
|
1120
1120
|
"postcss": "^8",
|
|
1121
|
-
"tailwindcss": "^4.1.
|
|
1121
|
+
"tailwindcss": "^4.1.13",
|
|
1122
1122
|
"typescript": "^5"
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
@@ -999,23 +999,23 @@ export default nextConfig;
|
|
|
999
999
|
"dev": "next dev --turbo",
|
|
1000
1000
|
"build": "next build",
|
|
1001
1001
|
"start": "next start",
|
|
1002
|
-
"lint": "
|
|
1002
|
+
"lint": "eslint ."
|
|
1003
1003
|
},
|
|
1004
1004
|
"dependencies": {
|
|
1005
|
-
"@ai-sdk/openai": "^2.0.
|
|
1005
|
+
"@ai-sdk/openai": "^2.0.38",
|
|
1006
1006
|
"@assistant-ui/react": "workspace:*",
|
|
1007
1007
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1008
1008
|
"@radix-ui/react-slot": "^1.2.3",
|
|
1009
1009
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1010
1010
|
"class-variance-authority": "^0.7.1",
|
|
1011
1011
|
"clsx": "^2.1.1",
|
|
1012
|
-
"lucide-react": "^0.
|
|
1013
|
-
"next": "15.4
|
|
1012
|
+
"lucide-react": "^0.544.0",
|
|
1013
|
+
"next": "15.5.4",
|
|
1014
1014
|
"react": "19.1.1",
|
|
1015
1015
|
"react-dom": "19.1.1",
|
|
1016
1016
|
"remark-gfm": "^4.0.1",
|
|
1017
1017
|
"tailwind-merge": "^3.3.1",
|
|
1018
|
-
"tw-animate-css": "^1.
|
|
1018
|
+
"tw-animate-css": "^1.4.0"
|
|
1019
1019
|
},
|
|
1020
1020
|
"devDependencies": {
|
|
1021
1021
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
@@ -1023,9 +1023,9 @@ export default nextConfig;
|
|
|
1023
1023
|
"@types/react": "^19",
|
|
1024
1024
|
"@types/react-dom": "^19",
|
|
1025
1025
|
"eslint": "^9",
|
|
1026
|
-
"eslint-config-next": "15.4
|
|
1026
|
+
"eslint-config-next": "15.5.4",
|
|
1027
1027
|
"postcss": "^8",
|
|
1028
|
-
"tailwindcss": "^4.1.
|
|
1028
|
+
"tailwindcss": "^4.1.13",
|
|
1029
1029
|
"typescript": "^5"
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
@@ -1191,6 +1191,7 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
1191
1191
|
```typescript
|
|
1192
1192
|
/// <reference types="next" />
|
|
1193
1193
|
/// <reference types="next/image-types/global" />
|
|
1194
|
+
/// <reference path="./.next/types/routes.d.ts" />
|
|
1194
1195
|
|
|
1195
1196
|
// NOTE: This file should not be edited
|
|
1196
1197
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
@@ -1221,17 +1222,17 @@ export default nextConfig;
|
|
|
1221
1222
|
"dev": "next dev --turbo",
|
|
1222
1223
|
"build": "next build",
|
|
1223
1224
|
"start": "next start",
|
|
1224
|
-
"lint": "
|
|
1225
|
+
"lint": "eslint ."
|
|
1225
1226
|
},
|
|
1226
1227
|
"dependencies": {
|
|
1227
|
-
"@ai-sdk/openai": "^2.0.
|
|
1228
|
+
"@ai-sdk/openai": "^2.0.38",
|
|
1228
1229
|
"@assistant-ui/react": "workspace:*",
|
|
1229
1230
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
1230
1231
|
"@assistant-ui/react-hook-form": "workspace:*",
|
|
1231
1232
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1232
1233
|
"@ffmpeg/ffmpeg": "^0.12.15",
|
|
1233
1234
|
"@ffmpeg/util": "^0.12.2",
|
|
1234
|
-
"@hookform/resolvers": "^5.2.
|
|
1235
|
+
"@hookform/resolvers": "^5.2.2",
|
|
1235
1236
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
1236
1237
|
"@radix-ui/react-icons": "^1.3.2",
|
|
1237
1238
|
"@radix-ui/react-label": "^2.1.7",
|
|
@@ -1239,21 +1240,21 @@ export default nextConfig;
|
|
|
1239
1240
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
1240
1241
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1241
1242
|
"@react-hook/media-query": "^1.1.1",
|
|
1242
|
-
"ai": "^5.0.
|
|
1243
|
+
"ai": "^5.0.56",
|
|
1243
1244
|
"class-variance-authority": "^0.7.1",
|
|
1244
1245
|
"clsx": "^2.1.1",
|
|
1245
1246
|
"json-schema-to-zod": "^2.6.1",
|
|
1246
|
-
"lucide-react": "^0.
|
|
1247
|
-
"next": "15.4
|
|
1247
|
+
"lucide-react": "^0.544.0",
|
|
1248
|
+
"next": "15.5.4",
|
|
1248
1249
|
"react": "19.1.1",
|
|
1249
1250
|
"react-dom": "19.1.1",
|
|
1250
|
-
"react-hook-form": "^7.
|
|
1251
|
-
"react-resizable-panels": "^3.0.
|
|
1251
|
+
"react-hook-form": "^7.63.0",
|
|
1252
|
+
"react-resizable-panels": "^3.0.6",
|
|
1252
1253
|
"remark-gfm": "^4.0.1",
|
|
1253
1254
|
"tailwind-merge": "^3.3.1",
|
|
1254
|
-
"tw-animate-css": "^1.
|
|
1255
|
-
"zod": "^4.
|
|
1256
|
-
"zustand": "^5.0.
|
|
1255
|
+
"tw-animate-css": "^1.4.0",
|
|
1256
|
+
"zod": "^4.1.11",
|
|
1257
|
+
"zustand": "^5.0.8"
|
|
1257
1258
|
},
|
|
1258
1259
|
"devDependencies": {
|
|
1259
1260
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
@@ -1261,9 +1262,9 @@ export default nextConfig;
|
|
|
1261
1262
|
"@types/react": "^19",
|
|
1262
1263
|
"@types/react-dom": "^19",
|
|
1263
1264
|
"eslint": "^9",
|
|
1264
|
-
"eslint-config-next": "15.4
|
|
1265
|
+
"eslint-config-next": "15.5.4",
|
|
1265
1266
|
"postcss": "^8",
|
|
1266
|
-
"tailwindcss": "^4.1.
|
|
1267
|
+
"tailwindcss": "^4.1.13",
|
|
1267
1268
|
"typescript": "^5.9.2"
|
|
1268
1269
|
}
|
|
1269
1270
|
}
|
|
@@ -1716,6 +1716,7 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
1716
1716
|
```typescript
|
|
1717
1717
|
/// <reference types="next" />
|
|
1718
1718
|
/// <reference types="next/image-types/global" />
|
|
1719
|
+
/// <reference path="./.next/types/routes.d.ts" />
|
|
1719
1720
|
|
|
1720
1721
|
// NOTE: This file should not be edited
|
|
1721
1722
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
@@ -1728,7 +1729,14 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
1728
1729
|
import type { NextConfig } from "next";
|
|
1729
1730
|
|
|
1730
1731
|
const nextConfig: NextConfig = {
|
|
1731
|
-
|
|
1732
|
+
async rewrites() {
|
|
1733
|
+
return [
|
|
1734
|
+
{
|
|
1735
|
+
source: "/assistant/:path*",
|
|
1736
|
+
destination: "http://localhost:8000/assistant/:path*",
|
|
1737
|
+
},
|
|
1738
|
+
];
|
|
1739
|
+
},
|
|
1732
1740
|
};
|
|
1733
1741
|
|
|
1734
1742
|
export default nextConfig;
|
|
@@ -1746,27 +1754,27 @@ export default nextConfig;
|
|
|
1746
1754
|
"dev": "next dev --turbo",
|
|
1747
1755
|
"build": "next build",
|
|
1748
1756
|
"start": "next start",
|
|
1749
|
-
"lint": "
|
|
1757
|
+
"lint": "eslint ."
|
|
1750
1758
|
},
|
|
1751
1759
|
"dependencies": {
|
|
1752
1760
|
"@assistant-ui/react": "workspace:*",
|
|
1753
1761
|
"@assistant-ui/react-langgraph": "workspace:*",
|
|
1754
1762
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1755
|
-
"@langchain/langgraph-sdk": "^0.
|
|
1763
|
+
"@langchain/langgraph-sdk": "^0.1.7",
|
|
1756
1764
|
"@radix-ui/react-slot": "^1.2.3",
|
|
1757
1765
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1758
1766
|
"class-variance-authority": "^0.7.1",
|
|
1759
1767
|
"clsx": "^2.1.1",
|
|
1760
1768
|
"js-cookie": "^3.0.5",
|
|
1761
1769
|
"jsonwebtoken": "^9.0.2",
|
|
1762
|
-
"lucide-react": "^0.
|
|
1763
|
-
"nanoid": "5.1.
|
|
1764
|
-
"next": "15.4
|
|
1770
|
+
"lucide-react": "^0.544.0",
|
|
1771
|
+
"nanoid": "5.1.6",
|
|
1772
|
+
"next": "15.5.4",
|
|
1765
1773
|
"react": "19.1.1",
|
|
1766
1774
|
"react-dom": "19.1.1",
|
|
1767
1775
|
"remark-gfm": "^4.0.1",
|
|
1768
1776
|
"tailwind-merge": "^3.3.1",
|
|
1769
|
-
"tw-animate-css": "^1.
|
|
1777
|
+
"tw-animate-css": "^1.4.0"
|
|
1770
1778
|
},
|
|
1771
1779
|
"devDependencies": {
|
|
1772
1780
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
@@ -1776,9 +1784,9 @@ export default nextConfig;
|
|
|
1776
1784
|
"@types/react": "^19",
|
|
1777
1785
|
"@types/react-dom": "^19",
|
|
1778
1786
|
"eslint": "^9",
|
|
1779
|
-
"eslint-config-next": "15.4
|
|
1787
|
+
"eslint-config-next": "15.5.4",
|
|
1780
1788
|
"postcss": "^8",
|
|
1781
|
-
"tailwindcss": "^4.1.
|
|
1789
|
+
"tailwindcss": "^4.1.13",
|
|
1782
1790
|
"typescript": "^5.9.2"
|
|
1783
1791
|
}
|
|
1784
1792
|
}
|
|
@@ -1245,23 +1245,23 @@ export default nextConfig;
|
|
|
1245
1245
|
"dev": "next dev --turbo",
|
|
1246
1246
|
"build": "next build",
|
|
1247
1247
|
"start": "next start",
|
|
1248
|
-
"lint": "
|
|
1248
|
+
"lint": "eslint ."
|
|
1249
1249
|
},
|
|
1250
1250
|
"dependencies": {
|
|
1251
|
-
"@ai-sdk/openai": "^2.0.
|
|
1251
|
+
"@ai-sdk/openai": "^2.0.38",
|
|
1252
1252
|
"@assistant-ui/react": "workspace:*",
|
|
1253
1253
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1254
1254
|
"@radix-ui/react-slot": "^1.2.3",
|
|
1255
1255
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1256
1256
|
"class-variance-authority": "^0.7.1",
|
|
1257
1257
|
"clsx": "^2.1.1",
|
|
1258
|
-
"lucide-react": "^0.
|
|
1259
|
-
"next": "15.4
|
|
1258
|
+
"lucide-react": "^0.544.0",
|
|
1259
|
+
"next": "15.5.4",
|
|
1260
1260
|
"react": "19.1.1",
|
|
1261
1261
|
"react-dom": "19.1.1",
|
|
1262
1262
|
"remark-gfm": "^4.0.1",
|
|
1263
1263
|
"tailwind-merge": "^3.3.1",
|
|
1264
|
-
"tw-animate-css": "^1.
|
|
1264
|
+
"tw-animate-css": "^1.4.0"
|
|
1265
1265
|
},
|
|
1266
1266
|
"devDependencies": {
|
|
1267
1267
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
@@ -1269,9 +1269,9 @@ export default nextConfig;
|
|
|
1269
1269
|
"@types/react": "^19",
|
|
1270
1270
|
"@types/react-dom": "^19",
|
|
1271
1271
|
"eslint": "^9",
|
|
1272
|
-
"eslint-config-next": "15.4
|
|
1272
|
+
"eslint-config-next": "15.5.4",
|
|
1273
1273
|
"postcss": "^8",
|
|
1274
|
-
"tailwindcss": "^4.1.
|
|
1274
|
+
"tailwindcss": "^4.1.13",
|
|
1275
1275
|
"typescript": "^5"
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
@@ -1613,6 +1613,7 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
1613
1613
|
```typescript
|
|
1614
1614
|
/// <reference types="next" />
|
|
1615
1615
|
/// <reference types="next/image-types/global" />
|
|
1616
|
+
/// <reference path="./.next/types/routes.d.ts" />
|
|
1616
1617
|
|
|
1617
1618
|
// NOTE: This file should not be edited
|
|
1618
1619
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
@@ -1643,15 +1644,15 @@ export default nextConfig;
|
|
|
1643
1644
|
"dev": "next dev --turbo",
|
|
1644
1645
|
"build": "next build",
|
|
1645
1646
|
"start": "next start",
|
|
1646
|
-
"lint": "
|
|
1647
|
+
"lint": "eslint ."
|
|
1647
1648
|
},
|
|
1648
1649
|
"dependencies": {
|
|
1649
|
-
"@ai-sdk/openai": "^2.0.
|
|
1650
|
+
"@ai-sdk/openai": "^2.0.38",
|
|
1650
1651
|
"@assistant-ui/react": "workspace:*",
|
|
1651
1652
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
1652
1653
|
"@assistant-ui/react-hook-form": "workspace:*",
|
|
1653
1654
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1654
|
-
"@hookform/resolvers": "^5.2.
|
|
1655
|
+
"@hookform/resolvers": "^5.2.2",
|
|
1655
1656
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
1656
1657
|
"@radix-ui/react-icons": "^1.3.2",
|
|
1657
1658
|
"@radix-ui/react-label": "^2.1.7",
|
|
@@ -1659,21 +1660,21 @@ export default nextConfig;
|
|
|
1659
1660
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
1660
1661
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1661
1662
|
"@react-hook/media-query": "^1.1.1",
|
|
1662
|
-
"ai": "^5.0.
|
|
1663
|
+
"ai": "^5.0.56",
|
|
1663
1664
|
"class-variance-authority": "^0.7.1",
|
|
1664
1665
|
"clsx": "^2.1.1",
|
|
1665
1666
|
"json-schema-to-zod": "^2.6.1",
|
|
1666
|
-
"lucide-react": "^0.
|
|
1667
|
-
"next": "15.4
|
|
1667
|
+
"lucide-react": "^0.544.0",
|
|
1668
|
+
"next": "15.5.4",
|
|
1668
1669
|
"react": "19.1.1",
|
|
1669
1670
|
"react-dom": "19.1.1",
|
|
1670
|
-
"react-hook-form": "^7.
|
|
1671
|
-
"react-resizable-panels": "^3.0.
|
|
1671
|
+
"react-hook-form": "^7.63.0",
|
|
1672
|
+
"react-resizable-panels": "^3.0.6",
|
|
1672
1673
|
"remark-gfm": "^4.0.1",
|
|
1673
1674
|
"tailwind-merge": "^3.3.1",
|
|
1674
|
-
"tw-animate-css": "^1.
|
|
1675
|
-
"zod": "^4.
|
|
1676
|
-
"zustand": "^5.0.
|
|
1675
|
+
"tw-animate-css": "^1.4.0",
|
|
1676
|
+
"zod": "^4.1.11",
|
|
1677
|
+
"zustand": "^5.0.8"
|
|
1677
1678
|
},
|
|
1678
1679
|
"devDependencies": {
|
|
1679
1680
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
@@ -1681,9 +1682,9 @@ export default nextConfig;
|
|
|
1681
1682
|
"@types/react": "^19",
|
|
1682
1683
|
"@types/react-dom": "^19",
|
|
1683
1684
|
"eslint": "^9",
|
|
1684
|
-
"eslint-config-next": "15.4
|
|
1685
|
+
"eslint-config-next": "15.5.4",
|
|
1685
1686
|
"postcss": "^8",
|
|
1686
|
-
"tailwindcss": "^4.1.
|
|
1687
|
+
"tailwindcss": "^4.1.13",
|
|
1687
1688
|
"typescript": "^5.9.2"
|
|
1688
1689
|
}
|
|
1689
1690
|
}
|
|
@@ -74,7 +74,7 @@ function ParentComponent() {
|
|
|
74
74
|
|
|
75
75
|
return (
|
|
76
76
|
<div>
|
|
77
|
-
<Thread /> {/* Your assistant
|
|
77
|
+
<Thread /> {/* Your assistant-ui */}
|
|
78
78
|
<iframe
|
|
79
79
|
ref={iframeRef}
|
|
80
80
|
src="https://trusted-iframe-domain.com/embed"
|
|
@@ -98,10 +98,10 @@ const registry = new ModelContextRegistry();
|
|
|
98
98
|
const toolHandle = registry.addTool({
|
|
99
99
|
toolName: "convertCurrency",
|
|
100
100
|
description: "Convert between currencies",
|
|
101
|
-
parameters: z.object({
|
|
101
|
+
parameters: z.object({
|
|
102
102
|
amount: z.number(),
|
|
103
103
|
from: z.string(),
|
|
104
|
-
to: z.string()
|
|
104
|
+
to: z.string(),
|
|
105
105
|
}),
|
|
106
106
|
execute: async ({ amount, from, to }) => {
|
|
107
107
|
const rate = await fetchExchangeRate(from, to);
|
|
@@ -113,19 +113,19 @@ const toolHandle = registry.addTool({
|
|
|
113
113
|
toolHandle.update({
|
|
114
114
|
toolName: "convertCurrency",
|
|
115
115
|
description: "Convert between currencies with live rates", // Updated description
|
|
116
|
-
parameters: z.object({
|
|
116
|
+
parameters: z.object({
|
|
117
117
|
amount: z.number(),
|
|
118
118
|
from: z.string(),
|
|
119
119
|
to: z.string(),
|
|
120
|
-
includesFees: z.boolean().optional()
|
|
120
|
+
includesFees: z.boolean().optional(),
|
|
121
121
|
}),
|
|
122
122
|
execute: async ({ amount, from, to, includesFees }) => {
|
|
123
123
|
const rate = await fetchExchangeRate(from, to);
|
|
124
124
|
const fee = includesFees ? 0.02 : 0; // 2% fee
|
|
125
|
-
return {
|
|
126
|
-
result: amount * rate * (1 - fee),
|
|
125
|
+
return {
|
|
126
|
+
result: amount * rate * (1 - fee),
|
|
127
127
|
currency: to,
|
|
128
|
-
fee: includesFees ? amount * rate * fee : 0
|
|
128
|
+
fee: includesFees ? amount * rate * fee : 0,
|
|
129
129
|
};
|
|
130
130
|
},
|
|
131
131
|
});
|
|
@@ -377,20 +377,22 @@ Provide data visualization tools in an iframe:
|
|
|
377
377
|
registry.addTool({
|
|
378
378
|
toolName: "createChart",
|
|
379
379
|
description: "Generate a chart from data",
|
|
380
|
-
parameters: z.object({
|
|
381
|
-
data: z.array(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
380
|
+
parameters: z.object({
|
|
381
|
+
data: z.array(
|
|
382
|
+
z.object({
|
|
383
|
+
label: z.string(),
|
|
384
|
+
value: z.number(),
|
|
385
|
+
}),
|
|
386
|
+
),
|
|
385
387
|
chartType: z.enum(["bar", "line", "pie"]),
|
|
386
|
-
title: z.string().optional()
|
|
388
|
+
title: z.string().optional(),
|
|
387
389
|
}),
|
|
388
390
|
execute: async ({ data, chartType, title }) => {
|
|
389
391
|
// Generate chart using a library like Chart.js or D3
|
|
390
392
|
const chartUrl = await generateChart(data, chartType, title);
|
|
391
|
-
return {
|
|
393
|
+
return {
|
|
392
394
|
chartUrl,
|
|
393
|
-
summary: `Created ${chartType} chart with ${data.length} data points
|
|
395
|
+
summary: `Created ${chartType} chart with ${data.length} data points`,
|
|
394
396
|
};
|
|
395
397
|
},
|
|
396
398
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: DevTools
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
import { Step, Steps } from "fumadocs-ui/components/steps";
|
|
6
|
+
|
|
7
|
+
Hey, the assistant-ui DevTools allows you to debug the assistant-ui state and context, and events without resorting to `console.log`. It's an easy way to see how data flows to the assistant-ui's runtime layer.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
<Steps>
|
|
14
|
+
<Step>
|
|
15
|
+
|
|
16
|
+
### Install the DevTools package
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @assistant-ui/react-devtools
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
</Step>
|
|
23
|
+
<Step>
|
|
24
|
+
|
|
25
|
+
### Mount the DevTools modal
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
29
|
+
import { DevToolsModal } from "@assistant-ui/react-devtools";
|
|
30
|
+
|
|
31
|
+
export function AssistantApp() {
|
|
32
|
+
return (
|
|
33
|
+
<AssistantRuntimeProvider>
|
|
34
|
+
<DevToolsModal />
|
|
35
|
+
{/* ...your assistant-ui... */}
|
|
36
|
+
</AssistantRuntimeProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</Step>
|
|
42
|
+
<Step>
|
|
43
|
+
|
|
44
|
+
### Verify the DevTools overlay
|
|
45
|
+
|
|
46
|
+
That's it! In development builds you should now see the DevTools in the lower-right corner of your site.
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
</Step>
|
|
51
|
+
</Steps>
|
|
@@ -130,7 +130,7 @@ const runtime = useChatRuntime({
|
|
|
130
130
|
<Callout type="info">
|
|
131
131
|
By default, `useChatRuntime` uses `AssistantChatTransport` which automatically
|
|
132
132
|
forwards system messages and frontend tools to your backend API. This enables
|
|
133
|
-
your backend to receive the full context from the
|
|
133
|
+
your backend to receive the full context from the assistant-ui.
|
|
134
134
|
</Callout>
|
|
135
135
|
|
|
136
136
|
### Custom Transport Configuration
|
|
@@ -165,7 +165,7 @@ const runtime = useChatRuntime({
|
|
|
165
165
|
|
|
166
166
|
#### Transport Options
|
|
167
167
|
|
|
168
|
-
- **`AssistantChatTransport`** (default): Automatically forwards system messages and frontend tools from the
|
|
168
|
+
- **`AssistantChatTransport`** (default): Automatically forwards system messages and frontend tools from the assistant-ui context to your backend
|
|
169
169
|
- **`DefaultChatTransport`**: Standard AI SDK transport without automatic forwarding
|
|
170
170
|
|
|
171
171
|
### Using Frontend Tools with `frontendTools`
|
|
@@ -732,7 +732,7 @@ Provide follow-up suggestions:
|
|
|
732
732
|
|
|
733
733
|
```tsx
|
|
734
734
|
const suggestionAdapter: SuggestionAdapter = {
|
|
735
|
-
async *
|
|
735
|
+
async *generate({ messages }) {
|
|
736
736
|
// Analyze conversation context
|
|
737
737
|
const lastMessage = messages[messages.length - 1];
|
|
738
738
|
|
|
@@ -10,9 +10,9 @@ Integrate Mastra directly into your Next.js application's API routes. This appro
|
|
|
10
10
|
<Steps>
|
|
11
11
|
<Step>
|
|
12
12
|
|
|
13
|
-
### Initialize
|
|
13
|
+
### Initialize assistant-ui
|
|
14
14
|
|
|
15
|
-
Start by setting up
|
|
15
|
+
Start by setting up assistant-ui in your project. Run one of the following commands:
|
|
16
16
|
|
|
17
17
|
```sh title="New Project"
|
|
18
18
|
npx assistant-ui@latest create
|
|
@@ -190,10 +190,11 @@ export async function POST(req: Request) {
|
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
Key changes:
|
|
193
|
+
|
|
193
194
|
- We import the `mastra` instance created in `mastra/index.ts`. Make sure the import path (`@/mastra`) is correct for your project setup (you might need `~/mastra`, `../../../mastra`, etc., depending on your path aliases and project structure).
|
|
194
195
|
- We retrieve the `chefAgent` using `mastra.getAgent("chefAgent")`.
|
|
195
196
|
- Instead of calling the AI SDK's `streamText` directly, we call `agent.stream(messages)` to process the chat messages using the agent's configuration and model.
|
|
196
|
-
- The result is still returned in a format compatible with
|
|
197
|
+
- The result is still returned in a format compatible with assistant-ui using `toDataStreamResponse()`.
|
|
197
198
|
|
|
198
199
|
Your API route is now powered by Mastra!
|
|
199
200
|
|
|
@@ -208,11 +209,11 @@ You're all set! Start your Next.js development server:
|
|
|
208
209
|
npm run dev
|
|
209
210
|
```
|
|
210
211
|
|
|
211
|
-
Open your browser to `http://localhost:3000` (or the port specified in your terminal). You should now be able to interact with your `chefAgent` through the
|
|
212
|
+
Open your browser to `http://localhost:3000` (or the port specified in your terminal). You should now be able to interact with your `chefAgent` through the assistant-ui chat interface. Ask it for cooking advice based on ingredients you have!
|
|
212
213
|
|
|
213
214
|
</Step>
|
|
214
215
|
</Steps>
|
|
215
216
|
|
|
216
|
-
Congratulations! You have successfully integrated Mastra into your Next.js application using the full-stack approach. Your
|
|
217
|
+
Congratulations! You have successfully integrated Mastra into your Next.js application using the full-stack approach. Your assistant-ui frontend now communicates with a Mastra agent running in your Next.js backend API route.
|
|
217
218
|
|
|
218
219
|
To explore more advanced Mastra features like memory, tools, workflows, and more, please refer to the [official Mastra documentation](https://mastra.ai/docs).
|
|
@@ -4,9 +4,9 @@ title: Overview
|
|
|
4
4
|
|
|
5
5
|
Mastra is an open-source TypeScript agent framework designed to provide the essential primitives for building AI applications. It enables developers to create AI agents with memory and tool-calling capabilities, implement deterministic LLM workflows, and leverage RAG for knowledge integration. With features like model routing, workflow graphs, and automated evals, Mastra provides a complete toolkit for developing, testing, and deploying AI applications.
|
|
6
6
|
|
|
7
|
-
## Integrating with Next.js and
|
|
7
|
+
## Integrating with Next.js and assistant-ui
|
|
8
8
|
|
|
9
|
-
There are two primary ways to integrate Mastra into your Next.js project when using
|
|
9
|
+
There are two primary ways to integrate Mastra into your Next.js project when using assistant-ui:
|
|
10
10
|
|
|
11
11
|
1. **Full-Stack Integration**: Integrate Mastra directly into your Next.js application's API routes. This approach keeps your backend and frontend code within the same project.
|
|
12
12
|
[Learn how to set up Full-Stack Integration](./full-stack-integration)
|
|
@@ -14,4 +14,4 @@ There are two primary ways to integrate Mastra into your Next.js project when us
|
|
|
14
14
|
2. **Separate Server Integration**: Run Mastra as a standalone server and connect your Next.js frontend to its API endpoints. This approach separates concerns and allows for independent scaling.
|
|
15
15
|
[Learn how to set up Separate Server Integration](./separate-server-integration)
|
|
16
16
|
|
|
17
|
-
Choose the guide that best fits your project architecture. Both methods allow seamless integration with the
|
|
17
|
+
Choose the guide that best fits your project architecture. Both methods allow seamless integration with the assistant-ui components.
|
|
@@ -5,7 +5,7 @@ title: Separate Server Integration
|
|
|
5
5
|
import { Step, Steps } from "fumadocs-ui/components/steps";
|
|
6
6
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
7
|
|
|
8
|
-
Run Mastra as a standalone server and connect your Next.js frontend (using
|
|
8
|
+
Run Mastra as a standalone server and connect your Next.js frontend (using assistant-ui) to its API endpoints. This approach separates your AI backend from your frontend application, allowing for independent development and scaling.
|
|
9
9
|
|
|
10
10
|
<Steps>
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ Run Mastra as a standalone server and connect your Next.js frontend (using Assis
|
|
|
13
13
|
|
|
14
14
|
### Create Mastra Server Project
|
|
15
15
|
|
|
16
|
-
First, create a dedicated project for your Mastra server. Choose a directory separate from your Next.js/
|
|
16
|
+
First, create a dedicated project for your Mastra server. Choose a directory separate from your Next.js/assistant-ui frontend project.
|
|
17
17
|
|
|
18
18
|
Navigate to your chosen parent directory in the terminal and run the Mastra create command:
|
|
19
19
|
|
|
@@ -97,15 +97,15 @@ With the agent defined and registered, start the Mastra development server:
|
|
|
97
97
|
npm run dev
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
By default, the Mastra server will run on `http://localhost:4111`. Your `chefAgent` should now be accessible via a POST request endpoint, typically `http://localhost:4111/api/agents/chefAgent/stream`. Keep this server running for the next steps where we'll set up the
|
|
100
|
+
By default, the Mastra server will run on `http://localhost:4111`. Your `chefAgent` should now be accessible via a POST request endpoint, typically `http://localhost:4111/api/agents/chefAgent/stream`. Keep this server running for the next steps where we'll set up the assistant-ui frontend to connect to it.
|
|
101
101
|
|
|
102
102
|
</Step>
|
|
103
103
|
|
|
104
104
|
<Step>
|
|
105
105
|
|
|
106
|
-
### Initialize
|
|
106
|
+
### Initialize assistant-ui Frontend
|
|
107
107
|
|
|
108
|
-
Now, set up your frontend application using
|
|
108
|
+
Now, set up your frontend application using assistant-ui. Navigate to a **different directory** from your Mastra server project. You can either create a new Next.js project or use an existing one.
|
|
109
109
|
|
|
110
110
|
Inside your frontend project directory, run one of the following commands:
|
|
111
111
|
|
|
@@ -117,10 +117,10 @@ npx assistant-ui@latest create
|
|
|
117
117
|
npx assistant-ui@latest init
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
This command installs the necessary
|
|
120
|
+
This command installs the necessary assistant-ui dependencies and sets up basic configuration files, including a default chat page and an API route (`app/api/chat/route.ts`).
|
|
121
121
|
|
|
122
122
|
<Callout title="Need Help?">
|
|
123
|
-
For detailed setup instructions for
|
|
123
|
+
For detailed setup instructions for assistant-ui, including manual setup
|
|
124
124
|
steps, please refer to the main [Getting Started
|
|
125
125
|
guide](/docs/getting-started).
|
|
126
126
|
</Callout>
|
|
@@ -133,9 +133,9 @@ In the next step, we will configure this frontend to communicate with the separa
|
|
|
133
133
|
|
|
134
134
|
### Configure Frontend API Endpoint
|
|
135
135
|
|
|
136
|
-
The default
|
|
136
|
+
The default assistant-ui setup configures the chat runtime to use a local API route (`/api/chat`) within the Next.js project. Since our Mastra agent is running on a separate server, we need to update the frontend to point to that server's endpoint.
|
|
137
137
|
|
|
138
|
-
Open the main page file in your
|
|
138
|
+
Open the main page file in your assistant-ui frontend project (usually `app/page.tsx` or `src/app/page.tsx`). Find the `useChatRuntime` hook and change the `api` property to the full URL of your Mastra agent's stream endpoint:
|
|
139
139
|
|
|
140
140
|
```tsx {10} title="app/page.tsx"
|
|
141
141
|
"use client";
|
|
@@ -163,7 +163,7 @@ export default function Home() {
|
|
|
163
163
|
|
|
164
164
|
Replace `"http://localhost:4111/api/agents/chefAgent/stream"` with the actual URL if your Mastra server runs on a different port or host, or if your agent has a different name.
|
|
165
165
|
|
|
166
|
-
Now, the
|
|
166
|
+
Now, the assistant-ui frontend will send chat requests directly to your running Mastra server.
|
|
167
167
|
|
|
168
168
|
<Callout title="Delete Default API Route">
|
|
169
169
|
Since the frontend no longer uses the local `/api/chat` route created by the
|
|
@@ -179,18 +179,18 @@ Now, the Assistant UI frontend will send chat requests directly to your running
|
|
|
179
179
|
|
|
180
180
|
You're ready to connect the pieces! Make sure your separate Mastra server is still running (from Step 4).
|
|
181
181
|
|
|
182
|
-
In your
|
|
182
|
+
In your assistant-ui frontend project directory, start the Next.js development server:
|
|
183
183
|
|
|
184
184
|
```bash npm2yarn
|
|
185
185
|
npm run dev
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
Open your browser to `http://localhost:3000` (or the port specified in your terminal for the frontend app). You should now be able to interact with your `chefAgent` through the
|
|
188
|
+
Open your browser to `http://localhost:3000` (or the port specified in your terminal for the frontend app). You should now be able to interact with your `chefAgent` through the assistant-ui chat interface. The frontend will make requests to your Mastra server running on `http://localhost:4111`.
|
|
189
189
|
|
|
190
190
|
</Step>
|
|
191
191
|
|
|
192
192
|
</Steps>
|
|
193
193
|
|
|
194
|
-
Congratulations! You have successfully integrated Mastra with
|
|
194
|
+
Congratulations! You have successfully integrated Mastra with assistant-ui using a separate server approach. Your assistant-ui frontend now communicates with a standalone Mastra agent server.
|
|
195
195
|
|
|
196
196
|
This setup provides a clear separation between your frontend and AI backend. To explore more advanced Mastra features like memory, tools, workflows, and deployment options, please refer to the [official Mastra documentation](https://mastra.ai/docs).
|