@comunica/mcp-sparql-file 1.0.0 → 1.1.0

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
@@ -218,6 +218,36 @@ possibly combined with a reverse proxy and/or OAuth layer.
218
218
  $ comunica-mcp-sparql-file --mode http --port 3123
219
219
  ```
220
220
 
221
+ ## Query timeouts
222
+
223
+ SPARQL queries can take arbitrarily long, for example when they are executed over large or slow sources.
224
+ To make sure that an agent never waits indefinitely, queries are aborted after `--timeout` milliseconds
225
+ (60 seconds by default, `--timeout 0` disables this), after which the agent receives an error
226
+ that invites it to refine its query.
227
+
228
+ ```bash
229
+ $ comunica-mcp-sparql-file --mode http --port 3123 --timeout 300000
230
+ ```
231
+
232
+ Comunica offers no way to abort a query that is already running,
233
+ so a timed out query would keep consuming CPU and memory in the background.
234
+ In http mode, queries are therefore executed inside worker processes that are supervised by a primary process,
235
+ which allows such workers to be replaced by a fresh one after a timeout.
236
+ This also makes the server recover from queries that block the event loop entirely,
237
+ which would otherwise make the server unreachable forever.
238
+
239
+ The number of workers can be configured with `--workers`, which also determines
240
+ how many queries can be executed concurrently:
241
+
242
+ ```bash
243
+ $ comunica-mcp-sparql-file --mode http --port 3123 --workers 4
244
+ ```
245
+
246
+ In stdio mode, the server always runs as a single process, since worker processes can not share a single
247
+ standard input stream, and replacing a worker would invalidate the MCP session of the connected client.
248
+ Queries are still aborted after `--timeout` milliseconds there, but their resources are only reclaimed
249
+ once the query terminates by itself.
250
+
221
251
  ## Available Tools
222
252
 
223
253
  This MCP server provides the following tools:
package/bin/mcp.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const query_sparql_file_1 = require("@comunica/query-sparql-file");
5
5
  const utils_mcp_1 = require("@comunica/utils-mcp");
6
6
  // eslint-disable-next-line ts/no-require-imports,ts/no-var-requires,import/extensions
7
- (0, utils_mcp_1.runCli)(new query_sparql_file_1.QueryEngine(), require('../package.json').version);
7
+ (0, utils_mcp_1.runCli)(() => new query_sparql_file_1.QueryEngine(), require('../package.json').version);
8
8
  //# sourceMappingURL=mcp.js.map
package/bin/mcp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["mcp.ts"],"names":[],"mappings":";;;AACA,mEAA0D;AAC1D,mDAA6C;AAE7C,sFAAsF;AACtF,IAAA,kBAAM,EAAC,IAAI,+BAAW,EAAE,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { QueryEngine } from '@comunica/query-sparql-file';\nimport { runCli } from '@comunica/utils-mcp';\n\n// eslint-disable-next-line ts/no-require-imports,ts/no-var-requires,import/extensions\nrunCli(new QueryEngine(), require('../package.json').version);\n"]}
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["mcp.ts"],"names":[],"mappings":";;;AACA,mEAA0D;AAC1D,mDAA6C;AAE7C,sFAAsF;AACtF,IAAA,kBAAM,EAAC,GAAG,EAAE,CAAC,IAAI,+BAAW,EAAE,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { QueryEngine } from '@comunica/query-sparql-file';\nimport { runCli } from '@comunica/utils-mcp';\n\n// eslint-disable-next-line ts/no-require-imports,ts/no-var-requires,import/extensions\nrunCli(() => new QueryEngine(), require('../package.json').version);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/mcp-sparql-file",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "An MCP server for executing SPARQL queries over local and remote RDF files",
5
5
  "license": "MIT",
6
6
  "funding": {
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@comunica/query-sparql-file": "^5.1.3",
57
- "@comunica/utils-mcp": "^1.0.0"
57
+ "@comunica/utils-mcp": "^1.1.0"
58
58
  },
59
- "gitHead": "8a35a73d61cf1066bb1181761884d84d3b932932"
59
+ "gitHead": "4d3c6e5233ec89ceeb45bd2a478652e7f74d5cd2"
60
60
  }