@remembrance-ai/mcp-server 0.1.5 → 0.1.7

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.js CHANGED
@@ -6164,9 +6164,10 @@ function resolveApiKey() {
6164
6164
  return fromFile ? String(fromFile) : "";
6165
6165
  }
6166
6166
  var apiBase = (process.env.REMEMBRANCE_API_URL || readRemembranceConfig().apiUrl || "https://remembrance.dev").replace(/\/$/, "");
6167
- var SERVER_VERSION = true ? "0.1.5" : "0.0.0-dev";
6167
+ var SERVER_VERSION = true ? "0.1.7" : "0.0.0-dev";
6168
6168
  var tools = toolDefinitions;
6169
6169
  var inputBuffer = Buffer.alloc(0);
6170
+ var clientFraming = "ndjson";
6170
6171
  process.stdin.on("data", (chunk) => {
6171
6172
  inputBuffer = Buffer.concat([inputBuffer, chunk]);
6172
6173
  processMessages().catch((error) => {
@@ -6179,6 +6180,9 @@ process.stdin.on("data", (chunk) => {
6179
6180
  async function processMessages() {
6180
6181
  const parsed = readJsonRpcMessages(inputBuffer);
6181
6182
  inputBuffer = parsed.remaining;
6183
+ if (parsed.framing) {
6184
+ clientFraming = parsed.framing;
6185
+ }
6182
6186
  for (const error of parsed.errors) {
6183
6187
  writeResponse(null, null, error);
6184
6188
  }
@@ -6189,6 +6193,7 @@ async function processMessages() {
6189
6193
  function readJsonRpcMessages(buffer) {
6190
6194
  const messages = [];
6191
6195
  const errors = [];
6196
+ let framing;
6192
6197
  let remaining = buffer;
6193
6198
  while (true) {
6194
6199
  const legacyHeader = /^content-length:/i.test(
@@ -6198,7 +6203,7 @@ function readJsonRpcMessages(buffer) {
6198
6203
  if (legacyHeader) {
6199
6204
  const headerEnd = remaining.indexOf("\r\n\r\n");
6200
6205
  if (headerEnd < 0) {
6201
- return { messages, remaining, errors };
6206
+ return { messages, remaining, errors, framing };
6202
6207
  }
6203
6208
  const header = remaining.slice(0, headerEnd).toString("utf8");
6204
6209
  const length = Number.parseInt(
@@ -6210,26 +6215,29 @@ function readJsonRpcMessages(buffer) {
6210
6215
  code: -32600,
6211
6216
  message: "Invalid Content-Length header."
6212
6217
  });
6218
+ framing = "content-length";
6213
6219
  remaining = remaining.slice(headerEnd + 4);
6214
6220
  continue;
6215
6221
  }
6216
6222
  const messageStart = headerEnd + 4;
6217
6223
  const messageEnd = messageStart + length;
6218
6224
  if (remaining.byteLength < messageEnd) {
6219
- return { messages, remaining, errors };
6225
+ return { messages, remaining, errors, framing };
6220
6226
  }
6221
6227
  body = remaining.slice(messageStart, messageEnd).toString("utf8");
6222
6228
  remaining = remaining.slice(messageEnd);
6229
+ framing = "content-length";
6223
6230
  } else {
6224
6231
  const newline = remaining.indexOf("\n");
6225
6232
  if (newline < 0) {
6226
- return { messages, remaining, errors };
6233
+ return { messages, remaining, errors, framing };
6227
6234
  }
6228
6235
  body = remaining.slice(0, newline).toString("utf8").trim();
6229
6236
  remaining = remaining.slice(newline + 1);
6230
6237
  if (!body) {
6231
6238
  continue;
6232
6239
  }
6240
+ framing = "ndjson";
6233
6241
  }
6234
6242
  try {
6235
6243
  messages.push(JSON.parse(body));
@@ -6633,16 +6641,25 @@ function agentProviderForIdentity(provider) {
6633
6641
  return "generic";
6634
6642
  }
6635
6643
  function writeResponse(id, result, error) {
6644
+ process.stdout.write(formatJsonRpcResponse(id, result, error));
6645
+ }
6646
+ function formatJsonRpcResponse(id, result, error, framing = clientFraming) {
6636
6647
  const body = JSON.stringify({
6637
6648
  jsonrpc: "2.0",
6638
6649
  id: id ?? null,
6639
6650
  ...error ? { error } : { result }
6640
6651
  });
6641
- process.stdout.write(`${body}
6642
- `);
6652
+ if (framing === "content-length") {
6653
+ return `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
6654
+ \r
6655
+ ${body}`;
6656
+ }
6657
+ return `${body}
6658
+ `;
6643
6659
  }
6644
6660
  export {
6645
6661
  callTool,
6646
6662
  dispatchJsonRpcRequest,
6663
+ formatJsonRpcResponse,
6647
6664
  readJsonRpcMessages
6648
6665
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remembrance-ai/mcp-server",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "mcpName": "io.github.dreamarkinc/remembrance",
5
5
  "description": "MCP server for discovering Remembrance skills/resources and submitting agent feedback with optional TOFU attestations.",
6
6
  "license": "Apache-2.0",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/dreamarkinc/remembrance-skills",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.1.5",
9
+ "version": "0.1.7",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@remembrance-ai/mcp-server",
14
- "version": "0.1.5",
14
+ "version": "0.1.7",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },