@meetkai/mka1 0.48.23 → 0.48.24
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/README.md +87 -186
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,235 +1,143 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MKA1 TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official TypeScript SDK for the MKA1 API.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<a href="https://www.speakeasy.com/?utm_source=openapi&utm_campaign=typescript"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
7
|
-
</div>
|
|
5
|
+
Use `@meetkai/mka1` to call MKA1 from Node.js, browsers, React apps, and agent tooling. The SDK includes typed clients for responses, agents, files, vector stores, evals, usage, model registry operations, guardrails, sandbox APIs, and more.
|
|
8
6
|
|
|
7
|
+
Full product and API documentation lives at [docs.mka1.com](https://docs.mka1.com).
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
## Summary
|
|
12
|
-
|
|
13
|
-
MKA1 API: The MKA1 API is a RESTful API that provides access to the MKA1 platform. Learn how to get started with the API and the TypeScript SDK [here](https://mka1.apidocumentation.com/guides/getting-started).
|
|
14
|
-
<!-- End Summary [summary] -->
|
|
15
|
-
|
|
16
|
-
<!-- Start Table of Contents [toc] -->
|
|
17
|
-
## Table of Contents
|
|
18
|
-
<!-- $toc-max-depth=2 -->
|
|
19
|
-
* [openapi](#openapi)
|
|
20
|
-
* [SDK Installation](#sdk-installation)
|
|
21
|
-
* [Requirements](#requirements)
|
|
22
|
-
* [SDK Example Usage](#sdk-example-usage)
|
|
23
|
-
* [Authentication](#authentication)
|
|
24
|
-
* [Available Resources and Operations](#available-resources-and-operations)
|
|
25
|
-
* [Standalone functions](#standalone-functions)
|
|
26
|
-
* [React hooks with TanStack Query](#react-hooks-with-tanstack-query)
|
|
27
|
-
* [Server-sent event streaming](#server-sent-event-streaming)
|
|
28
|
-
* [File uploads](#file-uploads)
|
|
29
|
-
* [Retries](#retries)
|
|
30
|
-
* [Error Handling](#error-handling)
|
|
31
|
-
* [Server Selection](#server-selection)
|
|
32
|
-
* [Custom HTTP Client](#custom-http-client)
|
|
33
|
-
* [Debugging](#debugging)
|
|
34
|
-
* [Development](#development)
|
|
35
|
-
* [Maturity](#maturity)
|
|
36
|
-
* [Contributions](#contributions)
|
|
37
|
-
|
|
38
|
-
<!-- End Table of Contents [toc] -->
|
|
39
|
-
|
|
40
|
-
<!-- Start SDK Installation [installation] -->
|
|
41
|
-
## SDK Installation
|
|
42
|
-
|
|
43
|
-
The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
|
|
44
|
-
|
|
45
|
-
### NPM
|
|
9
|
+
## Install
|
|
46
10
|
|
|
47
11
|
```bash
|
|
48
12
|
npm add @meetkai/mka1
|
|
49
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
50
|
-
npm add @tanstack/react-query react react-dom
|
|
51
13
|
```
|
|
52
14
|
|
|
53
|
-
### PNPM
|
|
54
|
-
|
|
55
15
|
```bash
|
|
56
16
|
pnpm add @meetkai/mka1
|
|
57
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
58
|
-
pnpm add @tanstack/react-query react react-dom
|
|
59
17
|
```
|
|
60
18
|
|
|
61
|
-
### Bun
|
|
62
|
-
|
|
63
19
|
```bash
|
|
64
20
|
bun add @meetkai/mka1
|
|
65
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
66
|
-
bun add @tanstack/react-query react react-dom
|
|
67
21
|
```
|
|
68
22
|
|
|
69
|
-
### Yarn
|
|
70
|
-
|
|
71
23
|
```bash
|
|
72
24
|
yarn add @meetkai/mka1
|
|
73
|
-
# Install optional peer dependencies if you plan to use React hooks
|
|
74
|
-
yarn add @tanstack/react-query react react-dom
|
|
75
25
|
```
|
|
76
26
|
|
|
77
|
-
|
|
78
|
-
> This package is published with CommonJS and ES Modules (ESM) support.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
### Model Context Protocol (MCP) Server
|
|
27
|
+
The package ships both ESM and CommonJS builds. For supported runtimes, see [RUNTIMES.md](RUNTIMES.md).
|
|
82
28
|
|
|
83
|
-
|
|
84
|
-
exposed as tools that can be invoked by AI applications.
|
|
29
|
+
## Quick Start
|
|
85
30
|
|
|
86
|
-
|
|
31
|
+
```typescript
|
|
32
|
+
import { SDK } from "@meetkai/mka1";
|
|
87
33
|
|
|
88
|
-
|
|
89
|
-
|
|
34
|
+
const mka1 = new SDK({
|
|
35
|
+
bearerAuth: process.env.MKA1_API_KEY,
|
|
36
|
+
});
|
|
90
37
|
|
|
91
|
-
|
|
38
|
+
const models = await mka1.llm.models.list({});
|
|
92
39
|
|
|
93
|
-
|
|
94
|
-
{
|
|
95
|
-
"mcpServers": {
|
|
96
|
-
"SDK": {
|
|
97
|
-
"command": "npx",
|
|
98
|
-
"args": [
|
|
99
|
-
"-y", "--package", "@meetkai/mka1",
|
|
100
|
-
"--",
|
|
101
|
-
"mcp", "start",
|
|
102
|
-
"--bearer-auth", "..."
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
40
|
+
console.log(models.data.map((model) => model.id));
|
|
107
41
|
```
|
|
108
42
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<details>
|
|
112
|
-
<summary>Cursor installation steps</summary>
|
|
113
|
-
|
|
114
|
-
Create a `.cursor/mcp.json` file in your project root with the following content:
|
|
43
|
+
Most write APIs use the same client:
|
|
115
44
|
|
|
116
|
-
```
|
|
117
|
-
{
|
|
118
|
-
"mcpServers": {
|
|
119
|
-
"SDK": {
|
|
120
|
-
"command": "npx",
|
|
121
|
-
"args": [
|
|
122
|
-
"-y", "--package", "@meetkai/mka1",
|
|
123
|
-
"--",
|
|
124
|
-
"mcp", "start",
|
|
125
|
-
"--bearer-auth", "..."
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
45
|
+
```typescript
|
|
46
|
+
import { SDK } from "@meetkai/mka1";
|
|
131
47
|
|
|
132
|
-
|
|
48
|
+
const mka1 = new SDK({
|
|
49
|
+
bearerAuth: process.env.MKA1_API_KEY,
|
|
50
|
+
});
|
|
133
51
|
|
|
134
|
-
|
|
52
|
+
const response = await mka1.llm.responses.create({
|
|
53
|
+
responsesCreateRequest: {
|
|
54
|
+
model: "<MODEL_ID>",
|
|
55
|
+
input: "Summarize the latest MKA1 eval run.",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
135
58
|
|
|
136
|
-
|
|
137
|
-
curl -L -o mcp-server \
|
|
138
|
-
https://github.com/{org}/{repo}/releases/download/{tag}/mcp-server-bun-darwin-arm64 && \
|
|
139
|
-
chmod +x mcp-server
|
|
59
|
+
console.log(response);
|
|
140
60
|
```
|
|
141
61
|
|
|
142
|
-
|
|
62
|
+
## Authentication
|
|
143
63
|
|
|
64
|
+
Pass an MKA1 API key or bearer token when constructing the client:
|
|
144
65
|
|
|
145
|
-
```
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"command": "./DOWNLOAD/PATH/mcp-server",
|
|
150
|
-
"args": [
|
|
151
|
-
"start"
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
66
|
+
```typescript
|
|
67
|
+
const mka1 = new SDK({
|
|
68
|
+
bearerAuth: process.env.MKA1_API_KEY,
|
|
69
|
+
});
|
|
156
70
|
```
|
|
157
71
|
|
|
158
|
-
|
|
72
|
+
You can also provide an async token resolver:
|
|
159
73
|
|
|
160
|
-
```
|
|
161
|
-
|
|
74
|
+
```typescript
|
|
75
|
+
const mka1 = new SDK({
|
|
76
|
+
bearerAuth: async () => refreshMka1Token(),
|
|
77
|
+
});
|
|
162
78
|
```
|
|
163
|
-
<!-- End SDK Installation [installation] -->
|
|
164
79
|
|
|
165
|
-
|
|
166
|
-
## Requirements
|
|
80
|
+
For account setup, API keys, and endpoint-specific examples, see [docs.mka1.com](https://docs.mka1.com).
|
|
167
81
|
|
|
168
|
-
|
|
169
|
-
<!-- End Requirements [requirements] -->
|
|
170
|
-
|
|
171
|
-
<!-- Start SDK Example Usage [usage] -->
|
|
172
|
-
## SDK Example Usage
|
|
173
|
-
|
|
174
|
-
### Example
|
|
82
|
+
## Common Entry Points
|
|
175
83
|
|
|
176
84
|
```typescript
|
|
177
|
-
|
|
85
|
+
mka1.llm.responses
|
|
86
|
+
mka1.llm.conversations
|
|
87
|
+
mka1.llm.files
|
|
88
|
+
mka1.llm.vectorStores
|
|
89
|
+
mka1.llm.evals
|
|
90
|
+
mka1.llm.models
|
|
91
|
+
mka1.llm.usage
|
|
92
|
+
mka1.agents
|
|
93
|
+
mka1.agentRuns
|
|
94
|
+
mka1.sandbox
|
|
95
|
+
mka1.permissions
|
|
96
|
+
```
|
|
178
97
|
|
|
179
|
-
|
|
180
|
-
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
|
|
181
|
-
});
|
|
98
|
+
The generated method reference below lists every resource and operation included in this SDK.
|
|
182
99
|
|
|
183
|
-
|
|
184
|
-
await sdk.permissions.llm.grant({
|
|
185
|
-
grantPermissionRequest: {
|
|
186
|
-
resourceType: "completion",
|
|
187
|
-
resourceId: "my-completion-123",
|
|
188
|
-
userId: "user-abc456",
|
|
189
|
-
role: "writer",
|
|
190
|
-
},
|
|
191
|
-
});
|
|
192
|
-
}
|
|
100
|
+
## React Query
|
|
193
101
|
|
|
194
|
-
|
|
102
|
+
React hooks are available from `@meetkai/mka1/react-query`. Install the optional peer dependencies only if you plan to use those hooks:
|
|
195
103
|
|
|
104
|
+
```bash
|
|
105
|
+
npm add @tanstack/react-query react react-dom
|
|
196
106
|
```
|
|
197
|
-
<!-- End SDK Example Usage [usage] -->
|
|
198
107
|
|
|
199
|
-
|
|
200
|
-
## Authentication
|
|
108
|
+
See [REACT_QUERY.md](REACT_QUERY.md) for provider setup, suspense hooks, invalidation helpers, and mutation examples.
|
|
201
109
|
|
|
202
|
-
|
|
110
|
+
## MCP Server
|
|
203
111
|
|
|
204
|
-
This
|
|
112
|
+
This package also exposes the MKA1 API as an installable Model Context Protocol server.
|
|
205
113
|
|
|
206
|
-
|
|
207
|
-
| ------------ | ---- | ----------- |
|
|
208
|
-
| `bearerAuth` | http | HTTP Bearer |
|
|
209
|
-
|
|
210
|
-
To authenticate with the API the `bearerAuth` parameter must be set when initializing the SDK client instance. For example:
|
|
211
|
-
```typescript
|
|
212
|
-
import { SDK } from "@meetkai/mka1";
|
|
114
|
+
Node.js v20 or newer is required for the MCP server.
|
|
213
115
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"mcpServers": {
|
|
119
|
+
"mka1": {
|
|
120
|
+
"command": "npx",
|
|
121
|
+
"args": [
|
|
122
|
+
"-y",
|
|
123
|
+
"--package",
|
|
124
|
+
"@meetkai/mka1",
|
|
125
|
+
"--",
|
|
126
|
+
"mcp",
|
|
127
|
+
"start",
|
|
128
|
+
"--bearer-auth",
|
|
129
|
+
"..."
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
227
133
|
}
|
|
134
|
+
```
|
|
228
135
|
|
|
229
|
-
|
|
136
|
+
For available server flags:
|
|
230
137
|
|
|
138
|
+
```bash
|
|
139
|
+
npx -y --package @meetkai/mka1 -- mcp start --help
|
|
231
140
|
```
|
|
232
|
-
<!-- End Authentication [security] -->
|
|
233
141
|
|
|
234
142
|
<!-- Start Available Resources and Operations [operations] -->
|
|
235
143
|
## Available Resources and Operations
|
|
@@ -1412,19 +1320,12 @@ const sdk = new SDK({ debugLogger: console });
|
|
|
1412
1320
|
```
|
|
1413
1321
|
<!-- End Debugging [debug] -->
|
|
1414
1322
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
# Development
|
|
1418
|
-
|
|
1419
|
-
## Maturity
|
|
1323
|
+
## Versioning
|
|
1420
1324
|
|
|
1421
|
-
|
|
1422
|
-
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
1423
|
-
looking for the latest version.
|
|
1325
|
+
The SDK is generated from the MKA1 OpenAPI schema and may gain new endpoints frequently. Pin an exact package version when deploying production applications, then upgrade intentionally after reviewing the generated type changes.
|
|
1424
1326
|
|
|
1425
|
-
##
|
|
1327
|
+
## Generated Code
|
|
1426
1328
|
|
|
1427
|
-
|
|
1428
|
-
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
1329
|
+
Most files under `src/`, `docs/`, and the generated reference sections in this README are produced from the API schema. Changes to generated implementation files are likely to be overwritten by the next SDK generation. For API behavior questions, integration support, or documentation issues, use the support channels listed at [docs.mka1.com](https://docs.mka1.com).
|
|
1429
1330
|
|
|
1430
|
-
|
|
1331
|
+
Generated with [Speakeasy](https://www.speakeasy.com/).
|