@davidjinguoxu/agentcore 0.4.3 → 0.4.4
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/dist/server/server.js
CHANGED
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// server.ts —
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// server.ts — MCP server entry point.
|
|
3
|
+
// Default: stdio transport only (no HTTP port).
|
|
4
|
+
// Opt-in HTTP: set AGENTCORE_HTTP=1 for REST API + virtual office endpoints.
|
|
5
|
+
//
|
|
6
|
+
// This matches the standard MCP server pattern:
|
|
7
|
+
// other MCP servers (filesystem, memory, github) → stdio only, no port
|
|
8
|
+
// agentcore default → stdio only, no port, no auth key required
|
|
9
|
+
// agentcore HTTP mode → AGENTCORE_HTTP=1, uses MCP_API_KEY if set
|
|
6
10
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
11
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
8
12
|
import { registerTools } from "../tools/index.js";
|
|
9
|
-
import { startHttpServer } from "../transport/http-server.js";
|
|
10
13
|
import { getMcpServerPackageVersion } from "../config/agentcore-constants.js";
|
|
11
14
|
import { initSchema } from "../storage/schema-init.js";
|
|
12
15
|
const server = new McpServer({
|
|
13
|
-
name: "
|
|
16
|
+
name: "agentcore",
|
|
14
17
|
version: getMcpServerPackageVersion(),
|
|
15
18
|
});
|
|
16
19
|
registerTools(server);
|
|
17
|
-
// Ensure all 7 tables exist before
|
|
20
|
+
// Ensure all 7 tables exist before serving any requests
|
|
18
21
|
await initSchema();
|
|
19
|
-
|
|
20
|
-
const httpServer = await startHttpServer();
|
|
21
|
-
const httpOnly = process.env["DATACORE_STDIO"] === "0" ||
|
|
22
|
+
const httpEnabled = process.env["AGENTCORE_HTTP"] === "1" ||
|
|
22
23
|
process.env["DATACORE_HTTP_ONLY"] === "1";
|
|
23
|
-
if (
|
|
24
|
-
//
|
|
25
|
-
|
|
24
|
+
if (httpEnabled) {
|
|
25
|
+
// Optional HTTP mode — starts REST API on AGENTCORE_PORT (default 3001)
|
|
26
|
+
const { startHttpServer } = await import("../transport/http-server.js");
|
|
27
|
+
const httpServer = await startHttpServer();
|
|
28
|
+
process.stderr.write(`[agentcore] HTTP API enabled on port ${process.env["AGENTCORE_PORT"] ?? "3001"}\n`);
|
|
29
|
+
await server.connect(new StdioServerTransport());
|
|
30
|
+
async function shutdown() {
|
|
26
31
|
httpServer.close();
|
|
32
|
+
await server.close();
|
|
27
33
|
process.exit(0);
|
|
28
34
|
}
|
|
29
|
-
process.on("SIGINT",
|
|
30
|
-
process.on("SIGTERM",
|
|
35
|
+
process.on("SIGINT", shutdown);
|
|
36
|
+
process.on("SIGTERM", shutdown);
|
|
31
37
|
}
|
|
32
38
|
else {
|
|
39
|
+
// Default: stdio only — no port, no auth, works like any other MCP server
|
|
33
40
|
await server.connect(new StdioServerTransport());
|
|
34
41
|
async function shutdown() {
|
|
35
|
-
httpServer.close();
|
|
36
42
|
await server.close();
|
|
37
43
|
process.exit(0);
|
|
38
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":";AAEA,sCAAsC;AACtC,gDAAgD;AAChD,6EAA6E;AAC7E,EAAE;AACF,gDAAgD;AAChD,yEAAyE;AACzE,kEAAkE;AAClE,oEAAoE;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC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CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@davidjinguoxu/agentcore",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Local-first AI memory engine for multi-agent workflows \u2014 17-tool MCP server. Zero config (LanceDB) or Azure (Cosmos + AI Search).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "David Xu",
|
package/scripts/stdio-only.mjs
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
7
|
-
import process from 'node:process';
|
|
8
|
-
import { registerTools } from '../dist/server/tools.js';
|
|
9
|
-
|
|
10
|
-
const pkgDir = dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const pkg = JSON.parse(readFileSync(join(pkgDir, '..', 'package.json'), 'utf8'));
|
|
12
|
-
const version = typeof pkg.version === 'string' ? pkg.version : '0.0.0';
|
|
13
|
-
|
|
14
|
-
const server = new McpServer({ name: 'datacore', version });
|
|
15
|
-
registerTools(server);
|
|
16
|
-
await server.connect(new StdioServerTransport());
|
|
17
|
-
|
|
18
|
-
async function shutdown() {
|
|
19
|
-
await server.close().catch(() => {});
|
|
20
|
-
process.exit(0);
|
|
21
|
-
}
|
|
22
|
-
process.on('SIGINT', shutdown);
|
|
23
|
-
process.on('SIGTERM', shutdown);
|
|
2
|
+
// stdio-only.mjs — Explicit stdio-only mode alias.
|
|
3
|
+
// This is now the same as the default (npx @davidjinguoxu/agentcore).
|
|
4
|
+
// Kept for clarity and backward compatibility.
|
|
5
|
+
import "../dist/server/server.js";
|