Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperpolymath/boj-server",
"version": "0.4.1",
"version": "0.4.2",
"description": "Bundle of Joy — cartridge-based MCP server with 100 domain cartridges, formally verified (Idris2) coord core",
"license": "MPL-2.0",
"exports": "./mcp-bridge/main.js",
Expand Down
19 changes: 17 additions & 2 deletions mcp-bridge/lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@
// MCP JSON-RPC messages). Log level controlled via BOJ_LOG_LEVEL env.

const LOG_LEVELS = { debug: 0, info: 1, warn: 2, error: 3, silent: 4 };
const currentLevel = LOG_LEVELS[process.env.BOJ_LOG_LEVEL || "info"] ?? LOG_LEVELS.info;
let currentLevel = LOG_LEVELS[process.env.BOJ_LOG_LEVEL || "info"] ?? LOG_LEVELS.info;

/**
* Update the minimum log level at runtime. Used by the MCP
* `logging/setLevel` handler to honour client-requested verbosity.
* Unknown levels are ignored (no-op).
* @param {"debug"|"info"|"warn"|"error"|"silent"} level
* @returns {boolean} true if the level was recognised and applied
*/
function setLevel(level) {
if (level in LOG_LEVELS) {
currentLevel = LOG_LEVELS[level];
return true;
}
return false;
}

/**
* Emit a structured log entry to stderr.
Expand Down Expand Up @@ -38,4 +53,4 @@ function warn(msg, fields) { log("warn", msg, fields); }
/** @param {string} msg @param {Record<string, unknown>} [fields] */
function error(msg, fields) { log("error", msg, fields); }

export { debug, error, info, log, warn };
export { debug, error, info, log, setLevel, warn };
2 changes: 1 addition & 1 deletion mcp-bridge/lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
// Single source of truth for server version and name.

export const SERVER_NAME = "boj-server";
export const SERVER_VERSION = "0.4.0";
export const SERVER_VERSION = "0.4.2";
19 changes: 17 additions & 2 deletions mcp-bridge/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
tryParseEnvelope,
validateEnvelope,
} from "./lib/nickel-validator.js";
import { info, warn, error as logError } from "./lib/logger.js";
import { info, warn, error as logError, setLevel as setLogLevel } from "./lib/logger.js";

const BOJ_BASE = process.env.BOJ_URL || "http://localhost:7700";
const SERVER_NAME = "boj-server";
Expand Down Expand Up @@ -338,7 +338,10 @@ async function handleMessage(line) {
info("MCP initialize", { client: params?.clientInfo?.name });
sendResult(id, {
protocolVersion: "2024-11-05",
capabilities: { tools: { listChanged: false } },
capabilities: {
tools: { listChanged: false },
logging: {},
},
serverInfo: { name: SERVER_NAME, version: SERVER_VERSION },
});
break;
Expand All @@ -347,6 +350,18 @@ async function handleMessage(line) {
case "notifications/initialized":
break;

case "logging/setLevel": {
const level = params?.level;
const applied = setLogLevel(level);
if (!applied) {
sendError(id, -32602, `Unknown log level: ${level}. Expected debug|info|warn|error|silent.`);
} else {
info("MCP logging/setLevel", { level });
sendResult(id, {});
}
break;
}

case "tools/list": {
const tools = buildToolList();
sendResult(id, { tools });
Expand Down
2 changes: 1 addition & 1 deletion mcp-bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperpolymath/boj-server",
"version": "0.4.1",
"version": "0.4.2",
"description": "Bundle of Joy (BoJ) MCP Server — cartridge-based DevOps + multi-agent coordination toolkit with 100 domain cartridges (database, container, git, k8s, observability, secrets, IaC, multi-instance AI coord, and more). Formally verified (Idris2) core; MPL-2.0.",
"license": "MPL-2.0",
"author": "Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperpolymath/boj-server",
"version": "0.4.1",
"version": "0.4.2",
"description": "Bundle of Joy (BoJ) MCP Server — cartridge-based DevOps + multi-agent coordination toolkit with 100 domain cartridges (database, container, git, k8s, observability, secrets, IaC, multi-instance AI coord, and more). Formally verified (Idris2) core; MPL-2.0.",
"license": "MPL-2.0",
"author": "Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>",
Expand Down
Loading