anyapi-mcp-server 1.2.0 → 1.2.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/README.md CHANGED
@@ -16,7 +16,9 @@ Instead of building a custom MCP server for every API, `anyapi-mcp-server` reads
16
16
  - **Retry with backoff** — automatic retries with exponential backoff and jitter for 429/5xx errors, honoring `Retry-After` headers
17
17
  - **Multi-format responses** — parses JSON, XML, CSV, and plain text responses automatically
18
18
  - **Built-in pagination** — API-level pagination via `params`; client-side slicing with top-level `limit`/`offset`
19
- - **Per-request headers** — override default headers on individual `call_api`/`query_api` calls
19
+ - **Spec documentation lookup** — `explain_api` returns rich endpoint docs (parameters, response codes, deprecation, request body schema) without making HTTP requests
20
+ - **Concurrent batch queries** — `batch_query` fetches data from up to 10 endpoints in parallel, returning all results in one tool call
21
+ - **Per-request headers** — override default headers on individual `call_api`/`query_api`/`batch_query` calls
20
22
  - **Environment variable interpolation** — use `${ENV_VAR}` in base URLs and headers
21
23
  - **Request logging** — optional NDJSON request/response log with sensitive header masking
22
24
 
@@ -126,7 +128,7 @@ Add to your MCP configuration (e.g. `~/.cursor/mcp.json` or Claude Desktop confi
126
128
 
127
129
  ## Tools
128
130
 
129
- The server exposes three MCP tools:
131
+ The server exposes five MCP tools:
130
132
 
131
133
  ### `list_api`
132
134
 
@@ -206,11 +208,33 @@ Fetch data from an API endpoint, returning only the fields you select via GraphQ
206
208
  - For API-level pagination, pass limit/offset inside `params` instead
207
209
  - Accepts optional `headers` to override defaults for this request
208
210
 
211
+ ### `explain_api`
212
+
213
+ Get detailed documentation for an endpoint directly from the spec — no HTTP request is made.
214
+
215
+ - Returns summary, description, operationId, deprecation status, tag
216
+ - Lists all parameters with name, location (`path`/`query`/`header`), required flag, and description
217
+ - Shows request body schema with property types, required fields, and descriptions
218
+ - Lists response status codes with descriptions (e.g. `200 OK`, `404 Not Found`)
219
+ - Includes external docs link when available
220
+
221
+ ### `batch_query`
222
+
223
+ Fetch data from multiple endpoints concurrently in a single tool call.
224
+
225
+ - Accepts an array of 1–10 requests, each with `method`, `path`, `params`, `body`, `query`, and optional `headers`
226
+ - All requests execute in parallel via `Promise.allSettled` — one failure does not affect the others
227
+ - Each request follows the `query_api` flow: HTTP fetch → schema inference → GraphQL field selection
228
+ - Returns an array of results: `{ method, path, data }` on success or `{ method, path, error }` on failure
229
+ - Run `call_api` first on each endpoint to discover the schema field names
230
+
209
231
  ## Workflow
210
232
 
211
233
  1. **Discover** endpoints with `list_api`
212
- 2. **Inspect** a specific endpoint with `call_api` to see its schema and suggested queries
213
- 3. **Query** the endpoint with `query_api` to fetch exactly the fields you need
234
+ 2. **Understand** an endpoint with `explain_api` to see its parameters, request body, and response codes
235
+ 3. **Inspect** a specific endpoint with `call_api` to see the inferred response schema and suggested queries
236
+ 4. **Query** the endpoint with `query_api` to fetch exactly the fields you need
237
+ 5. **Batch** multiple queries with `batch_query` when you need data from several endpoints at once
214
238
 
215
239
  ## How It Works
216
240
 
@@ -218,20 +242,21 @@ Fetch data from an API endpoint, returning only the fields you select via GraphQ
218
242
  OpenAPI/Postman spec
219
243
 
220
244
 
221
- ┌─────────┐ ┌──────────┐ ┌────────────┐
222
- list_api │ │ call_api │────▶│ query_api │
223
- (browse) │ │ (schema) │ (data)
224
- └─────────┘ └──────────┘ └────────────┘
225
-
226
-
227
- REST API call REST API call
228
- (with retry (cached if same
229
- + caching) as call_api)
230
-
231
-
232
- Infer GraphQL Execute GraphQL
233
- schema from query against
234
- JSON response response data
245
+ ┌─────────┐ ┌─────────────┐ ┌──────────┐ ┌───────────┐ ┌─────────────┐
246
+ │list_api │ explain_api │ │ call_api │ │ query_api batch_query │
247
+ │(browse) │ (docs) │ │ (schema) │ (data) │ (parallel) │
248
+ └─────────┘ └─────────────┘ └──────────┘ └───────────┘ └─────────────┘
249
+ no HTTP │ │ │
250
+ request ▼ ▼ ▼
251
+ Spec index Spec index REST API call REST API call N concurrent
252
+ (tags, (params, (with retry (cached if REST API calls
253
+ paths) responses, + caching) same as + GraphQL
254
+ body schema) call_api) execution
255
+
256
+ Infer GraphQL
257
+ schema from Execute GraphQL
258
+ JSON response query against
259
+ response data
235
260
  ```
236
261
 
237
262
  1. The spec file is parsed at startup into an endpoint index with tags, paths, parameters, and request body schemas
package/build/index.js CHANGED
@@ -13,7 +13,7 @@ initLogger(config.logPath ?? null);
13
13
  const apiIndex = new ApiIndex(config.spec);
14
14
  const server = new McpServer({
15
15
  name: config.name,
16
- version: "1.2.0",
16
+ version: "1.2.1",
17
17
  });
18
18
  // --- Tool 1: list_api ---
19
19
  server.tool("list_api", `List available ${config.name} API endpoints. ` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anyapi-mcp-server",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A universal MCP server that connects any REST API (via OpenAPI spec) to AI assistants, with GraphQL-style field selection and automatic schema inference.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",