@ebb-ai/mcp 0.6.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/LICENSE +201 -0
- package/README.md +101 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +650 -0
- package/dist/server.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend, and
|
|
172
|
+
hold each Contributor harmless for any liability incurred by, or
|
|
173
|
+
claims asserted against, such Contributor by reason of your accepting
|
|
174
|
+
any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Vitalii Borovyk
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @ebb-ai/mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server for **ebb-ai** — exposes carbon-aware
|
|
4
|
+
task scheduling as MCP tools that any MCP-compatible agent can call.
|
|
5
|
+
|
|
6
|
+
## Install (development, monorepo)
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# from the repo root
|
|
10
|
+
pnpm install
|
|
11
|
+
pnpm --filter @ebb-ai/mcp build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Run
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
node packages/mcp-server/dist/server.js
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The server speaks MCP over stdio. To wire it into an agent client:
|
|
21
|
+
|
|
22
|
+
### Claude Desktop
|
|
23
|
+
|
|
24
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
25
|
+
on macOS (Linux/Windows have similar paths):
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"ebb-ai": {
|
|
31
|
+
"command": "node",
|
|
32
|
+
"args": [
|
|
33
|
+
"/ABSOLUTE/PATH/TO/ebb-ai/packages/mcp-server/dist/server.js"
|
|
34
|
+
],
|
|
35
|
+
"env": {
|
|
36
|
+
"EBB_ELECTRICITY_MAPS_API_KEY": "optional - mock data without it",
|
|
37
|
+
"EBB_DEFAULT_REGION": "US-CAL-CISO"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Restart Claude Desktop after editing.
|
|
45
|
+
|
|
46
|
+
### Claude Code
|
|
47
|
+
|
|
48
|
+
Add `ebb-ai` to your `~/.claude/mcp.json` (or workspace `.claude/mcp.json`):
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"ebb-ai": {
|
|
54
|
+
"command": "node",
|
|
55
|
+
"args": ["/ABSOLUTE/PATH/TO/ebb-ai/packages/mcp-server/dist/server.js"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### OpenClaw
|
|
62
|
+
|
|
63
|
+
Add to `~/.openclaw/mcp.json`:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"ebb-ai": {
|
|
69
|
+
"command": "node",
|
|
70
|
+
"args": ["/ABSOLUTE/PATH/TO/ebb-ai/packages/mcp-server/dist/server.js"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Tools exposed
|
|
77
|
+
|
|
78
|
+
| Tool | Purpose |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `get_grid_forecast(region, hours?)` | Hour-by-hour carbon intensity for a region; useful before deciding whether to defer. |
|
|
81
|
+
| `schedule_task(prompt, deadline, model?, region?, carbon_budget_g?)` | Queue a task to run in the cleanest window inside the deadline. Returns a task_id. |
|
|
82
|
+
| `check_queue_status(task_id?)` | Inspect the queue or one specific task; includes a carbon receipt once the task has completed. |
|
|
83
|
+
|
|
84
|
+
## Environment variables
|
|
85
|
+
|
|
86
|
+
| Var | Purpose |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `EBB_ELECTRICITY_MAPS_API_KEY` | API key from [electricitymaps.com](https://www.electricitymaps.com/free-tier-api). If unset, the server falls back to deterministic mock data so you can still run the whole stack locally. |
|
|
89
|
+
| `EBB_DEFAULT_REGION` | Electricity Maps zone code, default `US-CAL-CISO`. |
|
|
90
|
+
|
|
91
|
+
## v0.1 limitations
|
|
92
|
+
|
|
93
|
+
- The server schedules dispatch *time*, but does not yet call the
|
|
94
|
+
underlying LLM (the agent is expected to execute the prompt itself once
|
|
95
|
+
the window arrives). Provider adapters and Batch API integration land
|
|
96
|
+
in v0.2.
|
|
97
|
+
- Queue is in-memory; restarts lose state. SQLite persistence lands in
|
|
98
|
+
v0.2.
|
|
99
|
+
- Single-region grid feed. Multi-region routing lands in v0.3.
|
|
100
|
+
|
|
101
|
+
See `../../ROADMAP.md` for the full roadmap.
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ebb-mcp — Model Context Protocol server for carbon-aware AI task scheduling.
|
|
4
|
+
*
|
|
5
|
+
* Exposes four tools to any MCP-compatible agent (Claude Desktop,
|
|
6
|
+
* Claude Code, OpenClaw, Cursor, custom MCP clients):
|
|
7
|
+
*
|
|
8
|
+
* - get_grid_forecast(region, hours?) → forecasted carbon intensity
|
|
9
|
+
* - recommend_window(deadline, region, ...) → planning-only window pick
|
|
10
|
+
* - schedule_task(prompt, deadline, model?, carbon_budget_g?) → enqueue
|
|
11
|
+
* - check_queue_status(task_id?) → status / receipts
|
|
12
|
+
*
|
|
13
|
+
* The server reads `EBB_ELECTRICITY_MAPS_API_KEY` from the environment; if
|
|
14
|
+
* absent, it transparently falls back to a deterministic mock grid feed so
|
|
15
|
+
* the whole stack still runs end-to-end.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ebb-mcp — Model Context Protocol server for carbon-aware AI task scheduling.
|
|
4
|
+
*
|
|
5
|
+
* Exposes four tools to any MCP-compatible agent (Claude Desktop,
|
|
6
|
+
* Claude Code, OpenClaw, Cursor, custom MCP clients):
|
|
7
|
+
*
|
|
8
|
+
* - get_grid_forecast(region, hours?) → forecasted carbon intensity
|
|
9
|
+
* - recommend_window(deadline, region, ...) → planning-only window pick
|
|
10
|
+
* - schedule_task(prompt, deadline, model?, carbon_budget_g?) → enqueue
|
|
11
|
+
* - check_queue_status(task_id?) → status / receipts
|
|
12
|
+
*
|
|
13
|
+
* The server reads `EBB_ELECTRICITY_MAPS_API_KEY` from the environment; if
|
|
14
|
+
* absent, it transparently falls back to a deterministic mock grid feed so
|
|
15
|
+
* the whole stack still runs end-to-end.
|
|
16
|
+
*/
|
|
17
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
18
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
19
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
20
|
+
import { AnthropicAdapter, electricityMapsFeed, OpenAIAdapter, recommendWindow, Scheduler, } from "@ebb-ai/core";
|
|
21
|
+
import { z } from "zod";
|
|
22
|
+
const DEFAULT_REGION = process.env.EBB_DEFAULT_REGION ?? "US-CAL-CISO";
|
|
23
|
+
const feed = electricityMapsFeed();
|
|
24
|
+
const scheduler = new Scheduler({ feed, defaultRegion: DEFAULT_REGION });
|
|
25
|
+
function buildAdapters() {
|
|
26
|
+
const out = {};
|
|
27
|
+
if (process.env.ANTHROPIC_API_KEY)
|
|
28
|
+
out.anthropic = new AnthropicAdapter();
|
|
29
|
+
if (process.env.OPENAI_API_KEY)
|
|
30
|
+
out.openai = new OpenAIAdapter();
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
const getGridForecastInput = z.object({
|
|
34
|
+
region: z
|
|
35
|
+
.string()
|
|
36
|
+
.describe("Electricity Maps zone code, e.g. 'US-CAL-CISO', 'US-TEX-ERCO', 'FR', 'DE'."),
|
|
37
|
+
hours: z
|
|
38
|
+
.number()
|
|
39
|
+
.int()
|
|
40
|
+
.min(1)
|
|
41
|
+
.max(72)
|
|
42
|
+
.optional()
|
|
43
|
+
.describe("Forecast horizon in hours (1-72). Defaults to 24."),
|
|
44
|
+
});
|
|
45
|
+
const scheduleTaskInput = z.object({
|
|
46
|
+
prompt: z
|
|
47
|
+
.string()
|
|
48
|
+
.min(1)
|
|
49
|
+
.describe("The prompt or instruction to dispatch when the window arrives."),
|
|
50
|
+
deadline: z
|
|
51
|
+
.string()
|
|
52
|
+
.datetime({ offset: true })
|
|
53
|
+
.describe("ISO-8601 timestamp (e.g. '2026-05-13T08:00:00-04:00') by which the task must have completed. Must be in the future. Required."),
|
|
54
|
+
model: z
|
|
55
|
+
.string()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("Model name to dispatch with (e.g. 'claude-sonnet-4-6'). Required when dispatch=true."),
|
|
58
|
+
region: z
|
|
59
|
+
.string()
|
|
60
|
+
.optional()
|
|
61
|
+
.describe("Grid region override (Electricity Maps zone code such as 'US-CAL-CISO'). Defaults to the server's default region."),
|
|
62
|
+
carbon_budget_g: z
|
|
63
|
+
.number()
|
|
64
|
+
.positive()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("Hard cap on estimated grams CO2-equivalent for this task. If set and no window inside the deadline meets the cap, the task fails rather than dispatching to a dirty window."),
|
|
67
|
+
dry_run: z
|
|
68
|
+
.boolean()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("If true, return the planned dispatch (recommended window + carbon estimate) WITHOUT persisting anything. Useful for confirmation flows."),
|
|
71
|
+
dispatch: z
|
|
72
|
+
.boolean()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("If true, persist a provider_call task body that `ebb tick` (CLI) or scheduler.tick (library) can dispatch via the configured provider. Default false — task stores the prompt only."),
|
|
75
|
+
provider: z
|
|
76
|
+
.enum(["anthropic", "openai"])
|
|
77
|
+
.optional()
|
|
78
|
+
.describe("Provider to dispatch through when dispatch=true. Defaults to 'anthropic'."),
|
|
79
|
+
output_path: z
|
|
80
|
+
.string()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe("Optional absolute file path. When the task completes, ebb-ai writes { taskId, result, receipt } as JSON to this path."),
|
|
83
|
+
redact_in_receipt: z
|
|
84
|
+
.array(z.string())
|
|
85
|
+
.optional()
|
|
86
|
+
.describe("Optional regex patterns to strip from the prompt before storing on the receipt. Default behavior (omit field) redacts API-key-looking strings."),
|
|
87
|
+
});
|
|
88
|
+
const taskIdOnlyInput = z.object({
|
|
89
|
+
task_id: z.string().min(1).describe("Task identifier returned by schedule_task."),
|
|
90
|
+
});
|
|
91
|
+
const updateDeadlineInput = z.object({
|
|
92
|
+
task_id: z.string().min(1).describe("Task identifier returned by schedule_task."),
|
|
93
|
+
deadline: z
|
|
94
|
+
.string()
|
|
95
|
+
.datetime({ offset: true })
|
|
96
|
+
.describe("New ISO-8601 deadline. Must be in the future."),
|
|
97
|
+
});
|
|
98
|
+
const checkQueueStatusInput = z.object({
|
|
99
|
+
task_id: z
|
|
100
|
+
.string()
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("If present, return only this task. If omitted, return a queue summary."),
|
|
103
|
+
});
|
|
104
|
+
const recommendWindowInput = z.object({
|
|
105
|
+
deadline: z
|
|
106
|
+
.string()
|
|
107
|
+
.datetime({ offset: true })
|
|
108
|
+
.describe("ISO-8601 timestamp (e.g. '2026-05-13T08:00:00-04:00') by which the task must have completed. Must be in the future. Required."),
|
|
109
|
+
region: z
|
|
110
|
+
.string()
|
|
111
|
+
.min(1)
|
|
112
|
+
.describe("Electricity Maps zone code (e.g. 'US-CAL-CISO', 'FR'). Required — recommend_window is intentionally explicit about which grid it reasons over."),
|
|
113
|
+
carbon_budget_g: z
|
|
114
|
+
.number()
|
|
115
|
+
.positive()
|
|
116
|
+
.optional()
|
|
117
|
+
.describe("Optional grams CO2-equivalent cap. Windows above the budget are dropped before the cheapest is chosen."),
|
|
118
|
+
model: z
|
|
119
|
+
.string()
|
|
120
|
+
.optional()
|
|
121
|
+
.describe("Optional vendor model name (e.g. 'claude-sonnet-4-5'). Affects the reasoning string only."),
|
|
122
|
+
});
|
|
123
|
+
const server = new Server({ name: "ebb-mcp", version: "0.5.0" }, { capabilities: { tools: {} } });
|
|
124
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
125
|
+
tools: [
|
|
126
|
+
{
|
|
127
|
+
name: "get_grid_forecast",
|
|
128
|
+
description: "Return the projected electricity-grid carbon intensity for a region, hour by hour. Use this when deciding whether to run an expensive AI task now or defer it. Carbon intensity is reported in grams CO2-equivalent per kWh, with a categorical band (very_clean / clean / average / dirty / very_dirty).",
|
|
129
|
+
inputSchema: {
|
|
130
|
+
type: "object",
|
|
131
|
+
properties: {
|
|
132
|
+
region: {
|
|
133
|
+
type: "string",
|
|
134
|
+
description: "Electricity Maps zone code, e.g. 'US-CAL-CISO', 'US-TEX-ERCO', 'FR', 'DE'.",
|
|
135
|
+
},
|
|
136
|
+
hours: {
|
|
137
|
+
type: "number",
|
|
138
|
+
description: "Forecast horizon in hours (1-72). Defaults to 24.",
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: ["region"],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "recommend_window",
|
|
146
|
+
description: "Return the optimal carbon-aware execution window for a task WITHOUT scheduling it. Use this for non-committal planning — when you want to see *when* the cleanest grid moment falls inside the deadline (and what the savings vs running now would be) before deciding whether to commit via schedule_task. Returns the chosen window, top 3 alternatives, batch_eligible flag, and a one-line reasoning string.",
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
deadline: {
|
|
151
|
+
type: "string",
|
|
152
|
+
description: "ISO-8601 timestamp by which the task must complete. Required.",
|
|
153
|
+
},
|
|
154
|
+
region: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "Electricity Maps zone code, e.g. 'US-CAL-CISO'. Required.",
|
|
157
|
+
},
|
|
158
|
+
carbon_budget_g: {
|
|
159
|
+
type: "number",
|
|
160
|
+
description: "Optional grams CO2-equivalent cap; entries above the budget are dropped before selection.",
|
|
161
|
+
},
|
|
162
|
+
model: {
|
|
163
|
+
type: "string",
|
|
164
|
+
description: "Optional vendor model name (e.g. 'claude-sonnet-4-5').",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
required: ["deadline", "region"],
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "schedule_task",
|
|
172
|
+
description: "Queue an AI task to run during the cleanest grid window inside the given deadline. Returns a task_id that can later be checked with check_queue_status. Use this for work that does NOT need to complete instantly — research sweeps, batch summaries, overnight digests, anything where the user is fine waiting until a specified deadline.",
|
|
173
|
+
inputSchema: {
|
|
174
|
+
type: "object",
|
|
175
|
+
properties: {
|
|
176
|
+
prompt: {
|
|
177
|
+
type: "string",
|
|
178
|
+
description: "Prompt or instruction to dispatch at the chosen time.",
|
|
179
|
+
},
|
|
180
|
+
deadline: {
|
|
181
|
+
type: "string",
|
|
182
|
+
description: "ISO-8601 timestamp by which the task must complete. Required.",
|
|
183
|
+
},
|
|
184
|
+
model: {
|
|
185
|
+
type: "string",
|
|
186
|
+
description: "Optional model identifier (e.g. 'claude-sonnet-4-6').",
|
|
187
|
+
},
|
|
188
|
+
region: {
|
|
189
|
+
type: "string",
|
|
190
|
+
description: "Optional grid region override.",
|
|
191
|
+
},
|
|
192
|
+
carbon_budget_g: {
|
|
193
|
+
type: "number",
|
|
194
|
+
description: "Optional hard cap on estimated grams CO2-equivalent for this task.",
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
required: ["prompt", "deadline"],
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "check_queue_status",
|
|
202
|
+
description: "Report on the ebb-ai task queue. With no arguments, returns a compact summary of all known tasks. With task_id, returns full detail for one task including any carbon receipt.",
|
|
203
|
+
inputSchema: {
|
|
204
|
+
type: "object",
|
|
205
|
+
properties: {
|
|
206
|
+
task_id: {
|
|
207
|
+
type: "string",
|
|
208
|
+
description: "Optional task identifier returned by schedule_task.",
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "cancel_task",
|
|
215
|
+
description: "Cancel a queued/scheduled task. Idempotent — if the task is already completed/failed/cancelled this returns the existing status without error. Throws only if task_id is unknown.",
|
|
216
|
+
inputSchema: {
|
|
217
|
+
type: "object",
|
|
218
|
+
properties: {
|
|
219
|
+
task_id: { type: "string", description: "Task identifier returned by schedule_task." },
|
|
220
|
+
},
|
|
221
|
+
required: ["task_id"],
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "expedite_task",
|
|
226
|
+
description: "Dispatch a queued/scheduled provider-call task immediately, bypassing the scheduler's chosen carbon window. The resulting receipt records intensitySource='expedited'. Only valid for tasks that were created with dispatch=true.",
|
|
227
|
+
inputSchema: {
|
|
228
|
+
type: "object",
|
|
229
|
+
properties: {
|
|
230
|
+
task_id: { type: "string", description: "Task identifier returned by schedule_task." },
|
|
231
|
+
},
|
|
232
|
+
required: ["task_id"],
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "update_deadline",
|
|
237
|
+
description: "Re-score and reschedule a queued/scheduled task against a new deadline. Throws if the task is already running or terminal, or if the new deadline is invalid/in the past.",
|
|
238
|
+
inputSchema: {
|
|
239
|
+
type: "object",
|
|
240
|
+
properties: {
|
|
241
|
+
task_id: { type: "string", description: "Task identifier returned by schedule_task." },
|
|
242
|
+
deadline: { type: "string", description: "New ISO-8601 deadline. Must be in the future." },
|
|
243
|
+
},
|
|
244
|
+
required: ["task_id", "deadline"],
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "retry_task",
|
|
249
|
+
description: "Re-dispatch a failed provider-call task. Only valid when the task's current status is 'failed'. New receipt overwrites the old.",
|
|
250
|
+
inputSchema: {
|
|
251
|
+
type: "object",
|
|
252
|
+
properties: {
|
|
253
|
+
task_id: { type: "string", description: "Task identifier returned by schedule_task." },
|
|
254
|
+
},
|
|
255
|
+
required: ["task_id"],
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
}));
|
|
260
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
261
|
+
const name = req.params.name;
|
|
262
|
+
const args = req.params.arguments ?? {};
|
|
263
|
+
try {
|
|
264
|
+
if (name === "get_grid_forecast") {
|
|
265
|
+
const parsed = getGridForecastInput.parse(args);
|
|
266
|
+
const hours = parsed.hours ?? 24;
|
|
267
|
+
const forecast = await feed.fetchForecast(parsed.region, hours);
|
|
268
|
+
return {
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
type: "text",
|
|
272
|
+
text: formatForecast(forecast),
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
if (name === "recommend_window") {
|
|
278
|
+
const parsed = recommendWindowInput.parse(args);
|
|
279
|
+
try {
|
|
280
|
+
const result = await recommendWindow({
|
|
281
|
+
deadline: parsed.deadline,
|
|
282
|
+
region: parsed.region,
|
|
283
|
+
carbonBudgetG: parsed.carbon_budget_g,
|
|
284
|
+
model: parsed.model,
|
|
285
|
+
}, { feed });
|
|
286
|
+
return {
|
|
287
|
+
content: [
|
|
288
|
+
{ type: "text", text: formatRecommendation(result) },
|
|
289
|
+
],
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
catch (err) {
|
|
293
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
294
|
+
return {
|
|
295
|
+
content: [
|
|
296
|
+
{ type: "text", text: `recommend_window rejected: ${msg}` },
|
|
297
|
+
],
|
|
298
|
+
isError: true,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (name === "schedule_task") {
|
|
303
|
+
const parsed = scheduleTaskInput.parse(args);
|
|
304
|
+
try {
|
|
305
|
+
// dry_run: return the planned dispatch without persisting.
|
|
306
|
+
if (parsed.dry_run) {
|
|
307
|
+
const spec = {
|
|
308
|
+
type: "provider_call",
|
|
309
|
+
provider: parsed.provider ?? "anthropic",
|
|
310
|
+
model: parsed.model ?? "claude-sonnet-4-5",
|
|
311
|
+
prompt: parsed.prompt,
|
|
312
|
+
outputPath: parsed.output_path,
|
|
313
|
+
redactInReceipt: parsed.redact_in_receipt,
|
|
314
|
+
};
|
|
315
|
+
const plan = await scheduler.previewProviderCall(spec, {
|
|
316
|
+
deadline: parsed.deadline,
|
|
317
|
+
region: parsed.region,
|
|
318
|
+
carbonBudgetG: parsed.carbon_budget_g,
|
|
319
|
+
});
|
|
320
|
+
return {
|
|
321
|
+
content: [
|
|
322
|
+
{
|
|
323
|
+
type: "text",
|
|
324
|
+
text: `dry_run plan (nothing persisted):\n` +
|
|
325
|
+
`region: ${plan.region}\n` +
|
|
326
|
+
`scheduled_for: ${plan.scheduledFor}\n` +
|
|
327
|
+
`intensity_g_co2_per_kwh: ${plan.intensityGCo2PerKwh}\n` +
|
|
328
|
+
`band: ${plan.band}\n` +
|
|
329
|
+
`estimated_carbon_g_co2: ${plan.estimatedCarbonGCo2}\n` +
|
|
330
|
+
`batch_eligible: ${plan.batchEligible}`,
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
// Persistent provider_call (v0.4+) — dispatchable by `ebb tick`.
|
|
336
|
+
if (parsed.dispatch) {
|
|
337
|
+
const spec = {
|
|
338
|
+
type: "provider_call",
|
|
339
|
+
provider: parsed.provider ?? "anthropic",
|
|
340
|
+
model: parsed.model ?? "claude-sonnet-4-5",
|
|
341
|
+
prompt: parsed.prompt,
|
|
342
|
+
outputPath: parsed.output_path,
|
|
343
|
+
redactInReceipt: parsed.redact_in_receipt,
|
|
344
|
+
};
|
|
345
|
+
const record = await scheduler.enqueueProviderCall(spec, {
|
|
346
|
+
deadline: parsed.deadline,
|
|
347
|
+
region: parsed.region,
|
|
348
|
+
carbonBudgetG: parsed.carbon_budget_g,
|
|
349
|
+
});
|
|
350
|
+
return {
|
|
351
|
+
content: [
|
|
352
|
+
{
|
|
353
|
+
type: "text",
|
|
354
|
+
text: `Task queued (provider_call, dispatchable by \`ebb tick\`).\n` +
|
|
355
|
+
`task_id: ${record.taskId}\n` +
|
|
356
|
+
`provider: ${spec.provider}\n` +
|
|
357
|
+
`model: ${spec.model}\n` +
|
|
358
|
+
`region: ${record.region}\n` +
|
|
359
|
+
`status: ${record.status}\n` +
|
|
360
|
+
`scheduled_for: ${record.scheduledFor ?? "(immediate)"}\n` +
|
|
361
|
+
`deadline: ${parsed.deadline}`,
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
// Default v0.1 behavior: closure-based; agent dispatches LLM itself.
|
|
367
|
+
const record = scheduler.enqueue(async () => ({
|
|
368
|
+
prompt: parsed.prompt,
|
|
369
|
+
model: parsed.model ?? null,
|
|
370
|
+
dispatched: true,
|
|
371
|
+
}), {
|
|
372
|
+
deadline: parsed.deadline,
|
|
373
|
+
region: parsed.region,
|
|
374
|
+
carbonBudgetG: parsed.carbon_budget_g,
|
|
375
|
+
});
|
|
376
|
+
return {
|
|
377
|
+
content: [
|
|
378
|
+
{
|
|
379
|
+
type: "text",
|
|
380
|
+
text: `Task queued (closure-based, in-process only).\n` +
|
|
381
|
+
`task_id: ${record.taskId}\n` +
|
|
382
|
+
`region: ${record.region}\n` +
|
|
383
|
+
`status: ${record.status}\n` +
|
|
384
|
+
`deadline: ${parsed.deadline}\n` +
|
|
385
|
+
`Note: This task type does NOT survive process restart. ` +
|
|
386
|
+
`Pass dispatch=true to persist a provider_call body that survives via ebb tick.`,
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
catch (err) {
|
|
392
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
393
|
+
return {
|
|
394
|
+
content: [
|
|
395
|
+
{
|
|
396
|
+
type: "text",
|
|
397
|
+
text: `schedule_task rejected: ${msg}`,
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
isError: true,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (name === "check_queue_status") {
|
|
405
|
+
const parsed = checkQueueStatusInput.parse(args);
|
|
406
|
+
if (parsed.task_id) {
|
|
407
|
+
const task = scheduler.getTask(parsed.task_id);
|
|
408
|
+
if (!task) {
|
|
409
|
+
return {
|
|
410
|
+
content: [
|
|
411
|
+
{ type: "text", text: `Unknown task_id: ${parsed.task_id}` },
|
|
412
|
+
],
|
|
413
|
+
isError: true,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
content: [{ type: "text", text: formatTask(task) }],
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
const all = scheduler.listTasks();
|
|
421
|
+
return {
|
|
422
|
+
content: [
|
|
423
|
+
{ type: "text", text: formatQueueSummary(all) },
|
|
424
|
+
],
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
if (name === "cancel_task") {
|
|
428
|
+
const parsed = taskIdOnlyInput.parse(args);
|
|
429
|
+
try {
|
|
430
|
+
const rec = scheduler.cancelTask(parsed.task_id);
|
|
431
|
+
return {
|
|
432
|
+
content: [
|
|
433
|
+
{
|
|
434
|
+
type: "text",
|
|
435
|
+
text: `Task ${parsed.task_id} status: ${rec.status}\n` +
|
|
436
|
+
(rec.completedAt ? `terminated_at: ${rec.completedAt}\n` : ``),
|
|
437
|
+
},
|
|
438
|
+
],
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
catch (err) {
|
|
442
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
443
|
+
return { content: [{ type: "text", text: `cancel_task rejected: ${msg}` }], isError: true };
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (name === "expedite_task") {
|
|
447
|
+
const parsed = taskIdOnlyInput.parse(args);
|
|
448
|
+
try {
|
|
449
|
+
const adapters = buildAdapters();
|
|
450
|
+
if (!adapters.anthropic && !adapters.openai) {
|
|
451
|
+
return {
|
|
452
|
+
content: [
|
|
453
|
+
{
|
|
454
|
+
type: "text",
|
|
455
|
+
text: `expedite_task rejected: no provider API key set (ANTHROPIC_API_KEY / OPENAI_API_KEY). ` +
|
|
456
|
+
`Set one in the MCP server env block, restart, and retry.`,
|
|
457
|
+
},
|
|
458
|
+
],
|
|
459
|
+
isError: true,
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
const entry = await scheduler.expediteTask(parsed.task_id, adapters);
|
|
463
|
+
return {
|
|
464
|
+
content: [
|
|
465
|
+
{
|
|
466
|
+
type: "text",
|
|
467
|
+
text: `Task ${parsed.task_id} expedited.\n` +
|
|
468
|
+
`status: ${entry.status}\n` +
|
|
469
|
+
(entry.error ? `error: ${entry.error}\n` : ``),
|
|
470
|
+
},
|
|
471
|
+
],
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
catch (err) {
|
|
475
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
476
|
+
return { content: [{ type: "text", text: `expedite_task rejected: ${msg}` }], isError: true };
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (name === "update_deadline") {
|
|
480
|
+
const parsed = updateDeadlineInput.parse(args);
|
|
481
|
+
try {
|
|
482
|
+
const rec = await scheduler.updateDeadline(parsed.task_id, parsed.deadline);
|
|
483
|
+
return {
|
|
484
|
+
content: [
|
|
485
|
+
{
|
|
486
|
+
type: "text",
|
|
487
|
+
text: `Task ${parsed.task_id} updated.\n` +
|
|
488
|
+
`status: ${rec.status}\n` +
|
|
489
|
+
`scheduled_for: ${rec.scheduledFor ?? "(immediate)"}\n` +
|
|
490
|
+
`new_deadline: ${parsed.deadline}`,
|
|
491
|
+
},
|
|
492
|
+
],
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
catch (err) {
|
|
496
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
497
|
+
return { content: [{ type: "text", text: `update_deadline rejected: ${msg}` }], isError: true };
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (name === "retry_task") {
|
|
501
|
+
const parsed = taskIdOnlyInput.parse(args);
|
|
502
|
+
try {
|
|
503
|
+
const adapters = buildAdapters();
|
|
504
|
+
if (!adapters.anthropic && !adapters.openai) {
|
|
505
|
+
return {
|
|
506
|
+
content: [
|
|
507
|
+
{
|
|
508
|
+
type: "text",
|
|
509
|
+
text: `retry_task rejected: no provider API key set (ANTHROPIC_API_KEY / OPENAI_API_KEY).`,
|
|
510
|
+
},
|
|
511
|
+
],
|
|
512
|
+
isError: true,
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
const entry = await scheduler.retryTask(parsed.task_id, adapters);
|
|
516
|
+
return {
|
|
517
|
+
content: [
|
|
518
|
+
{
|
|
519
|
+
type: "text",
|
|
520
|
+
text: `Task ${parsed.task_id} retried.\n` +
|
|
521
|
+
`status: ${entry.status}\n` +
|
|
522
|
+
(entry.error ? `error: ${entry.error}\n` : ``),
|
|
523
|
+
},
|
|
524
|
+
],
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
catch (err) {
|
|
528
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
529
|
+
return { content: [{ type: "text", text: `retry_task rejected: ${msg}` }], isError: true };
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return {
|
|
533
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
534
|
+
isError: true,
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
catch (err) {
|
|
538
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
539
|
+
return {
|
|
540
|
+
content: [{ type: "text", text: `Error: ${msg}` }],
|
|
541
|
+
isError: true,
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
function formatForecast(forecast) {
|
|
546
|
+
const lines = [];
|
|
547
|
+
lines.push(`Region: ${forecast.region}`);
|
|
548
|
+
lines.push(`Source: ${forecast.source}`);
|
|
549
|
+
lines.push(`Generated: ${forecast.generatedAt}`);
|
|
550
|
+
lines.push("");
|
|
551
|
+
lines.push("Hour | gCO2/kWh | band");
|
|
552
|
+
lines.push("--- | --- | ---");
|
|
553
|
+
for (const e of forecast.entries) {
|
|
554
|
+
const hour = e.datetime.slice(11, 16);
|
|
555
|
+
lines.push(`${hour} | ${String(e.carbonIntensityGCo2PerKwh).padStart(4)} | ${e.band}`);
|
|
556
|
+
}
|
|
557
|
+
const min = forecast.entries.reduce((a, b) => a.carbonIntensityGCo2PerKwh <= b.carbonIntensityGCo2PerKwh ? a : b);
|
|
558
|
+
const max = forecast.entries.reduce((a, b) => a.carbonIntensityGCo2PerKwh >= b.carbonIntensityGCo2PerKwh ? a : b);
|
|
559
|
+
lines.push("");
|
|
560
|
+
lines.push(`Cleanest hour: ${min.datetime} (${min.carbonIntensityGCo2PerKwh} gCO2/kWh, ${min.band})`);
|
|
561
|
+
lines.push(`Dirtiest hour: ${max.datetime} (${max.carbonIntensityGCo2PerKwh} gCO2/kWh, ${max.band})`);
|
|
562
|
+
return lines.join("\n");
|
|
563
|
+
}
|
|
564
|
+
function formatRecommendation(r) {
|
|
565
|
+
// Emit canonical snake_case JSON so an LLM caller can parse the result
|
|
566
|
+
// directly. The fields mirror the Python `RecommendResult.to_dict()`
|
|
567
|
+
// 1:1 — keep this in lockstep when either side adds a field.
|
|
568
|
+
const payload = {
|
|
569
|
+
scheduled_for: r.scheduledFor,
|
|
570
|
+
intensity_g_co2_per_kwh: r.intensityGCo2PerKwh,
|
|
571
|
+
band: r.band,
|
|
572
|
+
estimated_carbon_g_co2: r.estimatedCarbonGCo2,
|
|
573
|
+
estimated_savings_vs_now_pct: r.estimatedSavingsVsNowPct,
|
|
574
|
+
batch_eligible: r.batchEligible,
|
|
575
|
+
alternatives: r.alternatives.map((a) => ({
|
|
576
|
+
scheduled_for: a.scheduledFor,
|
|
577
|
+
intensity_g_co2_per_kwh: a.intensityGCo2PerKwh,
|
|
578
|
+
band: a.band,
|
|
579
|
+
estimated_carbon_g_co2: a.estimatedCarbonGCo2,
|
|
580
|
+
estimated_savings_vs_now_pct: a.estimatedSavingsVsNowPct,
|
|
581
|
+
})),
|
|
582
|
+
reasoning: r.reasoning,
|
|
583
|
+
};
|
|
584
|
+
return JSON.stringify(payload, null, 2);
|
|
585
|
+
}
|
|
586
|
+
function formatTask(task) {
|
|
587
|
+
if (!task)
|
|
588
|
+
return "";
|
|
589
|
+
const lines = [
|
|
590
|
+
`task_id: ${task.taskId}`,
|
|
591
|
+
`status: ${task.status}`,
|
|
592
|
+
`region: ${task.region}`,
|
|
593
|
+
`enqueued_at: ${task.enqueuedAt}`,
|
|
594
|
+
];
|
|
595
|
+
if (task.scheduledFor)
|
|
596
|
+
lines.push(`scheduled_for: ${task.scheduledFor}`);
|
|
597
|
+
if (task.completedAt)
|
|
598
|
+
lines.push(`completed_at: ${task.completedAt}`);
|
|
599
|
+
if (task.carbonBudgetG)
|
|
600
|
+
lines.push(`carbon_budget_g: ${task.carbonBudgetG}`);
|
|
601
|
+
if (task.receipt) {
|
|
602
|
+
lines.push("");
|
|
603
|
+
lines.push("Carbon receipt:");
|
|
604
|
+
lines.push(` ran_at: ${task.receipt.ranAt}`);
|
|
605
|
+
lines.push(` estimated_carbon_g: ${task.receipt.estimatedCarbonGCo2}`);
|
|
606
|
+
if (task.receipt.durationMs)
|
|
607
|
+
lines.push(` duration_ms: ${task.receipt.durationMs}`);
|
|
608
|
+
}
|
|
609
|
+
if (task.error)
|
|
610
|
+
lines.push(`error: ${task.error}`);
|
|
611
|
+
return lines.join("\n");
|
|
612
|
+
}
|
|
613
|
+
function formatQueueSummary(tasks) {
|
|
614
|
+
if (tasks.length === 0) {
|
|
615
|
+
return "Queue is empty.";
|
|
616
|
+
}
|
|
617
|
+
const counts = {};
|
|
618
|
+
for (const t of tasks) {
|
|
619
|
+
if (!t)
|
|
620
|
+
continue;
|
|
621
|
+
counts[t.status] = (counts[t.status] ?? 0) + 1;
|
|
622
|
+
}
|
|
623
|
+
const lines = [
|
|
624
|
+
`Total tasks: ${tasks.length}`,
|
|
625
|
+
...Object.entries(counts).map(([s, n]) => ` ${s}: ${n}`),
|
|
626
|
+
"",
|
|
627
|
+
"Tasks:",
|
|
628
|
+
];
|
|
629
|
+
for (const t of tasks) {
|
|
630
|
+
if (!t)
|
|
631
|
+
continue;
|
|
632
|
+
lines.push(` ${t.taskId} | ${t.status.padEnd(10)} | region=${t.region}${t.scheduledFor ? ` | sched=${t.scheduledFor}` : ""}`);
|
|
633
|
+
}
|
|
634
|
+
return lines.join("\n");
|
|
635
|
+
}
|
|
636
|
+
async function main() {
|
|
637
|
+
const transport = new StdioServerTransport();
|
|
638
|
+
await server.connect(transport);
|
|
639
|
+
// eslint-disable-next-line no-console
|
|
640
|
+
console.error("[ebb-mcp] ready (stdio) — region=" +
|
|
641
|
+
DEFAULT_REGION +
|
|
642
|
+
", grid feed=" +
|
|
643
|
+
feed.source);
|
|
644
|
+
}
|
|
645
|
+
main().catch((err) => {
|
|
646
|
+
// eslint-disable-next-line no-console
|
|
647
|
+
console.error("[ebb-mcp] fatal:", err);
|
|
648
|
+
process.exit(1);
|
|
649
|
+
});
|
|
650
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,SAAS,GAGV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,aAAa,CAAC;AAEvE,MAAM,IAAI,GAAG,mBAAmB,EAAE,CAAC;AACnC,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,CAAC;AAEzE,SAAS,aAAa;IACpB,MAAM,GAAG,GAA8D,EAAE,CAAC;IAC1E,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAC1E,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,GAAG,CAAC,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IACjE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,CACP,4EAA4E,CAC7E;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAA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AM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,sCAAsC;IACtC,OAAO,CAAC,KAAK,CACX,mCAAmC;QACjC,cAAc;QACd,cAAc;QACd,IAAI,CAAC,MAAM,CACd,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ebb-ai/mcp",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Model Context Protocol server for ebb-ai — carbon-aware scheduling tools for any MCP-compatible agent.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Vitalii Borovyk",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/server.js",
|
|
9
|
+
"bin": {
|
|
10
|
+
"ebb-mcp": "./dist/server.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@modelcontextprotocol/sdk": "~1.29.0",
|
|
19
|
+
"zod": "^3.23.8",
|
|
20
|
+
"@ebb-ai/core": "0.6.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.6.3",
|
|
24
|
+
"vitest": "^2.1.5",
|
|
25
|
+
"tsx": "^4.22.0",
|
|
26
|
+
"@types/node": "^22.10.0"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/Vitalini/ebb-ai.git",
|
|
31
|
+
"directory": "packages/mcp-server"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.json && chmod +x dist/server.js",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"start": "node dist/server.js",
|
|
41
|
+
"dev": "node --loader tsx src/server.ts",
|
|
42
|
+
"clean": "rm -rf dist"
|
|
43
|
+
}
|
|
44
|
+
}
|