tako-mcp 0.1.0 → 0.2.0
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 +30 -5
- package/dist/index.js +19 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,11 +39,21 @@ npx tako-mcp-get-credentials > .env
|
|
|
39
39
|
|
|
40
40
|
## 使い方
|
|
41
41
|
|
|
42
|
+
デフォルトは stdio トランスポートで動作します。
|
|
43
|
+
|
|
42
44
|
```bash
|
|
43
45
|
OCTOPUS_API_KEY=<token> OCTOPUS_ACCOUNT_NUMBER=A-AAAA1111 npx tako-mcp
|
|
44
46
|
```
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
### HTTP モード
|
|
49
|
+
|
|
50
|
+
`--http` フラグで Streamable HTTP トランスポートに切り替えられます。
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
OCTOPUS_API_KEY=<token> OCTOPUS_ACCOUNT_NUMBER=A-AAAA1111 npx tako-mcp --http
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`PORT` 未指定時は空きポートが自動選択されます。
|
|
47
57
|
|
|
48
58
|
### 環境変数
|
|
49
59
|
|
|
@@ -51,7 +61,7 @@ OCTOPUS_API_KEY=<token> OCTOPUS_ACCOUNT_NUMBER=A-AAAA1111 npx tako-mcp
|
|
|
51
61
|
|---|---|---|
|
|
52
62
|
| `OCTOPUS_API_KEY` | Yes | Octopus Energy API キー(Basic Auth のユーザー名として使用) |
|
|
53
63
|
| `OCTOPUS_ACCOUNT_NUMBER` | Yes | アカウント番号(例: `A-AAAA1111`) |
|
|
54
|
-
| `PORT` | No | HTTP
|
|
64
|
+
| `PORT` | No | HTTP モード時のポート番号(デフォルト: 自動選択) |
|
|
55
65
|
|
|
56
66
|
## MCP ツール一覧
|
|
57
67
|
|
|
@@ -69,16 +79,31 @@ OCTOPUS_API_KEY=<token> OCTOPUS_ACCOUNT_NUMBER=A-AAAA1111 npx tako-mcp
|
|
|
69
79
|
|
|
70
80
|
## クライアント設定
|
|
71
81
|
|
|
72
|
-
### Claude Code
|
|
82
|
+
### Claude Desktop / Claude Code
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"tako-mcp": {
|
|
88
|
+
"command": "npx",
|
|
89
|
+
"args": ["-y", "tako-mcp"],
|
|
90
|
+
"env": {
|
|
91
|
+
"OCTOPUS_API_KEY": "<your-api-key>",
|
|
92
|
+
"OCTOPUS_ACCOUNT_NUMBER": "A-AAAA1111"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
73
98
|
|
|
74
|
-
|
|
99
|
+
### HTTP モード
|
|
75
100
|
|
|
76
101
|
```json
|
|
77
102
|
{
|
|
78
103
|
"mcpServers": {
|
|
79
104
|
"tako-mcp": {
|
|
80
105
|
"type": "http",
|
|
81
|
-
"url": "http://localhost
|
|
106
|
+
"url": "http://localhost:<port>/mcp"
|
|
82
107
|
}
|
|
83
108
|
}
|
|
84
109
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import {
|
|
5
|
-
import { serve } from "@hono/node-server";
|
|
6
|
-
import { Hono } from "hono";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
5
|
|
|
8
6
|
// src/client.ts
|
|
9
7
|
var BASE_URL = "https://api.octopus.energy/v1";
|
|
@@ -486,15 +484,23 @@ if (!apiKey || !accountNumber) {
|
|
|
486
484
|
);
|
|
487
485
|
process.exit(1);
|
|
488
486
|
}
|
|
489
|
-
var port = Number(process.env.PORT) || 3e3;
|
|
490
487
|
var client = new OctopusClient(apiKey, accountNumber);
|
|
491
488
|
var mcpServer = createMcpServer(client);
|
|
492
|
-
|
|
493
|
-
await
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
489
|
+
if (process.argv.includes("--http")) {
|
|
490
|
+
const { StreamableHTTPTransport } = await import("@hono/mcp");
|
|
491
|
+
const { serve } = await import("@hono/node-server");
|
|
492
|
+
const { Hono } = await import("hono");
|
|
493
|
+
const port = process.env.PORT ? Number(process.env.PORT) : 0;
|
|
494
|
+
const transport = new StreamableHTTPTransport();
|
|
495
|
+
await mcpServer.connect(transport);
|
|
496
|
+
const app = new Hono();
|
|
497
|
+
app.all("/mcp", (c) => transport.handleRequest(c));
|
|
498
|
+
app.get("/health", (c) => c.json({ status: "ok" }));
|
|
499
|
+
serve({ fetch: app.fetch, port }, (info) => {
|
|
500
|
+
console.error(`tako-mcp server running on http://localhost:${info.port}`);
|
|
501
|
+
console.error(`MCP endpoint: http://localhost:${info.port}/mcp`);
|
|
502
|
+
});
|
|
503
|
+
} else {
|
|
504
|
+
const transport = new StdioServerTransport();
|
|
505
|
+
await mcpServer.connect(transport);
|
|
506
|
+
}
|