@protogrid/ai-sdk 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +33 -2
- package/dist/index.d.ts +80 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +150 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 protogrid contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @protogrid/ai-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vercel AI SDK tools from the [protogrid](https://protogrid.dev) MCP registry: find MCP servers by what they do, check them against your rules, and give your agent the tools of the ones that pass.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @protogrid/ai-sdk ai
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { generateText, isStepCount } from "ai";
|
|
11
|
+
import { loadTools } from "@protogrid/ai-sdk";
|
|
12
|
+
|
|
13
|
+
await using mail = await loadTools({
|
|
14
|
+
query: "send an email",
|
|
15
|
+
rules: { min_quality: 70 }, // also refuses hidden text, tool poisoning, known vulnerabilities and paid servers
|
|
16
|
+
secrets: { MAIL_API_KEY: process.env.MAIL_API_KEY },
|
|
17
|
+
});
|
|
18
|
+
const { text } = await generateText({
|
|
19
|
+
model,
|
|
20
|
+
tools: mail.tools,
|
|
21
|
+
prompt: "Mail the report to ops",
|
|
22
|
+
stopWhen: isStepCount(5),
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- `loadTools` tries the best search results (or the `servers` you name) in order. Each goes through protogrid's gate with your rules; one that passes is connected to directly, with no proxy, and its tools come back named `<server key>_<tool>`. `origins` says which server each tool comes from; `close()` (or `await using`) closes the connections.
|
|
27
|
+
- Secrets fill the `${NAME}` placeholders of the server's connection in your process; they are never sent to protogrid. A server needing a secret you did not give is passed over.
|
|
28
|
+
- Rules are yours, not the model's. A rule you leave out keeps its default, which refuses tools that hide text from people, tools holding instructions aimed at the model, and servers with a known vulnerability in their dependencies, and servers that charge per call (x402), which an agent without a wallet cannot use (`paid: null` accepts them). Local packages are never loaded.
|
|
29
|
+
- `pins: { "io.github.owner/server": "<tools_hash>" }` passes over a server whose checked tools changed since you reviewed them; `strictTools: true` also compares the tools the server lists right now with the ones protogrid checked.
|
|
30
|
+
- `searchTool()` and `gateTool({ rules })` let the agent look for servers and check one itself.
|
|
31
|
+
|
|
32
|
+
AI SDK 7, Node.js 20 or later. Built on [`@protogrid/sdk`](https://www.npmjs.com/package/@protogrid/sdk) and the official MCP client. Full guide: [docs.protogrid.dev/sdk/ai-sdk](https://docs.protogrid.dev/sdk/ai-sdk/).
|
|
33
|
+
|
|
34
|
+
MIT licensed.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel AI SDK tools from the protogrid MCP registry: the tools of MCP servers that pass your rules, connected
|
|
3
|
+
* directly (no proxy in between), plus two tools that let the agent search the registry and check a server itself.
|
|
4
|
+
*/
|
|
5
|
+
import type { CallToolResult } from "@modelcontextprotocol/client";
|
|
6
|
+
import { LoadReport, type LoadOptions, type LoadRules, type ProtogridClient } from "@protogrid/sdk";
|
|
7
|
+
import { type Tool, type ToolSet } from "ai";
|
|
8
|
+
export { LoadReport, NoServerLoaded, type LoadRules, type Skipped } from "@protogrid/sdk";
|
|
9
|
+
export type LoadToolsOptions = Omit<LoadOptions, "clientInfo">;
|
|
10
|
+
/** Where a loaded tool comes from. */
|
|
11
|
+
export interface ToolOrigin {
|
|
12
|
+
server: string;
|
|
13
|
+
/** The tool's own name on the server. */
|
|
14
|
+
tool: string;
|
|
15
|
+
/** The hash of the tool set protogrid checked. */
|
|
16
|
+
toolsHash: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ProtogridTools {
|
|
19
|
+
/** Pass to `generateText`, `streamText` or an `Agent`. Named `<server key>_<tool>`. */
|
|
20
|
+
tools: ToolSet;
|
|
21
|
+
origins: Record<string, ToolOrigin>;
|
|
22
|
+
report: LoadReport;
|
|
23
|
+
/** Closes the connection to every loaded server. Also runs on `await using`. */
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The tools of up to `maxServers` MCP servers that pass `rules`. Give a `query` (the best `candidates` search results
|
|
29
|
+
* are tried in order) or `servers` by registry name. Each server goes through protogrid's gate with your rules; one
|
|
30
|
+
* that passes is connected to directly, with the `${NAME}` placeholders of its connection filled from `secrets` (they
|
|
31
|
+
* never leave your process). Throws `NoServerLoaded` when none could be loaded; close the result when you are done.
|
|
32
|
+
*/
|
|
33
|
+
export declare function loadTools(opts: LoadToolsOptions): Promise<ProtogridTools>;
|
|
34
|
+
type ModelOutput = ReturnType<NonNullable<Tool["toModelOutput"]>> extends infer R ? Awaited<R> : never;
|
|
35
|
+
/** An MCP tool result as the model sees it: text and files as content, an error as error text. */
|
|
36
|
+
export declare function toModelOutput(result: CallToolResult): ModelOutput;
|
|
37
|
+
export interface RegistryToolOptions {
|
|
38
|
+
/** The registry client; one is built from `apiKey` (or `PROTOGRID_API_KEY`) and `baseUrl` otherwise. */
|
|
39
|
+
registry?: ProtogridClient;
|
|
40
|
+
apiKey?: string;
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ServerSummary {
|
|
44
|
+
name: string;
|
|
45
|
+
title: string | null;
|
|
46
|
+
description: string;
|
|
47
|
+
connection_class: string;
|
|
48
|
+
quality_score: number | null;
|
|
49
|
+
quality_flags: string[];
|
|
50
|
+
owner_verified: boolean;
|
|
51
|
+
tools: string[];
|
|
52
|
+
}
|
|
53
|
+
export type RegistryFailure = {
|
|
54
|
+
error: string;
|
|
55
|
+
status: number;
|
|
56
|
+
};
|
|
57
|
+
export interface GateAnswer {
|
|
58
|
+
server: string;
|
|
59
|
+
pass: boolean;
|
|
60
|
+
failed: string[];
|
|
61
|
+
quality_score?: number | null;
|
|
62
|
+
connection_class?: string;
|
|
63
|
+
owner_verified?: boolean;
|
|
64
|
+
tools_hash?: string | null;
|
|
65
|
+
}
|
|
66
|
+
/** `protogrid_search`: finds MCP servers by what they do, with what decides the choice for each. */
|
|
67
|
+
export declare function searchTool(opts?: RegistryToolOptions): Tool<{
|
|
68
|
+
query: string;
|
|
69
|
+
limit?: number;
|
|
70
|
+
}, ServerSummary[] | RegistryFailure>;
|
|
71
|
+
/**
|
|
72
|
+
* `protogrid_gate`: whether one MCP server passes the rules given here. The model names the server; it cannot change
|
|
73
|
+
* the rules. The defaults are those of `loadTools`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function gateTool(opts?: RegistryToolOptions & {
|
|
76
|
+
rules?: LoadRules;
|
|
77
|
+
}): Tool<{
|
|
78
|
+
server: string;
|
|
79
|
+
}, GateAnswer>;
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAEL,UAAU,EAMV,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAmD,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,IAAI,CAAC;AAE9F,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI1F,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AAE/D,sCAAsC;AACtC,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,uFAAuF;IACvF,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,MAAM,EAAE,UAAU,CAAC;IACnB,gFAAgF;IAChF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,MAAM,CAAC,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AAI,CAAC;CAC5B;AAeD,oGAAoG;AACpG,wBAAgB,UAAU,CACxB,IAAI,GAAE,mBAAwB,GAC7B,IAAI,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,aAAa,EAAE,GAAG,eAAe,CAAC,CA0B5E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,GAAE,mBAAmB,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAO,GAAG,IAAI,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,UAAU,CAAC,CAmCrH"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { createClient, LoadReport, loadRules, loadServers, prefixedToolName, ProtogridError, } from "@protogrid/sdk";
|
|
2
|
+
import { dynamicTool, jsonSchema, tool } from "ai";
|
|
3
|
+
export { LoadReport, NoServerLoaded } from "@protogrid/sdk";
|
|
4
|
+
const CLIENT = { name: "protogrid-ai-sdk", version: "0.1.1" };
|
|
5
|
+
/**
|
|
6
|
+
* The tools of up to `maxServers` MCP servers that pass `rules`. Give a `query` (the best `candidates` search results
|
|
7
|
+
* are tried in order) or `servers` by registry name. Each server goes through protogrid's gate with your rules; one
|
|
8
|
+
* that passes is connected to directly, with the `${NAME}` placeholders of its connection filled from `secrets` (they
|
|
9
|
+
* never leave your process). Throws `NoServerLoaded` when none could be loaded; close the result when you are done.
|
|
10
|
+
*/
|
|
11
|
+
export async function loadTools(opts) {
|
|
12
|
+
const report = opts.report ?? new LoadReport();
|
|
13
|
+
const servers = await loadServers({ ...opts, report, clientInfo: CLIENT });
|
|
14
|
+
const tools = {};
|
|
15
|
+
const origins = {};
|
|
16
|
+
for (const s of servers) {
|
|
17
|
+
for (const t of s.tools) {
|
|
18
|
+
const name = prefixedToolName(s.key, t.name);
|
|
19
|
+
if (name in tools)
|
|
20
|
+
continue;
|
|
21
|
+
tools[name] = mcpTool(s, t);
|
|
22
|
+
origins[name] = { server: s.server, tool: t.name, toolsHash: s.toolsHash };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const close = async () => {
|
|
26
|
+
await Promise.allSettled(servers.map((s) => s.close()));
|
|
27
|
+
};
|
|
28
|
+
return { tools, origins, report, close, [Symbol.asyncDispose]: close };
|
|
29
|
+
}
|
|
30
|
+
function mcpTool(server, t) {
|
|
31
|
+
return dynamicTool({
|
|
32
|
+
description: t.description ?? t.title ?? "",
|
|
33
|
+
inputSchema: jsonSchema({ type: "object", properties: {}, ...t.inputSchema }),
|
|
34
|
+
execute: (input, { abortSignal }) => server.callTool(t.name, (input ?? {}), abortSignal ? { signal: abortSignal } : {}),
|
|
35
|
+
toModelOutput: ({ output }) => toModelOutput(output),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** An MCP tool result as the model sees it: text and files as content, an error as error text. */
|
|
39
|
+
export function toModelOutput(result) {
|
|
40
|
+
const parts = [];
|
|
41
|
+
for (const c of result.content ?? []) {
|
|
42
|
+
if (c.type === "text")
|
|
43
|
+
parts.push({ type: "text", text: c.text });
|
|
44
|
+
else if (c.type === "image" || c.type === "audio")
|
|
45
|
+
parts.push({ type: "file", data: { type: "data", data: c.data }, mediaType: c.mimeType });
|
|
46
|
+
else if (c.type === "resource")
|
|
47
|
+
parts.push({
|
|
48
|
+
type: "text",
|
|
49
|
+
text: "text" in c.resource ? c.resource.text : `[${c.resource.mimeType ?? "binary"} resource ${c.resource.uri}]`,
|
|
50
|
+
});
|
|
51
|
+
else if (c.type === "resource_link")
|
|
52
|
+
parts.push({ type: "text", text: `[resource ${c.uri}${c.name ? ` (${c.name})` : ""}]` });
|
|
53
|
+
}
|
|
54
|
+
if (result.isError)
|
|
55
|
+
return {
|
|
56
|
+
type: "error-text",
|
|
57
|
+
value: parts.map((p) => (p.type === "text" ? p.text : "")).join("\n") || "the tool failed",
|
|
58
|
+
};
|
|
59
|
+
if (parts.length === 0)
|
|
60
|
+
return result.structuredContent
|
|
61
|
+
? { type: "json", value: result.structuredContent }
|
|
62
|
+
: { type: "text", value: "" };
|
|
63
|
+
return { type: "content", value: parts };
|
|
64
|
+
}
|
|
65
|
+
const registryOf = (o) => o.registry ?? createClient({ apiKey: o.apiKey, baseUrl: o.baseUrl, userAgent: `${CLIENT.name}/${CLIENT.version}` });
|
|
66
|
+
const failure = (e) => {
|
|
67
|
+
if (e instanceof ProtogridError)
|
|
68
|
+
return { error: e.code, status: e.status };
|
|
69
|
+
throw e;
|
|
70
|
+
};
|
|
71
|
+
function summary(r) {
|
|
72
|
+
return {
|
|
73
|
+
name: r.name,
|
|
74
|
+
title: r.title ?? null,
|
|
75
|
+
description: (r.description ?? "").slice(0, 300),
|
|
76
|
+
connection_class: r.connection_class,
|
|
77
|
+
quality_score: r.quality_score ?? null,
|
|
78
|
+
quality_flags: r.quality_flags ?? [],
|
|
79
|
+
owner_verified: r.owner_verified ?? false,
|
|
80
|
+
tools: (r.matched_tools ?? []).map((t) => t.name).slice(0, 5),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** `protogrid_search`: finds MCP servers by what they do, with what decides the choice for each. */
|
|
84
|
+
export function searchTool(opts = {}) {
|
|
85
|
+
const reg = registryOf(opts);
|
|
86
|
+
return tool({
|
|
87
|
+
description: "Find MCP servers by what they do. Returns for each: its registry name, connection class (R0 nothing to set up, R1 needs a key, R2 needs a sign-in, L0 a local package), quality score and flags, whether its owner is verified, and the tools that matched.",
|
|
88
|
+
inputSchema: jsonSchema({
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
query: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: "What the MCP server should do, in plain words, such as 'send an email' or 'query a postgres database'.",
|
|
94
|
+
},
|
|
95
|
+
limit: { type: "integer", minimum: 1, maximum: 20, default: 5, description: "How many servers to return." },
|
|
96
|
+
},
|
|
97
|
+
required: ["query"],
|
|
98
|
+
additionalProperties: false,
|
|
99
|
+
}),
|
|
100
|
+
execute: async ({ query, limit }) => {
|
|
101
|
+
try {
|
|
102
|
+
return (await reg.search({ q: query, limit: limit ?? 5 })).results.map(summary);
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
return failure(e);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* `protogrid_gate`: whether one MCP server passes the rules given here. The model names the server; it cannot change
|
|
112
|
+
* the rules. The defaults are those of `loadTools`.
|
|
113
|
+
*/
|
|
114
|
+
export function gateTool(opts = {}) {
|
|
115
|
+
const reg = registryOf(opts);
|
|
116
|
+
const rules = loadRules(opts.rules);
|
|
117
|
+
return tool({
|
|
118
|
+
description: "Check whether an MCP server passes the rules its owner set for this agent before using it. Returns pass or fail with every broken rule.",
|
|
119
|
+
inputSchema: jsonSchema({
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: {
|
|
122
|
+
server: {
|
|
123
|
+
type: "string",
|
|
124
|
+
description: "The server's registry name, such as io.github.owner/server, as protogrid_search returns it.",
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
required: ["server"],
|
|
128
|
+
additionalProperties: false,
|
|
129
|
+
}),
|
|
130
|
+
execute: async ({ server }) => {
|
|
131
|
+
try {
|
|
132
|
+
const g = await reg.gate(server, rules);
|
|
133
|
+
return {
|
|
134
|
+
server: g.server,
|
|
135
|
+
pass: g.pass,
|
|
136
|
+
failed: g.failed.map((f) => f.detail),
|
|
137
|
+
quality_score: g.quality.score,
|
|
138
|
+
connection_class: g.class,
|
|
139
|
+
owner_verified: g.owner_verified,
|
|
140
|
+
tools_hash: g.tools_hash,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
const f = failure(e);
|
|
145
|
+
return { server, pass: false, failed: [`registry answered ${f.status} (${f.error})`] };
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
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
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protogrid/ai-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Vercel AI SDK tools from the protogrid MCP registry: find MCP servers by what they do, check them against your rules, and give your agent the tools of the ones that pass.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -b tsconfig.json",
|
|
24
|
+
"typecheck": "tsc -b tsconfig.json",
|
|
25
|
+
"prepublishOnly": "pnpm run build"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/client": "^2.2.0",
|
|
29
|
+
"@protogrid/sdk": "^0.6.1"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"ai": "^7.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@modelcontextprotocol/node": "^2.1.0",
|
|
36
|
+
"@modelcontextprotocol/server": "^2.1.0",
|
|
37
|
+
"ai": "^7.0.181",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"zod": "^4.6.7"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/protogrid-dev/sdk.git",
|
|
44
|
+
"directory": "ai-sdk"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://docs.protogrid.dev/sdk/ai-sdk/",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/protogrid-dev/sdk/issues"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"mcp",
|
|
52
|
+
"model-context-protocol",
|
|
53
|
+
"ai-sdk",
|
|
54
|
+
"vercel",
|
|
55
|
+
"agents",
|
|
56
|
+
"tools",
|
|
57
|
+
"protogrid"
|
|
58
|
+
],
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
}
|
|
62
|
+
}
|