@meterbox/mcp 0.1.22 → 0.1.24

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
@@ -35,7 +35,6 @@ claude mcp add --transport http meterbox-sandbox https://meterbox.ai/mcp/sandbox
35
35
  "command": "npx",
36
36
  "args": ["-y", "@meterbox/mcp"],
37
37
  "env": {
38
- "METERBOX_BASE_URL": "https://meterbox.ai",
39
38
  "METERBOX_AGENT_KEY": "${METERBOX_AGENT_KEY}"
40
39
  }
41
40
  }
@@ -45,8 +44,9 @@ claude mcp add --transport http meterbox-sandbox https://meterbox.ai/mcp/sandbox
45
44
 
46
45
  The key's prefix picks the environment. Add `"--toolsets", "catalog,customers"`
47
46
  to `args` to expose only some toolsets; this can narrow what the key allows but
48
- never widen it. On a self-hosted deployment, use your own host instead of
49
- `https://meterbox.ai`.
47
+ never widen it. The bridge connects to `https://meterbox.ai`; on a self-hosted
48
+ deployment, add `"METERBOX_BASE_URL": "https://your-host"` to `env`, and use your
49
+ own host instead of `https://meterbox.ai` in the commands above.
50
50
 
51
51
  Requires Node.js 20 or later.
52
52
 
@@ -3,23 +3,24 @@
3
3
  // stdio bridge to a Meterbox deployment's hosted MCP endpoint. Every check
4
4
  // runs on the server; this process only relays messages and adds the key.
5
5
  //
6
- // METERBOX_BASE_URL your Meterbox host, e.g. https://meterbox.ai
7
6
  // METERBOX_AGENT_KEY agent key (mb_agent_sandbox_... / mb_agent_production_...)
7
+ // METERBOX_BASE_URL optional: a self-hosted Meterbox host (default https://meterbox.ai)
8
8
  // --toolsets a,b optional: narrow the key's toolsets
9
9
  const { runBridge } = require("../lib/bridge");
10
10
 
11
11
  const HELP = `meterbox-mcp: connect a stdio MCP client to Meterbox.
12
12
 
13
13
  Environment:
14
- METERBOX_BASE_URL your Meterbox host, e.g. https://meterbox.ai
15
14
  METERBOX_AGENT_KEY agent key from Settings > API keys (its prefix picks sandbox or production)
15
+ METERBOX_BASE_URL optional: your Meterbox host, for a self-hosted Meterbox
16
+ (default https://meterbox.ai)
16
17
 
17
18
  Options:
18
19
  --toolsets a,b only expose these toolsets (narrows what the key allows)
19
20
  --help show this help
20
21
 
21
- Clients that support remote servers can connect to <METERBOX_BASE_URL>/mcp/<sandbox|production>
22
- directly instead.`;
22
+ Clients that support remote servers can connect to https://meterbox.ai/mcp/<sandbox|production>
23
+ (or your own host's) directly instead.`;
23
24
 
24
25
  function parseArgs(argv) {
25
26
  const out = {};
@@ -46,10 +47,11 @@ if (args.error) {
46
47
  process.exit(2);
47
48
  }
48
49
 
50
+ // Unset, the bridge connects to https://meterbox.ai.
49
51
  const baseUrl = process.env.METERBOX_BASE_URL;
50
52
  const apiKey = process.env.METERBOX_AGENT_KEY;
51
- if (!baseUrl || !apiKey) {
52
- console.error(`meterbox-mcp: set METERBOX_BASE_URL and METERBOX_AGENT_KEY.\n\n${HELP}`);
53
+ if (!apiKey) {
54
+ console.error(`meterbox-mcp: set METERBOX_AGENT_KEY.\n\n${HELP}`);
53
55
  process.exit(2);
54
56
  }
55
57
 
package/lib/bridge.js CHANGED
@@ -14,6 +14,8 @@ const { StreamableHTTPClientTransport } = require("@modelcontextprotocol/client"
14
14
 
15
15
  const AGENT_KEY_RE = /^mb_agent_(sandbox|production)_/;
16
16
  const ENVIRONMENTS = ["sandbox", "production"];
17
+ // Where the bridge connects when not given a (self-hosted) host.
18
+ const DEFAULT_BASE_URL = "https://meterbox.ai";
17
19
 
18
20
  function environmentFromKey(key) {
19
21
  const m = AGENT_KEY_RE.exec(key || "");
@@ -21,7 +23,7 @@ function environmentFromKey(key) {
21
23
  }
22
24
 
23
25
  function mcpUrl(baseUrl, environment) {
24
- return new URL(`${String(baseUrl).replace(/\/+$/, "")}/mcp/${environment}`);
26
+ return new URL(`${String(baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, "")}/mcp/${environment}`);
25
27
  }
26
28
 
27
29
  function resolveEnvironment(apiKey, environment) {
@@ -39,7 +41,7 @@ function resolveEnvironment(apiKey, environment) {
39
41
 
40
42
  /**
41
43
  * @param {object} opts
42
- * @param {string} opts.baseUrl e.g. "https://meterbox.ai"
44
+ * @param {string} [opts.baseUrl] a self-hosted host (default https://meterbox.ai)
43
45
  * @param {string} opts.apiKey agent key; its prefix picks the environment
44
46
  * @param {string} [opts.environment] "sandbox" | "production" (must match the key)
45
47
  * @param {string[]} [opts.toolsets] narrow the key's toolsets (never widens)
@@ -58,7 +60,6 @@ async function runBridge({
58
60
  fetch,
59
61
  onError,
60
62
  }) {
61
- if (!baseUrl) throw new Error("baseUrl is required");
62
63
  if (!apiKey) throw new Error("apiKey is required");
63
64
  const env = resolveEnvironment(apiKey, environment);
64
65
  const report = onError || (() => {});
@@ -121,4 +122,4 @@ async function runBridge({
121
122
  };
122
123
  }
123
124
 
124
- module.exports = { runBridge, environmentFromKey, mcpUrl, resolveEnvironment };
125
+ module.exports = { runBridge, environmentFromKey, mcpUrl, resolveEnvironment, DEFAULT_BASE_URL };
package/lib/tiers.js CHANGED
@@ -146,6 +146,7 @@ const TIERS = {
146
146
  "POST /v1/anomalies/run": "update",
147
147
  "PUT /v1/anomalies/settings": "update",
148
148
  "PATCH /v1/contracts/{id}": "update",
149
+ "PATCH /v1/coupons/{code}/customers": "update",
149
150
  "PUT /v1/customers/{id}/value-report/{period}": "update",
150
151
  "DELETE /v1/customers/{id}/billing-profile": "update",
151
152
  "PATCH /v1/customers/{id}/billing-profile": "update",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meterbox/mcp",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "Meterbox MCP server: the hosted /mcp endpoint's tools and policy, plus a stdio bridge (npx @meterbox/mcp) for MCP clients that only speak stdio.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://meterbox.ai",
@@ -22,7 +22,7 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@meterbox/ops": "0.1.0",
25
+ "@meterbox/ops": "0.1.1",
26
26
  "@modelcontextprotocol/client": "2.2.0",
27
27
  "@modelcontextprotocol/node": "2.1.0",
28
28
  "@modelcontextprotocol/server": "2.2.0",