@mastra/mcp-docs-server 1.0.0-beta.6 → 1.0.0-beta.7
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/changelogs/%40mastra%2Fastra.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +58 -58
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +31 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +176 -176
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +43 -43
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Freact.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +58 -58
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +7 -7
- package/.docs/organized/changelogs/mastra.md +14 -14
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -1
- package/.docs/organized/code-examples/ai-sdk-v5.md +1 -1
- package/.docs/organized/code-examples/assistant-ui.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -1
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/organized/code-examples/mcp-server-adapters.md +2 -2
- package/.docs/organized/code-examples/server-app-access.md +2 -2
- package/.docs/organized/code-examples/server-express-adapter.md +87 -0
- package/.docs/organized/code-examples/server-hono-adapter.md +85 -0
- package/.docs/raw/agents/overview.mdx +2 -111
- package/.docs/raw/agents/processors.mdx +1 -1
- package/.docs/raw/agents/structured-output.mdx +224 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +10 -2
- package/.docs/raw/memory/working-memory.mdx +1 -0
- package/.docs/raw/observability/tracing/bridges/otel.mdx +25 -1
- package/.docs/raw/observability/tracing/exporters/arize.mdx +19 -0
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +63 -0
- package/.docs/raw/observability/tracing/exporters/otel.mdx +30 -19
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +20 -0
- package/.docs/raw/observability/tracing/overview.mdx +6 -1
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +27 -0
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +25 -0
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +43 -0
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +27 -43
- package/.docs/raw/reference/server/create-route.mdx +314 -0
- package/.docs/raw/reference/server/express-adapter.mdx +193 -0
- package/.docs/raw/reference/server/hono-adapter.mdx +174 -0
- package/.docs/raw/reference/server/mastra-server.mdx +316 -0
- package/.docs/raw/reference/server/routes.mdx +250 -0
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +170 -0
- package/.docs/raw/reference/tools/mcp-client.mdx +54 -1
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +310 -0
- package/.docs/raw/reference/workflows/run.mdx +14 -0
- package/.docs/raw/server-db/custom-adapters.mdx +380 -0
- package/.docs/raw/server-db/mastra-server.mdx +11 -32
- package/.docs/raw/server-db/server-adapters.mdx +286 -0
- package/CHANGELOG.md +8 -0
- package/package.json +4 -4
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: MastraServer | Server"
|
|
3
|
+
description: "API reference for the MastraServer abstract class used to create server adapters."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import PropertiesTable from "@site/src/components/PropertiesTable";
|
|
7
|
+
|
|
8
|
+
# MastraServer
|
|
9
|
+
|
|
10
|
+
The `MastraServer` abstract class is the base for all server adapters. Extend this class to create adapters for frameworks other than Hono or Express.
|
|
11
|
+
|
|
12
|
+
## Import
|
|
13
|
+
|
|
14
|
+
```typescript copy
|
|
15
|
+
import { MastraServer } from '@mastra/server';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Type parameters
|
|
19
|
+
|
|
20
|
+
```typescript copy
|
|
21
|
+
MastraServer<TApp, TRequest, TResponse>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| Parameter | Description |
|
|
25
|
+
|-----------|-------------|
|
|
26
|
+
| `TApp` | Framework app type (e.g., `Hono`, `Application`) |
|
|
27
|
+
| `TRequest` | Framework request type |
|
|
28
|
+
| `TResponse` | Framework response/context type |
|
|
29
|
+
|
|
30
|
+
## Constructor
|
|
31
|
+
|
|
32
|
+
```typescript copy
|
|
33
|
+
constructor(options: MastraServerOptions<TApp>)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Options
|
|
37
|
+
|
|
38
|
+
<PropertiesTable
|
|
39
|
+
content={[
|
|
40
|
+
{
|
|
41
|
+
name: "app",
|
|
42
|
+
type: "TApp",
|
|
43
|
+
description: "Framework app instance",
|
|
44
|
+
isOptional: false,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "mastra",
|
|
48
|
+
type: "Mastra",
|
|
49
|
+
description: "Mastra instance",
|
|
50
|
+
isOptional: false,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "prefix",
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Route path prefix (e.g., `/api/v2`)",
|
|
56
|
+
isOptional: true,
|
|
57
|
+
defaultValue: "''",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "openapiPath",
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "Path to serve OpenAPI spec",
|
|
63
|
+
isOptional: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "bodyLimitOptions",
|
|
67
|
+
type: "BodyLimitOptions",
|
|
68
|
+
description: "Request body size limits",
|
|
69
|
+
isOptional: true,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "streamOptions",
|
|
73
|
+
type: "StreamOptions",
|
|
74
|
+
description: "Stream redaction config",
|
|
75
|
+
isOptional: true,
|
|
76
|
+
defaultValue: "{ redact: true }",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "customRouteAuthConfig",
|
|
80
|
+
type: "Map<string, boolean>",
|
|
81
|
+
description: "Per-route auth overrides",
|
|
82
|
+
isOptional: true,
|
|
83
|
+
},
|
|
84
|
+
]}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
## Abstract methods
|
|
88
|
+
|
|
89
|
+
These methods must be implemented by adapters:
|
|
90
|
+
|
|
91
|
+
### registerContextMiddleware()
|
|
92
|
+
|
|
93
|
+
Attach Mastra context to every request.
|
|
94
|
+
|
|
95
|
+
```typescript copy
|
|
96
|
+
abstract registerContextMiddleware(): void
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Context to attach:**
|
|
100
|
+
- `mastra` - Mastra instance
|
|
101
|
+
- `requestContext` - Request-scoped context
|
|
102
|
+
- `tools` - Available tools
|
|
103
|
+
- `abortSignal` - Request cancellation signal
|
|
104
|
+
|
|
105
|
+
### registerAuthMiddleware()
|
|
106
|
+
|
|
107
|
+
Register authentication and authorization middleware.
|
|
108
|
+
|
|
109
|
+
```typescript copy
|
|
110
|
+
abstract registerAuthMiddleware(): void
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### registerRoute()
|
|
114
|
+
|
|
115
|
+
Register a single route with the framework.
|
|
116
|
+
|
|
117
|
+
```typescript copy
|
|
118
|
+
abstract registerRoute(
|
|
119
|
+
app: TApp,
|
|
120
|
+
route: ServerRoute,
|
|
121
|
+
options: { prefix?: string }
|
|
122
|
+
): Promise<void>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### getParams()
|
|
126
|
+
|
|
127
|
+
Extract parameters from the request.
|
|
128
|
+
|
|
129
|
+
```typescript copy
|
|
130
|
+
abstract getParams(
|
|
131
|
+
route: ServerRoute,
|
|
132
|
+
request: TRequest
|
|
133
|
+
): Promise<{
|
|
134
|
+
urlParams: Record<string, string>;
|
|
135
|
+
queryParams: Record<string, string>;
|
|
136
|
+
body: unknown;
|
|
137
|
+
}>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### sendResponse()
|
|
141
|
+
|
|
142
|
+
Send response based on route type.
|
|
143
|
+
|
|
144
|
+
```typescript copy
|
|
145
|
+
abstract sendResponse(
|
|
146
|
+
route: ServerRoute,
|
|
147
|
+
response: TResponse,
|
|
148
|
+
result: unknown
|
|
149
|
+
): Promise<unknown>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### stream()
|
|
153
|
+
|
|
154
|
+
Handle streaming responses.
|
|
155
|
+
|
|
156
|
+
```typescript copy
|
|
157
|
+
abstract stream(
|
|
158
|
+
route: ServerRoute,
|
|
159
|
+
response: TResponse,
|
|
160
|
+
result: unknown
|
|
161
|
+
): Promise<unknown>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Instance methods
|
|
165
|
+
|
|
166
|
+
### init()
|
|
167
|
+
|
|
168
|
+
Initialize the server by registering all middleware and routes.
|
|
169
|
+
|
|
170
|
+
```typescript copy
|
|
171
|
+
async init(): Promise<void>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Calls in order:
|
|
175
|
+
1. `registerContextMiddleware()`
|
|
176
|
+
2. `registerAuthMiddleware()`
|
|
177
|
+
3. `registerRoutes()`
|
|
178
|
+
|
|
179
|
+
### registerRoutes()
|
|
180
|
+
|
|
181
|
+
Register all Mastra routes.
|
|
182
|
+
|
|
183
|
+
```typescript copy
|
|
184
|
+
async registerRoutes(): Promise<void>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### getApp()
|
|
188
|
+
|
|
189
|
+
Get the framework app instance.
|
|
190
|
+
|
|
191
|
+
```typescript copy
|
|
192
|
+
getApp<T = TApp>(): T
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### parsePathParams()
|
|
196
|
+
|
|
197
|
+
Validate path parameters with the route's Zod schema.
|
|
198
|
+
|
|
199
|
+
```typescript copy
|
|
200
|
+
async parsePathParams(
|
|
201
|
+
route: ServerRoute,
|
|
202
|
+
params: Record<string, string>
|
|
203
|
+
): Promise<Record<string, unknown>>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### parseQueryParams()
|
|
207
|
+
|
|
208
|
+
Validate query parameters with the route's Zod schema.
|
|
209
|
+
|
|
210
|
+
```typescript copy
|
|
211
|
+
async parseQueryParams(
|
|
212
|
+
route: ServerRoute,
|
|
213
|
+
params: Record<string, string>
|
|
214
|
+
): Promise<Record<string, unknown>>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### parseBody()
|
|
218
|
+
|
|
219
|
+
Validate request body with the route's Zod schema.
|
|
220
|
+
|
|
221
|
+
```typescript copy
|
|
222
|
+
async parseBody(
|
|
223
|
+
route: ServerRoute,
|
|
224
|
+
body: unknown
|
|
225
|
+
): Promise<unknown>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### mergeRequestContext()
|
|
229
|
+
|
|
230
|
+
Merge request context from multiple sources (query params and body).
|
|
231
|
+
|
|
232
|
+
```typescript copy
|
|
233
|
+
mergeRequestContext(options: {
|
|
234
|
+
paramsRequestContext?: Record<string, any>;
|
|
235
|
+
bodyRequestContext?: Record<string, any>;
|
|
236
|
+
}): RequestContext
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### registerOpenAPIRoute()
|
|
240
|
+
|
|
241
|
+
Register an endpoint that serves the OpenAPI specification.
|
|
242
|
+
|
|
243
|
+
```typescript copy
|
|
244
|
+
async registerOpenAPIRoute(
|
|
245
|
+
app: TApp,
|
|
246
|
+
config: OpenAPIConfig,
|
|
247
|
+
options: { prefix?: string }
|
|
248
|
+
): Promise<void>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Types
|
|
252
|
+
|
|
253
|
+
### BodyLimitOptions
|
|
254
|
+
|
|
255
|
+
```typescript copy
|
|
256
|
+
interface BodyLimitOptions {
|
|
257
|
+
maxSize: number;
|
|
258
|
+
onError: (error: unknown) => unknown;
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### StreamOptions
|
|
263
|
+
|
|
264
|
+
```typescript copy
|
|
265
|
+
interface StreamOptions {
|
|
266
|
+
redact?: boolean;
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Example
|
|
271
|
+
|
|
272
|
+
```typescript copy showLineNumbers
|
|
273
|
+
import { MastraServer, ServerRoute } from '@mastra/server';
|
|
274
|
+
import type { Mastra } from '@mastra/core';
|
|
275
|
+
|
|
276
|
+
export class MyServer extends MastraServer<MyApp, MyRequest, MyResponse> {
|
|
277
|
+
registerContextMiddleware(): void {
|
|
278
|
+
this.app.use('*', (req, res, next) => {
|
|
279
|
+
res.locals.mastra = this.mastra;
|
|
280
|
+
next();
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
registerAuthMiddleware(): void {
|
|
285
|
+
const auth = this.mastra.getServer()?.auth;
|
|
286
|
+
if (!auth) return;
|
|
287
|
+
// Implement auth
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
async registerRoute(app, route, { prefix }) {
|
|
291
|
+
// Implement route registration
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async getParams(route, request) {
|
|
295
|
+
return {
|
|
296
|
+
urlParams: request.params,
|
|
297
|
+
queryParams: request.query,
|
|
298
|
+
body: request.body,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async sendResponse(route, response, result) {
|
|
303
|
+
return response.json(result);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async stream(route, response, result) {
|
|
307
|
+
// Implement streaming
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Related
|
|
313
|
+
|
|
314
|
+
- [Server Adapters](/docs/v1/server-db/server-adapters) - Using adapters
|
|
315
|
+
- [Custom Adapters](/docs/v1/server-db/custom-adapters) - Creating custom adapters
|
|
316
|
+
- [createRoute()](/reference/v1/server/create-route) - Creating custom routes
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Server Routes | Server"
|
|
3
|
+
description: "API reference for HTTP routes registered by Mastra server adapters."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Server Routes
|
|
7
|
+
|
|
8
|
+
Server adapters register these routes when you call `server.init()`. All routes are prefixed with the `prefix` option if configured.
|
|
9
|
+
|
|
10
|
+
## Agents
|
|
11
|
+
|
|
12
|
+
| Method | Path | Description |
|
|
13
|
+
|--------|------|-------------|
|
|
14
|
+
| `GET` | `/api/agents` | List all agents |
|
|
15
|
+
| `GET` | `/api/agents/:agentId` | Get agent by ID |
|
|
16
|
+
| `POST` | `/api/agents/:agentId/generate` | Generate agent response |
|
|
17
|
+
| `POST` | `/api/agents/:agentId/stream` | Stream agent response |
|
|
18
|
+
| `GET` | `/api/agents/:agentId/tools` | List agent tools |
|
|
19
|
+
| `POST` | `/api/agents/:agentId/tools/:toolId/execute` | Execute agent tool |
|
|
20
|
+
|
|
21
|
+
### Generate request body
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
{
|
|
25
|
+
messages: CoreMessage[] | string; // Required
|
|
26
|
+
instructions?: string; // System instructions
|
|
27
|
+
system?: string; // System prompt
|
|
28
|
+
context?: CoreMessage[]; // Additional context
|
|
29
|
+
memory?: { key: string } | boolean; // Memory config
|
|
30
|
+
resourceId?: string; // Resource identifier
|
|
31
|
+
threadId?: string; // Thread identifier
|
|
32
|
+
runId?: string; // Run identifier
|
|
33
|
+
maxSteps?: number; // Max tool steps
|
|
34
|
+
activeTools?: string[]; // Tools to enable
|
|
35
|
+
toolChoice?: ToolChoice; // Tool selection mode
|
|
36
|
+
requestContext?: Record<string, unknown>; // Request context
|
|
37
|
+
output?: ZodSchema; // Structured output schema
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Generate response
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
{
|
|
45
|
+
text: string;
|
|
46
|
+
toolCalls?: ToolCall[];
|
|
47
|
+
finishReason: string;
|
|
48
|
+
usage?: {
|
|
49
|
+
promptTokens: number;
|
|
50
|
+
completionTokens: number;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Workflows
|
|
56
|
+
|
|
57
|
+
| Method | Path | Description |
|
|
58
|
+
|--------|------|-------------|
|
|
59
|
+
| `GET` | `/api/workflows` | List all workflows |
|
|
60
|
+
| `GET` | `/api/workflows/:workflowId` | Get workflow by ID |
|
|
61
|
+
| `POST` | `/api/workflows/:workflowId/stream` | Stream workflow execution |
|
|
62
|
+
| `POST` | `/api/workflows/:workflowId/resume` | Resume suspended workflow |
|
|
63
|
+
| `POST` | `/api/workflows/:workflowId/resume-async` | Resume asynchronously |
|
|
64
|
+
| `GET` | `/api/workflows/:workflowId/runs` | List workflow runs |
|
|
65
|
+
| `GET` | `/api/workflows/:workflowId/runs/:runId` | Get specific run |
|
|
66
|
+
|
|
67
|
+
### Stream workflow request body
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
{
|
|
71
|
+
inputData?: unknown;
|
|
72
|
+
initialState?: unknown;
|
|
73
|
+
requestContext?: Record<string, unknown>;
|
|
74
|
+
closeOnSuspend?: boolean;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Resume request body
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
{
|
|
82
|
+
step?: string | string[];
|
|
83
|
+
resumeData?: unknown;
|
|
84
|
+
requestContext?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Tools
|
|
89
|
+
|
|
90
|
+
| Method | Path | Description |
|
|
91
|
+
|--------|------|-------------|
|
|
92
|
+
| `GET` | `/api/tools` | List all tools |
|
|
93
|
+
| `GET` | `/api/tools/:toolId` | Get tool by ID |
|
|
94
|
+
| `POST` | `/api/tools/:toolId/execute` | Execute tool |
|
|
95
|
+
|
|
96
|
+
### Execute tool request body
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
{
|
|
100
|
+
data: unknown; // Tool input data
|
|
101
|
+
requestContext?: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Memory
|
|
106
|
+
|
|
107
|
+
| Method | Path | Description |
|
|
108
|
+
|--------|------|-------------|
|
|
109
|
+
| `GET` | `/api/memory/threads` | List threads |
|
|
110
|
+
| `GET` | `/api/memory/threads/:threadId` | Get thread |
|
|
111
|
+
| `POST` | `/api/memory/threads` | Create thread |
|
|
112
|
+
| `DELETE` | `/api/memory/threads/:threadId` | Delete thread |
|
|
113
|
+
| `GET` | `/api/memory/threads/:threadId/messages` | Get thread messages |
|
|
114
|
+
| `POST` | `/api/memory/threads/:threadId/messages` | Add message |
|
|
115
|
+
|
|
116
|
+
### Create thread request body
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
{
|
|
120
|
+
resourceId: string;
|
|
121
|
+
title?: string;
|
|
122
|
+
metadata?: Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Vectors
|
|
127
|
+
|
|
128
|
+
| Method | Path | Description |
|
|
129
|
+
|--------|------|-------------|
|
|
130
|
+
| `POST` | `/api/vectors/:vectorName/upsert` | Upsert vectors |
|
|
131
|
+
| `POST` | `/api/vectors/:vectorName/query` | Query vectors |
|
|
132
|
+
| `POST` | `/api/vectors/:vectorName/delete` | Delete vectors |
|
|
133
|
+
|
|
134
|
+
### Upsert request body
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
{
|
|
138
|
+
vectors: Array<{
|
|
139
|
+
id: string;
|
|
140
|
+
values: number[];
|
|
141
|
+
metadata?: Record<string, unknown>;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Query request body
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
{
|
|
150
|
+
vector: number[];
|
|
151
|
+
topK?: number;
|
|
152
|
+
filter?: Record<string, unknown>;
|
|
153
|
+
includeMetadata?: boolean;
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## MCP
|
|
158
|
+
|
|
159
|
+
| Method | Path | Description |
|
|
160
|
+
|--------|------|-------------|
|
|
161
|
+
| `GET` | `/api/mcp/servers` | List MCP servers |
|
|
162
|
+
| `GET` | `/api/mcp/servers/:serverId/tools` | List server tools |
|
|
163
|
+
| `POST` | `/api/mcp/:serverId` | MCP HTTP transport |
|
|
164
|
+
| `GET` | `/api/mcp/:serverId/sse` | MCP SSE transport |
|
|
165
|
+
|
|
166
|
+
## Logs
|
|
167
|
+
|
|
168
|
+
| Method | Path | Description |
|
|
169
|
+
|--------|------|-------------|
|
|
170
|
+
| `GET` | `/api/logs` | List logs |
|
|
171
|
+
| `GET` | `/api/logs/:runId` | Get logs by run ID |
|
|
172
|
+
|
|
173
|
+
### Query parameters
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
{
|
|
177
|
+
page?: number;
|
|
178
|
+
perPage?: number;
|
|
179
|
+
transportId?: string;
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Telemetry
|
|
184
|
+
|
|
185
|
+
| Method | Path | Description |
|
|
186
|
+
|--------|------|-------------|
|
|
187
|
+
| `GET` | `/api/telemetry/traces` | List traces |
|
|
188
|
+
| `GET` | `/api/telemetry/traces/:traceId` | Get trace |
|
|
189
|
+
| `GET` | `/api/telemetry/traces/:traceId/spans` | Get trace spans |
|
|
190
|
+
|
|
191
|
+
## Common query parameters
|
|
192
|
+
|
|
193
|
+
### Pagination
|
|
194
|
+
|
|
195
|
+
Most list endpoints support:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
{
|
|
199
|
+
page?: number; // Page number (0-indexed)
|
|
200
|
+
perPage?: number; // Items per page (default: 10)
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Or offset-based:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
{
|
|
208
|
+
offset?: number; // Skip N items
|
|
209
|
+
limit?: number; // Max items (default: 50)
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Filtering
|
|
214
|
+
|
|
215
|
+
Workflow runs support:
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
{
|
|
219
|
+
fromDate?: string; // ISO date string
|
|
220
|
+
toDate?: string; // ISO date string
|
|
221
|
+
status?: string; // Run status filter
|
|
222
|
+
resourceId?: string; // Filter by resource
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Error responses
|
|
227
|
+
|
|
228
|
+
All routes return errors in this format:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
{
|
|
232
|
+
error: string; // Error message
|
|
233
|
+
details?: unknown; // Additional details
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Common status codes:
|
|
238
|
+
|
|
239
|
+
| Code | Meaning |
|
|
240
|
+
|------|---------|
|
|
241
|
+
| 400 | Bad Request - Invalid parameters |
|
|
242
|
+
| 401 | Unauthorized - Missing/invalid auth |
|
|
243
|
+
| 403 | Forbidden - Insufficient permissions |
|
|
244
|
+
| 404 | Not Found - Resource doesn't exist |
|
|
245
|
+
| 500 | Internal Server Error |
|
|
246
|
+
|
|
247
|
+
## Related
|
|
248
|
+
|
|
249
|
+
- [createRoute()](/reference/v1/server/create-route) - Creating custom routes
|
|
250
|
+
- [Server Adapters](/docs/v1/server-db/server-adapters) - Using adapters
|