@ccusage/mcp 17.1.3 → 17.1.5
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/index.js +13 -25
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { Hono } from "hono/tiny";
|
|
|
18
18
|
import { z } from "zod";
|
|
19
19
|
import spawn, { SubprocessError } from "nano-spawn";
|
|
20
20
|
var name = "@ccusage/mcp";
|
|
21
|
-
var version = "17.1.
|
|
21
|
+
var version = "17.1.5";
|
|
22
22
|
var description = "MCP server implementation for ccusage data";
|
|
23
23
|
var d = Object.defineProperty;
|
|
24
24
|
var n = (s, t) => d(s, "name", {
|
|
@@ -205,8 +205,7 @@ const ccusageParametersSchema = z.object(ccusageParametersShape);
|
|
|
205
205
|
let cachedCcusageInvocation = null;
|
|
206
206
|
function getCcusageInvocation() {
|
|
207
207
|
if (cachedCcusageInvocation != null) return cachedCcusageInvocation;
|
|
208
|
-
|
|
209
|
-
cachedCcusageInvocation = createCliInvocation(entryPath);
|
|
208
|
+
cachedCcusageInvocation = createCliInvocation(resolveBinaryPath("ccusage", "ccusage"));
|
|
210
209
|
return cachedCcusageInvocation;
|
|
211
210
|
}
|
|
212
211
|
async function runCcusageCliJson(command, parameters, claudePath) {
|
|
@@ -341,8 +340,7 @@ const codexParametersSchema = z.object(codexParametersShape);
|
|
|
341
340
|
let cachedCodexInvocation = null;
|
|
342
341
|
function getCodexInvocation() {
|
|
343
342
|
if (cachedCodexInvocation != null) return cachedCodexInvocation;
|
|
344
|
-
|
|
345
|
-
cachedCodexInvocation = createCliInvocation(entryPath);
|
|
343
|
+
cachedCodexInvocation = createCliInvocation(resolveBinaryPath("@ccusage/codex", "ccusage-codex"));
|
|
346
344
|
return cachedCodexInvocation;
|
|
347
345
|
}
|
|
348
346
|
async function runCodexCliJson(command, parameters) {
|
|
@@ -388,8 +386,7 @@ function createMcpServer(options) {
|
|
|
388
386
|
description: "Show usage report grouped by date",
|
|
389
387
|
inputSchema: ccusageParametersShape
|
|
390
388
|
}, async (args) => {
|
|
391
|
-
const
|
|
392
|
-
const jsonOutput = await getCcusageDaily(parameters, claudePath);
|
|
389
|
+
const jsonOutput = await getCcusageDaily(ccusageParametersSchema.parse(args), claudePath);
|
|
393
390
|
return { content: [{
|
|
394
391
|
type: "text",
|
|
395
392
|
text: JSON.stringify(jsonOutput, null, 2)
|
|
@@ -399,8 +396,7 @@ function createMcpServer(options) {
|
|
|
399
396
|
description: "Show usage report grouped by conversation session",
|
|
400
397
|
inputSchema: ccusageParametersShape
|
|
401
398
|
}, async (args) => {
|
|
402
|
-
const
|
|
403
|
-
const jsonOutput = await getCcusageSession(parameters, claudePath);
|
|
399
|
+
const jsonOutput = await getCcusageSession(ccusageParametersSchema.parse(args), claudePath);
|
|
404
400
|
return { content: [{
|
|
405
401
|
type: "text",
|
|
406
402
|
text: JSON.stringify(jsonOutput, null, 2)
|
|
@@ -410,8 +406,7 @@ function createMcpServer(options) {
|
|
|
410
406
|
description: "Show usage report grouped by month",
|
|
411
407
|
inputSchema: ccusageParametersShape
|
|
412
408
|
}, async (args) => {
|
|
413
|
-
const
|
|
414
|
-
const jsonOutput = await getCcusageMonthly(parameters, claudePath);
|
|
409
|
+
const jsonOutput = await getCcusageMonthly(ccusageParametersSchema.parse(args), claudePath);
|
|
415
410
|
return { content: [{
|
|
416
411
|
type: "text",
|
|
417
412
|
text: JSON.stringify(jsonOutput, null, 2)
|
|
@@ -421,8 +416,7 @@ function createMcpServer(options) {
|
|
|
421
416
|
description: "Show usage report grouped by session billing blocks",
|
|
422
417
|
inputSchema: ccusageParametersShape
|
|
423
418
|
}, async (args) => {
|
|
424
|
-
const
|
|
425
|
-
const jsonOutput = await getCcusageBlocks(parameters, claudePath);
|
|
419
|
+
const jsonOutput = await getCcusageBlocks(ccusageParametersSchema.parse(args), claudePath);
|
|
426
420
|
return { content: [{
|
|
427
421
|
type: "text",
|
|
428
422
|
text: JSON.stringify(jsonOutput, null, 2)
|
|
@@ -432,8 +426,7 @@ function createMcpServer(options) {
|
|
|
432
426
|
description: "Show Codex usage grouped by day",
|
|
433
427
|
inputSchema: codexParametersShape
|
|
434
428
|
}, async (args) => {
|
|
435
|
-
const
|
|
436
|
-
const codexDaily = await getCodexDaily(parameters);
|
|
429
|
+
const codexDaily = await getCodexDaily(codexParametersSchema.parse(args));
|
|
437
430
|
return { content: [{
|
|
438
431
|
type: "text",
|
|
439
432
|
text: JSON.stringify(codexDaily, null, 2)
|
|
@@ -443,8 +436,7 @@ function createMcpServer(options) {
|
|
|
443
436
|
description: "Show Codex usage grouped by month",
|
|
444
437
|
inputSchema: codexParametersShape
|
|
445
438
|
}, async (args) => {
|
|
446
|
-
const
|
|
447
|
-
const codexMonthly = await getCodexMonthly(parameters);
|
|
439
|
+
const codexMonthly = await getCodexMonthly(codexParametersSchema.parse(args));
|
|
448
440
|
return { content: [{
|
|
449
441
|
type: "text",
|
|
450
442
|
text: JSON.stringify(codexMonthly, null, 2)
|
|
@@ -509,20 +501,16 @@ const mcpCommand = define({
|
|
|
509
501
|
mode
|
|
510
502
|
};
|
|
511
503
|
switch (mcpType) {
|
|
512
|
-
case "stdio":
|
|
513
|
-
|
|
514
|
-
await startMcpServerStdio(server);
|
|
504
|
+
case "stdio":
|
|
505
|
+
await startMcpServerStdio(createMcpServer(options));
|
|
515
506
|
return;
|
|
516
|
-
|
|
517
|
-
case "http": {
|
|
518
|
-
const app = createMcpHttpApp(options);
|
|
507
|
+
case "http":
|
|
519
508
|
serve({
|
|
520
|
-
fetch:
|
|
509
|
+
fetch: createMcpHttpApp(options).fetch,
|
|
521
510
|
port
|
|
522
511
|
});
|
|
523
512
|
logger.info(`MCP server is running on http://localhost:${port}`);
|
|
524
513
|
return;
|
|
525
|
-
}
|
|
526
514
|
default: throw new Error(`Unsupported MCP type: ${mcpType}`);
|
|
527
515
|
}
|
|
528
516
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ccusage/mcp",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.5",
|
|
4
4
|
"description": "MCP server implementation for ccusage data",
|
|
5
5
|
"homepage": "https://github.com/ryoppippi/ccusage#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@hono/mcp": "^0.1.
|
|
32
|
-
"@hono/node-server": "^1.19.
|
|
31
|
+
"@hono/mcp": "^0.1.5",
|
|
32
|
+
"@hono/node-server": "^1.19.6",
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.18.1",
|
|
34
34
|
"gunshi": "^0.26.3",
|
|
35
35
|
"hono": "^4.9.2",
|
|
36
36
|
"nano-spawn": "^1.0.2",
|
|
37
37
|
"zod": "^3.25.67",
|
|
38
|
-
"ccusage": "17.1.
|
|
39
|
-
"
|
|
38
|
+
"@ccusage/codex": "17.1.5",
|
|
39
|
+
"ccusage": "17.1.5"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=20.19.4"
|