s3-querier 1.2.0 → 1.2.2
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 +2 -1
- package/package.json +1 -1
- package/src/mcp/s3querier-mcp.js +4 -5
- package/src/s3/s3.js +14 -2
package/README.md
CHANGED
|
@@ -161,10 +161,11 @@ const results = await s3Querier({
|
|
|
161
161
|
|
|
162
162
|
## MCP Server
|
|
163
163
|
|
|
164
|
-
s3-querier ships a [Model Context Protocol](https://modelcontextprotocol.io/) server that exposes
|
|
164
|
+
s3-querier ships a [Model Context Protocol](https://modelcontextprotocol.io/) server that exposes three tools to any MCP-compatible client (Claude Desktop, Claude Code, IBM Bob etc.):
|
|
165
165
|
|
|
166
166
|
- **`query`** — runs a DuckDB SQL query against your S3 data
|
|
167
167
|
- **`list_files`** — lists objects under a prefix so an LLM can discover available data
|
|
168
|
+
- **`get_current_time`** — returns the current UTC time. Call this before constructing time-partitioned queries
|
|
168
169
|
|
|
169
170
|
### Environment variables
|
|
170
171
|
|
package/package.json
CHANGED
package/src/mcp/s3querier-mcp.js
CHANGED
|
@@ -33,11 +33,10 @@ export class S3QuerierMCP {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
async start() {
|
|
36
|
-
const server = new McpServer(
|
|
37
|
-
name: 's3-querier',
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
36
|
+
const server = new McpServer(
|
|
37
|
+
{ name: 's3-querier', version: pkg.version },
|
|
38
|
+
{ instructions: buildInstructions(this.config) },
|
|
39
|
+
);
|
|
41
40
|
const transport = new StdioServerTransport();
|
|
42
41
|
|
|
43
42
|
this.resourceClasses.forEach((ResourceClass) => {
|
package/src/s3/s3.js
CHANGED
|
@@ -103,8 +103,7 @@ export default class S3 {
|
|
|
103
103
|
|
|
104
104
|
return Promise.allSettled(listPromises).then((results) => {
|
|
105
105
|
const regex = regexFromPattern(file);
|
|
106
|
-
|
|
107
|
-
this.listingCache.delete(`${this.bucket}/${todayPrefix}`);
|
|
106
|
+
this.evictTodayFromListingCache(file);
|
|
108
107
|
|
|
109
108
|
return results
|
|
110
109
|
.filter((result) => result.status === 'fulfilled')
|
|
@@ -225,6 +224,19 @@ export default class S3 {
|
|
|
225
224
|
return buildPath(`${trimmed}{dd}`, new Date());
|
|
226
225
|
}
|
|
227
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Removes all listing cache entries whose key falls under today's day prefix.
|
|
229
|
+
* Covers day-level, hour-level, and minute-level cache keys in one pass.
|
|
230
|
+
*
|
|
231
|
+
* @param {string} filePattern File pattern
|
|
232
|
+
*/
|
|
233
|
+
evictTodayFromListingCache(filePattern) {
|
|
234
|
+
const todayPrefix = `${this.bucket}/${this.getTodayPrefix(filePattern)}`;
|
|
235
|
+
[...this.listingCache.keys()]
|
|
236
|
+
.filter((key) => key.startsWith(todayPrefix))
|
|
237
|
+
.forEach((key) => this.listingCache.delete(key));
|
|
238
|
+
}
|
|
239
|
+
|
|
228
240
|
/**
|
|
229
241
|
* Returns a list of files from S3 under the given prefix
|
|
230
242
|
*
|