@maviapi/mcp 0.2.5 → 0.2.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.
- package/README.md +1 -1
- package/dist/client.js +3 -3
- package/dist/config.js +1 -1
- package/dist/requests.js +7 -7
- package/dist/tools.js +3 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ Leave out `env` to try it with the demo key.
|
|
|
102
102
|
| `call_api` | Call an endpoint and get live JSON back. List endpoints return 10 results unless you pass `limit`. An answer over 50,000 characters is cut to whole rows and flagged `truncated` (rows returned, rows asked); the HTTP API itself never cuts. |
|
|
103
103
|
| `create_api` | No API for the site you need? Starts a build from a URL and a plain-language description, and returns a `request_id`. |
|
|
104
104
|
| `get_build_status` | Where a build is: its phase, each endpoint with its test results or what went wrong, and what the build said last. `wait_seconds` returns as soon as something changes. A finished build is not public until it is published. |
|
|
105
|
-
| `request_endpoint` | Add one endpoint to an API that exists, or a
|
|
105
|
+
| `request_endpoint` | Add one endpoint to an API that exists, or a change to one (it ships beside the old one, e.g. `/search-v2`). Previews first; `confirm: true` starts the build. |
|
|
106
106
|
| `list_requests` | Your API and endpoint requests, with their status. |
|
|
107
107
|
| `send_request_message` | Tell a build something in plain words: add detail, fix or drop a failed endpoint, try again. |
|
|
108
108
|
| `call_draft` | Call an endpoint of a draft before it is published. Costs no credits. |
|
package/dist/client.js
CHANGED
|
@@ -52,10 +52,10 @@ export class MaviapiClient {
|
|
|
52
52
|
getBuild(id) {
|
|
53
53
|
return this.send("GET", `/v1/requests/${encodeURIComponent(id)}`);
|
|
54
54
|
}
|
|
55
|
-
/** Call one endpoint through the maviapi gateway, on the live build
|
|
56
|
-
async call(slug, endpoint, params
|
|
55
|
+
/** Call one endpoint through the maviapi gateway, on the live build. */
|
|
56
|
+
async call(slug, endpoint, params) {
|
|
57
57
|
const { path, query } = fillPath(endpoint.path, params);
|
|
58
|
-
return this.send(endpoint.method, `/v1/sites/${encodeURIComponent(slug)}${path}${buildQuery(query)}
|
|
58
|
+
return this.send(endpoint.method, `/v1/sites/${encodeURIComponent(slug)}${path}${buildQuery(query)}`);
|
|
59
59
|
}
|
|
60
60
|
/** Drop what is cached about one API, after a request changed it. */
|
|
61
61
|
invalidateApi(slug) {
|
package/dist/config.js
CHANGED
package/dist/requests.js
CHANGED
|
@@ -20,7 +20,7 @@ export const REQUEST_TOOLS = [
|
|
|
20
20
|
{
|
|
21
21
|
name: "request_endpoint",
|
|
22
22
|
title: "Ask for a new maviapi endpoint",
|
|
23
|
-
description: "Add one endpoint to an API that already exists, or a
|
|
23
|
+
description: "Add one endpoint to an API that already exists, or a change to one of its endpoints. " +
|
|
24
24
|
"Use it when get_api shows the API lacks the data, or an endpoint returns the wrong thing. " +
|
|
25
25
|
"Existing endpoints never change: a change ships as a new endpoint beside the old one (e.g. /search-v2). " +
|
|
26
26
|
"Without `confirm` nothing is built: the tool answers with the endpoint as it would be built, for the user to agree to. " +
|
|
@@ -42,7 +42,7 @@ export const REQUEST_TOOLS = [
|
|
|
42
42
|
},
|
|
43
43
|
change: {
|
|
44
44
|
type: "string",
|
|
45
|
-
description: 'For a
|
|
45
|
+
description: 'For a change to an existing endpoint: that endpoint\'s name or path, e.g. "/search". Use instead of `path`.',
|
|
46
46
|
},
|
|
47
47
|
confirm: { type: "boolean", description: "true starts the build. Leave it out to preview first." },
|
|
48
48
|
},
|
|
@@ -128,7 +128,7 @@ export const REQUEST_TOOLS = [
|
|
|
128
128
|
name: "report_endpoint_issue",
|
|
129
129
|
title: "Report a broken maviapi endpoint",
|
|
130
130
|
description: "Tell maviapi that an endpoint that exists returns the wrong thing: it fails, comes back empty, or repeats the same page. " +
|
|
131
|
-
"Use this instead of asking for a
|
|
131
|
+
"Use this instead of asking for a change when the endpoint is simply broken: the fix lands on the endpoint itself, for everyone. " +
|
|
132
132
|
"maviapi replays the call at once and then runs its own check of the endpoint. If that check fails too the report is confirmed and the endpoint is queued for repair; " +
|
|
133
133
|
"if not (a fault only certain parameters show, a repeated page, wrong values) a person on the team reads the report. " +
|
|
134
134
|
"A report's status is confirmed, fixed or received. " +
|
|
@@ -163,7 +163,7 @@ export const REQUEST_TOOLS = [
|
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
name: "get_changelog",
|
|
166
|
-
title: "Show a maviapi API
|
|
166
|
+
title: "Show what changed in a maviapi API",
|
|
167
167
|
description: "What changed in an API, newest first: the date of each change, which one is live, and what it changed (endpoints added, fields changed, fixes). " +
|
|
168
168
|
"Use it when an endpoint behaves differently than before.",
|
|
169
169
|
inputSchema: {
|
|
@@ -320,7 +320,7 @@ export class RequestTools {
|
|
|
320
320
|
const path = stringArg(args, "path");
|
|
321
321
|
const change = stringArg(args, "change");
|
|
322
322
|
if (!path && !change) {
|
|
323
|
-
throw new UserError('Pass `path` for a new endpoint (e.g. "/reviews"), or `change` with an existing endpoint to get a
|
|
323
|
+
throw new UserError('Pass `path` for a new endpoint (e.g. "/reviews"), or `change` with an existing endpoint to get a change to it.');
|
|
324
324
|
}
|
|
325
325
|
if (path && change)
|
|
326
326
|
throw new UserError("Pass `path` or `change`, not both.");
|
|
@@ -355,7 +355,7 @@ export class RequestTools {
|
|
|
355
355
|
const endpoint = (body.endpoint ?? {});
|
|
356
356
|
const out = [
|
|
357
357
|
`Nothing has been built yet. This would add to ${api.name} (${api.slug}):`,
|
|
358
|
-
` GET ${endpoint.path}${endpoint.of ? ` (a
|
|
358
|
+
` GET ${endpoint.path}${endpoint.of ? ` (a change to GET ${endpoint.of}, which stays as it is)` : ""}`,
|
|
359
359
|
` ${endpoint.summary}`,
|
|
360
360
|
"",
|
|
361
361
|
"Show this to the user. If they agree, call request_endpoint again with the same arguments and confirm: true.",
|
|
@@ -425,7 +425,7 @@ export class RequestTools {
|
|
|
425
425
|
? "Nothing more to do: the endpoint keeps its path, so the same call works once it is repaired. " +
|
|
426
426
|
"get_api shows the endpoint's health; report_endpoint_issue with no arguments shows where this report stands."
|
|
427
427
|
: "If the fault only shows with certain parameters, they are in the report for the person who reads it. " +
|
|
428
|
-
"If you need different behavior rather than a fix, request_endpoint with `change` builds
|
|
428
|
+
"If you need different behavior rather than a fix, request_endpoint with `change` builds the change beside this one.",
|
|
429
429
|
].join("\n"));
|
|
430
430
|
}
|
|
431
431
|
async listReports() {
|
package/dist/tools.js
CHANGED
|
@@ -53,10 +53,6 @@ const GENERIC_TOOLS = [
|
|
|
53
53
|
description: "Endpoint parameters, as listed by get_api.",
|
|
54
54
|
additionalProperties: true,
|
|
55
55
|
},
|
|
56
|
-
version: {
|
|
57
|
-
type: "integer",
|
|
58
|
-
description: "Call this build of the API instead of the live one. Only the API's owner can pick a build; anyone else gets the live one. Rarely needed.",
|
|
59
|
-
},
|
|
60
56
|
},
|
|
61
57
|
required: ["api", "endpoint"],
|
|
62
58
|
},
|
|
@@ -243,14 +239,10 @@ export class Toolset {
|
|
|
243
239
|
throw new UserError(`${api.slug} has no endpoint "${ref}". Available: ${endpoints.map((e) => e.name).join(", ")}. ` +
|
|
244
240
|
`get_api "${api.slug}" lists their parameters.`);
|
|
245
241
|
}
|
|
246
|
-
|
|
247
|
-
if (version !== undefined && (!Number.isInteger(version) || version < 1)) {
|
|
248
|
-
throw new UserError("`version` must be a build number of this API, e.g. 3. Leave it out to call the live build.");
|
|
249
|
-
}
|
|
250
|
-
return this.run(api.slug, endpoint, params, version);
|
|
242
|
+
return this.run(api.slug, endpoint, params);
|
|
251
243
|
}
|
|
252
244
|
/** Call an endpoint and turn the outcome into something an agent can act on. */
|
|
253
|
-
async run(slug, endpoint, input
|
|
245
|
+
async run(slug, endpoint, input) {
|
|
254
246
|
const params = { ...input };
|
|
255
247
|
if ("limit" in endpoint.inputSchema.properties && params.limit === undefined) {
|
|
256
248
|
params.limit = DEFAULT_LIMIT;
|
|
@@ -258,7 +250,7 @@ export class Toolset {
|
|
|
258
250
|
const missing = (endpoint.inputSchema.required ?? []).filter((name) => params[name] === undefined || params[name] === null || params[name] === "");
|
|
259
251
|
if (missing.length)
|
|
260
252
|
throw new MissingParamsError(missing);
|
|
261
|
-
const result = await this.client.call(slug, endpoint, params
|
|
253
|
+
const result = await this.client.call(slug, endpoint, params);
|
|
262
254
|
if (!result.ok)
|
|
263
255
|
return failure(this.describeFailure(result));
|
|
264
256
|
const asked = Number(params.limit);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maviapi/mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "MCP server for maviapi, the unofficial API for any website: hosted, documented JSON APIs for sites with no official API, kept working when the site changes.",
|
|
5
5
|
"mcpName": "io.github.kuzenlabs/maviapi-mcp",
|
|
6
6
|
"type": "module",
|