mcp-event-intelligence 0.1.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/CHANGELOG.md +80 -0
- package/LICENSE +201 -0
- package/README.md +298 -0
- package/SECURITY.md +42 -0
- package/bin/mcp-event-intelligence.mjs +52 -0
- package/dist/src/composite/engine.d.ts +87 -0
- package/dist/src/composite/engine.js +667 -0
- package/dist/src/composite/temporal.d.ts +32 -0
- package/dist/src/composite/temporal.js +317 -0
- package/dist/src/intelligenceProtocol/audit.d.ts +19 -0
- package/dist/src/intelligenceProtocol/audit.js +56 -0
- package/dist/src/intelligenceProtocol/canonical.d.ts +2 -0
- package/dist/src/intelligenceProtocol/canonical.js +21 -0
- package/dist/src/intelligenceProtocol/index.d.ts +12 -0
- package/dist/src/intelligenceProtocol/index.js +8 -0
- package/dist/src/intelligenceProtocol/invariants.d.ts +3 -0
- package/dist/src/intelligenceProtocol/invariants.js +36 -0
- package/dist/src/intelligenceProtocol/lifecycle.d.ts +4 -0
- package/dist/src/intelligenceProtocol/lifecycle.js +24 -0
- package/dist/src/intelligenceProtocol/mapper.d.ts +14 -0
- package/dist/src/intelligenceProtocol/mapper.js +28 -0
- package/dist/src/intelligenceProtocol/schemas.d.ts +325 -0
- package/dist/src/intelligenceProtocol/schemas.js +182 -0
- package/dist/src/intelligenceProtocol/triggerSchemas.d.ts +488 -0
- package/dist/src/intelligenceProtocol/triggerSchemas.js +379 -0
- package/dist/src/intelligenceProtocol/version.d.ts +7 -0
- package/dist/src/intelligenceProtocol/version.js +7 -0
- package/dist/src/mcpEvents/consumer.d.ts +7 -0
- package/dist/src/mcpEvents/consumer.js +14 -0
- package/dist/src/mcpEvents/server.d.ts +41 -0
- package/dist/src/mcpEvents/server.js +122 -0
- package/dist/src/protocol/types.d.ts +37 -0
- package/dist/src/protocol/types.js +1 -0
- package/dist/src/semantic/conditionEngine.d.ts +7 -0
- package/dist/src/semantic/conditionEngine.js +65 -0
- package/dist/src/semantic/types.d.ts +31 -0
- package/dist/src/semantic/types.js +1 -0
- package/dist/src/semantic/typesafeJevEvaluator.d.ts +23 -0
- package/dist/src/semantic/typesafeJevEvaluator.js +95 -0
- package/package.json +85 -0
- package/scripts/host-integration.d.mts +86 -0
- package/scripts/host-integration.mjs +216 -0
- package/scripts/lib/composite-event-consumer.mjs +172 -0
- package/scripts/lib/composite-wake-coordinator.mjs +185 -0
- package/scripts/lib/derived-contract-registry.mjs +210 -0
- package/scripts/lib/derived-event-coordinator.mjs +242 -0
- package/scripts/lib/event-processor.mjs +409 -0
- package/scripts/lib/generic-runtime-wake.mjs +76 -0
- package/scripts/lib/github-mcp-events-adapter.mjs +66 -0
- package/scripts/lib/github-webhook.mjs +88 -0
- package/scripts/lib/http-wake-deliverer.mjs +31 -0
- package/scripts/lib/local-event-intelligence-runtime.mjs +193 -0
- package/scripts/lib/mcp-events-client.mjs +519 -0
- package/scripts/lib/persistent-event-store.mjs +769 -0
- package/scripts/lib/temporal-deadline-scheduler.mjs +111 -0
- package/scripts/lib/trigger-control-plane.mjs +939 -0
- package/scripts/lib/trigger-inspector.mjs +631 -0
- package/scripts/lib/wake-signature.mjs +10 -0
- package/scripts/mcp-stdio-server.mjs +380 -0
- package/scripts/mcp-stdio.mjs +3 -0
- package/scripts/run-tests.mjs +51 -0
- package/scripts/service.mjs +756 -0
- package/server.json +68 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable public changes are documented here.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2026-09-20
|
|
6
|
+
|
|
7
|
+
Initial public reference release.
|
|
8
|
+
|
|
9
|
+
### Standard MCP control plane
|
|
10
|
+
|
|
11
|
+
- official TypeScript SDK v2 stdio server targeting MCP 2026-07-28;
|
|
12
|
+
- read-only Event Intelligence tools exposed by default;
|
|
13
|
+
- persistent mutation tools require explicit operator opt-in and confirmation IDs;
|
|
14
|
+
- `server.json` + npm `mcpName` ownership metadata;
|
|
15
|
+
- official MCP Registry schema/semantic validation in CI;
|
|
16
|
+
- packed npm artifact smoke-tested for MCP entrypoints.
|
|
17
|
+
|
|
18
|
+
### Launch visuals
|
|
19
|
+
|
|
20
|
+
- rendered hero architecture SVG;
|
|
21
|
+
- rendered durable-time/restart SVG;
|
|
22
|
+
- rendered Inspector/provenance SVG.
|
|
23
|
+
|
|
24
|
+
### Event ingestion and MCP Events boundary
|
|
25
|
+
|
|
26
|
+
- experimental MCP Events discovery, `events/list`, and `events/poll` compatibility;
|
|
27
|
+
- embedded host API discovers already-connected MCP clients from the harness registry;
|
|
28
|
+
- no duplicate provider URL/token configuration or per-MCP Event Intelligence setup;
|
|
29
|
+
- tools-only MCPs are ignored while Events-capable MCPs are attached automatically;
|
|
30
|
+
- dynamic registry refresh plus low-level attach/detach support;
|
|
31
|
+
- persistent opaque cursors and restart-safe event deduplication;
|
|
32
|
+
- GitHub provider webhook mapping into MCP EventOccurrence and automatic composite fan-in.
|
|
33
|
+
|
|
34
|
+
### Durable trigger engine
|
|
35
|
+
|
|
36
|
+
- `allOf`, `anyOf`, `sequence`, and `count`;
|
|
37
|
+
- deterministic same-value correlation;
|
|
38
|
+
- optional semantic correlation;
|
|
39
|
+
- persistent partial/matched/fired/expired state and replay safety;
|
|
40
|
+
- agent-authored trigger control with source scoping, advertised-field validation and approval gating;
|
|
41
|
+
- no bundled OpenAI planner: the surrounding agent authors the structured trigger directly.
|
|
42
|
+
|
|
43
|
+
### Temporal reasoning
|
|
44
|
+
|
|
45
|
+
- calendar-aware conditions with IANA timezones;
|
|
46
|
+
- `absence`, `not`, `unless`, `after`, `until`, `debounce`, `threshold`, `rate`, and `distinct`;
|
|
47
|
+
- durable deadlines that progress without a new provider event;
|
|
48
|
+
- restart recovery and DST-aware tests.
|
|
49
|
+
|
|
50
|
+
### Runtime continuations
|
|
51
|
+
|
|
52
|
+
- signed refs-only wake packets;
|
|
53
|
+
- one in-process harness wake dispatcher can route continuations to multiple agents;
|
|
54
|
+
- optional signed callback targets for standalone deployments;
|
|
55
|
+
- runtime receipts, retry/dead-letter lifecycle, and idempotency;
|
|
56
|
+
- trigger lifecycle policies: one-shot, max firings, cooldown, expiry, lease, update, delete, and self-retirement.
|
|
57
|
+
|
|
58
|
+
### Derived events and contracts
|
|
59
|
+
|
|
60
|
+
- trigger composition through immutable derived events;
|
|
61
|
+
- flattened root provenance and direct-parent lineage;
|
|
62
|
+
- cycle detection and recursion depth limits;
|
|
63
|
+
- versioned derived-event contracts with canonical schema fingerprints;
|
|
64
|
+
- compatibility preflight and ambiguous-consumer rejection.
|
|
65
|
+
|
|
66
|
+
### Observability and verification
|
|
67
|
+
|
|
68
|
+
- deterministic Trigger Inspector with why-fired / why-not-fired state;
|
|
69
|
+
- isolated trigger simulation;
|
|
70
|
+
- full-system black-box acceptance covering signed wake, contract evolution, replay, and restart during a pending deadline;
|
|
71
|
+
- real GitHub provider regression verified in the persistent environment.
|
|
72
|
+
|
|
73
|
+
### Known limitations
|
|
74
|
+
|
|
75
|
+
- MCP Events support targets an experimental design and is not a finalized MCP specification;
|
|
76
|
+
- automatic MCP discovery requires the embedding harness to expose its connected-client registry through the small host adapter interface;
|
|
77
|
+
- JSONL persistence is single-writer and reference-grade;
|
|
78
|
+
- no multi-replica / HA storage backend is included;
|
|
79
|
+
- the v0.1 MCP control plane is stdio-only; a Streamable HTTP control-plane transport is not included;
|
|
80
|
+
- Stateful Facts / current-state materialization is intentionally deferred.
|
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 reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and 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 Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
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 MCP Event Intelligence contributors
|
|
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 implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# MCP Event Intelligence
|
|
2
|
+
|
|
3
|
+
> Durable temporal event intelligence for sleeping agents.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/sarooo17/event-intelligence/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
MCP Event Intelligence is an experimental event runtime for agents that need to react to **future conditions over multiple event sources** without keeping an LLM or agent loop alive.
|
|
9
|
+
|
|
10
|
+
The primary integration model is **embedded and host-owned**: the agent host keeps its existing MCP clients, transports, OAuth sessions and provider credentials. Event Intelligence receives a reference to the host's MCP registry, discovers the already-connected clients automatically, and uses only the Events-capable ones.
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="docs/assets/hero-architecture.svg" alt="MCP Event Intelligence architecture: event sources flow into durable composite and temporal reasoning, derived versioned events, and runtime wakeups." width="100%" />
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
An agent can express an intent such as:
|
|
17
|
+
|
|
18
|
+
> When this PR is merged, the production deploy succeeds, and no error is observed for 10 minutes, wake this task and review the release.
|
|
19
|
+
|
|
20
|
+
Event Intelligence persists that continuation independently of the model, waits for the world to satisfy it, and wakes the host only when necessary.
|
|
21
|
+
|
|
22
|
+
## Embed it in an existing agent host
|
|
23
|
+
|
|
24
|
+
After publication:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install mcp-event-intelligence
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Pass the harness-level MCP registry once — not every MCP one by one:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import {
|
|
34
|
+
createEventIntelligenceHost,
|
|
35
|
+
createMcpRegistryAdapter,
|
|
36
|
+
} from 'mcp-event-intelligence/host';
|
|
37
|
+
|
|
38
|
+
const ei = await createEventIntelligenceHost({
|
|
39
|
+
dataDir: './data',
|
|
40
|
+
mcpRegistry: createMcpRegistryAdapter({
|
|
41
|
+
listConnections: () => host.mcp.listConnections(),
|
|
42
|
+
subscribe: (refresh) => host.mcp.onConnectionsChanged(refresh),
|
|
43
|
+
}),
|
|
44
|
+
wake: async (packet) => {
|
|
45
|
+
const receipt = await host.resume(packet.target, packet);
|
|
46
|
+
return { runtimeReceiptId: receipt.id };
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Event Intelligence enumerates the host registry automatically. GitHub, Gmail, private/company MCPs and future connections do not need to be configured again inside EI. Tools-only MCPs remain available to the agent and are ignored by the Events layer; Events-capable MCPs are attached automatically.
|
|
52
|
+
|
|
53
|
+
## What v0.1 implements
|
|
54
|
+
|
|
55
|
+
### Host-owned event sources
|
|
56
|
+
|
|
57
|
+
- automatic discovery from the host's existing MCP registry;
|
|
58
|
+
- reuse of already-connected MCP clients without duplicate credentials;
|
|
59
|
+
- experimental MCP Events capability discovery;
|
|
60
|
+
- `events/list` and `events/poll`;
|
|
61
|
+
- persistent opaque cursors;
|
|
62
|
+
- automatic event-source registration;
|
|
63
|
+
- dynamic attach/detach of host MCP clients;
|
|
64
|
+
- provider-native compatibility adapters such as GitHub webhooks.
|
|
65
|
+
|
|
66
|
+
### Composite and temporal triggers
|
|
67
|
+
|
|
68
|
+
- `allOf`, `anyOf`, `sequence`, `count`;
|
|
69
|
+
- deterministic same-value correlation;
|
|
70
|
+
- optional semantic correlation;
|
|
71
|
+
- `absence`, `not`, `unless`, `after`, `until`;
|
|
72
|
+
- `debounce`, `threshold`, `rate`, `distinct`;
|
|
73
|
+
- calendar-aware conditions with IANA timezones;
|
|
74
|
+
- durable deadlines that continue even when no new provider event arrives.
|
|
75
|
+
|
|
76
|
+
### Agent-authored continuations
|
|
77
|
+
|
|
78
|
+
- event-source discovery;
|
|
79
|
+
- agent-authored structured trigger definitions;
|
|
80
|
+
- deterministic validation against real source schemas and advertised fields;
|
|
81
|
+
- approval-gated persistent mutations;
|
|
82
|
+
- one-shot, cooldown, max-firings, expiry, leases, update and delete.
|
|
83
|
+
|
|
84
|
+
### Derived events and composition
|
|
85
|
+
|
|
86
|
+
Triggers can emit immutable higher-level events instead of waking an agent:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
pr.merged + deploy.succeeded
|
|
90
|
+
↓
|
|
91
|
+
release.ready@1
|
|
92
|
+
+
|
|
93
|
+
manager.approved
|
|
94
|
+
↓
|
|
95
|
+
rollout.allowed@1
|
|
96
|
+
↓
|
|
97
|
+
runtime wake
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Derived events preserve refs-only lineage to their direct parents and flattened root evidence.
|
|
101
|
+
|
|
102
|
+
<p align="center">
|
|
103
|
+
<img src="docs/assets/provenance-inspector.svg" alt="Rendered Trigger Inspector and flattened provenance example." width="100%" />
|
|
104
|
+
</p>
|
|
105
|
+
|
|
106
|
+
### Versioned contracts
|
|
107
|
+
|
|
108
|
+
Derived event names are versioned contracts such as `release.ready@1`.
|
|
109
|
+
|
|
110
|
+
- first producer establishes the canonical schema;
|
|
111
|
+
- compatible producers may join the same contract version;
|
|
112
|
+
- incompatible schemas fail before trigger persistence;
|
|
113
|
+
- multiple versions may coexist;
|
|
114
|
+
- ambiguous unversioned consumers fail closed;
|
|
115
|
+
- every occurrence carries a schema fingerprint.
|
|
116
|
+
|
|
117
|
+
### Host or callback wake
|
|
118
|
+
|
|
119
|
+
An embedded harness can provide one in-process wake dispatcher that routes by `target.runtime`, `target.kind` and `target.id`; runtime-specific handlers remain available as a lower-level option. A standalone deployment can instead use signed HMAC callbacks. Both paths return a stable `runtimeReceiptId`.
|
|
120
|
+
|
|
121
|
+
## Why this exists
|
|
122
|
+
|
|
123
|
+
MCP Events is concerned with the event transport/subscription boundary. Event Intelligence explores the layer **above transport**:
|
|
124
|
+
|
|
125
|
+
- how an agent declares a future condition;
|
|
126
|
+
- how multi-event state survives while the agent sleeps;
|
|
127
|
+
- how absence/time becomes an event;
|
|
128
|
+
- how higher-level facts are derived without invoking a model;
|
|
129
|
+
- how those facts can be safely composed;
|
|
130
|
+
- how a host resumes an agent effectively once in the validated scenarios.
|
|
131
|
+
|
|
132
|
+
This project does **not** propose a replacement for MCP Events and does not claim to be an official MCP extension.
|
|
133
|
+
|
|
134
|
+
## AI and API keys
|
|
135
|
+
|
|
136
|
+
Event Intelligence has one optional AI boundary: **semantic correlation**.
|
|
137
|
+
|
|
138
|
+
- `TYPESAFE_API_KEY` enables the bundled TypeSafe Jev evaluator when a trigger explicitly requests semantic correlation.
|
|
139
|
+
- embedded hosts may inject a compatible `semanticEvaluator` instead.
|
|
140
|
+
- there is no bundled OpenAI planner and no OpenAI API dependency.
|
|
141
|
+
|
|
142
|
+
The agent/harness is already responsible for reasoning and can author a structured trigger directly from `event_sources_list` / the discovered schemas. Deterministic correlation, temporal logic, persistence, derived events and wake delivery require no model API.
|
|
143
|
+
|
|
144
|
+
## Full-system acceptance
|
|
145
|
+
|
|
146
|
+
The v0.1 acceptance suite verifies:
|
|
147
|
+
|
|
148
|
+
- host-owned MCP client → event discovery/poll → composite match → in-process wake;
|
|
149
|
+
- provider-neutral events → composite match → derived event → derived composition → signed runtime wake;
|
|
150
|
+
- contract schema evolution and ambiguity rejection;
|
|
151
|
+
- refs-only root provenance;
|
|
152
|
+
- replay without duplicate derived events or wakes;
|
|
153
|
+
- process shutdown while a temporal deadline is pending;
|
|
154
|
+
- restart on the same datastore after the deadline;
|
|
155
|
+
- wake recovery **without a new provider event**;
|
|
156
|
+
- hash-linked audit verification.
|
|
157
|
+
|
|
158
|
+
A separate live regression also verified real GitHub webhook ingress into the MCP EventOccurrence / composite fan-in path.
|
|
159
|
+
|
|
160
|
+
## Standalone reference service
|
|
161
|
+
|
|
162
|
+
### Requirements
|
|
163
|
+
|
|
164
|
+
- Node.js 22+
|
|
165
|
+
- no external database for the reference setup
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git clone https://github.com/sarooo17/event-intelligence.git
|
|
169
|
+
cd mcp-event-intelligence
|
|
170
|
+
npm ci
|
|
171
|
+
npm run check
|
|
172
|
+
|
|
173
|
+
export SERVICE_AUTH_TOKEN="$(openssl rand -hex 32)"
|
|
174
|
+
npm start
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Then:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
curl http://127.0.0.1:3000/readyz
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The standalone service supports manual/provider-native event ingress. It does not own arbitrary MCP connections; host-owned MCP reuse belongs to the package integration above.
|
|
184
|
+
|
|
185
|
+
### Docker
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
docker build -t mcp-event-intelligence:0.1.0 .
|
|
189
|
+
|
|
190
|
+
docker run --rm \
|
|
191
|
+
-p 3000:3000 \
|
|
192
|
+
-v mcp-event-intelligence-data:/data \
|
|
193
|
+
-e SERVICE_AUTH_TOKEN="$(openssl rand -hex 32)" \
|
|
194
|
+
mcp-event-intelligence:0.1.0
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Optional MCP control plane
|
|
198
|
+
|
|
199
|
+
The package also exposes a standard **MCP stdio** control plane through the official TypeScript SDK v2:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
npx mcp-event-intelligence mcp
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Read/non-mutating tools are exposed by default, including `event_sources_list`, inspection, simulation, contracts and runtime status. An agent uses those discovered source schemas to author the structured definition passed to `trigger_create`.
|
|
206
|
+
|
|
207
|
+
Persistent trigger mutations are only registered when the operator explicitly enables `MCP_WRITE_ENABLED=true`, and each mutation still requires a `confirmationId`. The MCP server is a control-plane adapter; it is **not** a gateway through which the host's other MCP servers must be reconnected.
|
|
208
|
+
|
|
209
|
+
See [docs/QUICKSTART.md](docs/QUICKSTART.md) and [docs/MCP-REGISTRY.md](docs/MCP-REGISTRY.md).
|
|
210
|
+
|
|
211
|
+
## Configuration
|
|
212
|
+
|
|
213
|
+
Standalone/core environment variables:
|
|
214
|
+
|
|
215
|
+
| Variable | Required | Purpose |
|
|
216
|
+
| --- | --- | --- |
|
|
217
|
+
| `SERVICE_AUTH_TOKEN` | yes for protected HTTP APIs | bearer token for control-plane endpoints |
|
|
218
|
+
| `DATA_DIR` | no | persistent JSONL directory, default `./data` |
|
|
219
|
+
| `PORT` | no | HTTP port, default `3000` |
|
|
220
|
+
| `ENVIRONMENT_ID` | no | environment boundary |
|
|
221
|
+
| `RUNTIME_WAKE_TARGETS_JSON` | no | signed standalone runtime callbacks |
|
|
222
|
+
| `GITHUB_WEBHOOK_SECRET` | no | verify GitHub webhook ingress |
|
|
223
|
+
| `TYPESAFE_API_KEY` | no | bundled TypeSafe Jev semantic evaluator |
|
|
224
|
+
|
|
225
|
+
Embedded hosts pass one MCP registry adapter. Event Intelligence discovers already-connected clients from that registry; provider MCP connection settings are not duplicated inside EI.
|
|
226
|
+
|
|
227
|
+
## Architecture
|
|
228
|
+
|
|
229
|
+
The detailed execution model, clocks, lifecycle, persistence and trust boundaries are documented in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
|
230
|
+
|
|
231
|
+
## Important semantics
|
|
232
|
+
|
|
233
|
+
### Event-time vs processing-time
|
|
234
|
+
|
|
235
|
+
Normal event windows use event `occurredAt`.
|
|
236
|
+
|
|
237
|
+
Absence/deadline progression uses Event Intelligence processing time. This separation is explicit and tested.
|
|
238
|
+
|
|
239
|
+
<p align="center">
|
|
240
|
+
<img src="docs/assets/durable-time-restart.svg" alt="Rendered durable-time timeline showing a deadline surviving process shutdown and firing after restart." width="100%" />
|
|
241
|
+
</p>
|
|
242
|
+
|
|
243
|
+
### Effectively-once runtime activation
|
|
244
|
+
|
|
245
|
+
The implementation does not claim theoretical distributed exactly-once delivery.
|
|
246
|
+
|
|
247
|
+
It uses stable wake IDs, persistence, deduplication, runtime receipts and replay handling to provide effectively-once runtime activation in the validated reference scenarios.
|
|
248
|
+
|
|
249
|
+
### Derived event vs current state
|
|
250
|
+
|
|
251
|
+
A derived event says **what became true at a point in history**.
|
|
252
|
+
|
|
253
|
+
v0.1 intentionally does not implement a mutable current-state/facts database.
|
|
254
|
+
|
|
255
|
+
## Security
|
|
256
|
+
|
|
257
|
+
Read [SECURITY.md](SECURITY.md) and [docs/SECURITY-MODEL.md](docs/SECURITY-MODEL.md).
|
|
258
|
+
|
|
259
|
+
In embedded mode, the host retains MCP authorization and credentials; Event Intelligence discovers only the client objects exposed through the host-provided MCP registry. The v0.1 reference store is JSONL and single-writer.
|
|
260
|
+
|
|
261
|
+
## MCP compatibility status
|
|
262
|
+
|
|
263
|
+
There are two separate MCP boundaries:
|
|
264
|
+
|
|
265
|
+
- **event ingress**: host-owned, already-connected MCP clients exposing experimental Events, plus provider-native adapters;
|
|
266
|
+
- **control plane**: optional standard MCP **stdio** server built on the official TypeScript SDK v2 and targeting protocol revision 2026-07-28.
|
|
267
|
+
|
|
268
|
+
Registry identity:
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
io.github.sarooo17/event-intelligence
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
`server.json` is validated with the official `mcp-publisher validate` command in CI. MCP Events itself remains experimental and may change as the Triggers & Events work evolves.
|
|
275
|
+
|
|
276
|
+
## Project status
|
|
277
|
+
|
|
278
|
+
**v0.1 reference implementation / experimental.**
|
|
279
|
+
|
|
280
|
+
The architecture is implemented and exercised end-to-end. Remaining work is primarily production storage/HA, broader host/provider evidence, scale benchmarks and upstream feedback.
|
|
281
|
+
|
|
282
|
+
## Example
|
|
283
|
+
|
|
284
|
+
See the [release-gate example](docs/examples/release-gate.md) for a composed future-condition flow using durable time, derived events and targeted wake.
|
|
285
|
+
|
|
286
|
+
## Contributing
|
|
287
|
+
|
|
288
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
289
|
+
|
|
290
|
+
Contributions are especially useful around host adapters, MCP Events compatibility, temporal semantics, production persistence, security review and reproducible provider integrations.
|
|
291
|
+
|
|
292
|
+
## License
|
|
293
|
+
|
|
294
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|
|
295
|
+
|
|
296
|
+
## Disclaimer
|
|
297
|
+
|
|
298
|
+
This is an independent open-source project. It is not an official Model Context Protocol specification and is not affiliated with or endorsed by the MCP maintainers.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
The public reference implementation is currently pre-1.0.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| 0.1.x | Yes |
|
|
10
|
+
| < 0.1 | No |
|
|
11
|
+
|
|
12
|
+
## Reporting a vulnerability
|
|
13
|
+
|
|
14
|
+
Please do **not** open a public issue with exploit details, credentials, private payloads, or reproduction secrets.
|
|
15
|
+
|
|
16
|
+
Use GitHub's private vulnerability reporting / security advisory flow for this repository when available. If the repository UI does not expose a private reporting option, open a minimal public issue asking the maintainer for a private contact channel **without including vulnerability details**.
|
|
17
|
+
|
|
18
|
+
Useful reports include:
|
|
19
|
+
|
|
20
|
+
- affected version/commit;
|
|
21
|
+
- impacted endpoint, protocol object, or runtime adapter;
|
|
22
|
+
- minimum reproduction;
|
|
23
|
+
- security impact;
|
|
24
|
+
- whether the issue requires authenticated access;
|
|
25
|
+
- suggested mitigation, if known.
|
|
26
|
+
|
|
27
|
+
## Security boundaries
|
|
28
|
+
|
|
29
|
+
Event Intelligence v0.1 is a reference implementation, not a hardened multi-tenant hosted service.
|
|
30
|
+
|
|
31
|
+
Important defaults and constraints:
|
|
32
|
+
|
|
33
|
+
- protected control-plane endpoints require `SERVICE_AUTH_TOKEN`;
|
|
34
|
+
- GitHub ingress verifies provider HMAC when configured;
|
|
35
|
+
- runtime wake packets are HMAC-signed and runtime targets are operator-configured;
|
|
36
|
+
- arbitrary public HTTP wake targets are rejected;
|
|
37
|
+
- derived-event lineage is refs-only by default;
|
|
38
|
+
- audit records are hash-linked and tamper-evident, not tamper-proof;
|
|
39
|
+
- the JSONL store is single-writer and not safe for horizontal multi-replica deployment;
|
|
40
|
+
- secrets belong in environment variables / secret managers, never committed files.
|
|
41
|
+
|
|
42
|
+
See `docs/SECURITY-MODEL.md` for the architectural model.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
const flags = new Set(args);
|
|
5
|
+
|
|
6
|
+
if (flags.has('--version') || flags.has('-v')) {
|
|
7
|
+
console.log('0.1.0');
|
|
8
|
+
process.exit(0);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (flags.has('--help') || flags.has('-h')) {
|
|
12
|
+
console.log(`MCP Event Intelligence v0.1
|
|
13
|
+
|
|
14
|
+
Durable temporal event intelligence for sleeping agents.
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
mcp-event-intelligence Start the HTTP reference service
|
|
18
|
+
mcp-event-intelligence mcp Start the standard MCP stdio control plane
|
|
19
|
+
mcp-event-intelligence --mcp Same as "mcp"
|
|
20
|
+
|
|
21
|
+
MCP stdio mode:
|
|
22
|
+
DATA_DIR=./data
|
|
23
|
+
MCP_WRITE_ENABLED=false Read-only by default
|
|
24
|
+
MCP_OWNER_ID=local-user
|
|
25
|
+
MCP_ACTOR_ID=mcp-agent
|
|
26
|
+
RUNTIME_WAKE_TARGETS_JSON='{}'
|
|
27
|
+
|
|
28
|
+
HTTP service:
|
|
29
|
+
SERVICE_AUTH_TOKEN=<random secret>
|
|
30
|
+
PORT=3000
|
|
31
|
+
DATA_DIR=./data
|
|
32
|
+
|
|
33
|
+
Optional integrations:
|
|
34
|
+
TYPESAFE_API_KEY=<key> Optional TypeSafe Jev semantic evaluator
|
|
35
|
+
GITHUB_WEBHOOK_SECRET=<secret> GitHub webhook verification
|
|
36
|
+
RUNTIME_WAKE_TARGETS_JSON='{}' Signed standalone runtime callbacks
|
|
37
|
+
|
|
38
|
+
Embedded hosts:
|
|
39
|
+
import { createEventIntelligenceHost } from 'mcp-event-intelligence/host'
|
|
40
|
+
Pass the harness MCP registry once; EI discovers Events-capable clients automatically.
|
|
41
|
+
|
|
42
|
+
Important:
|
|
43
|
+
stdout is reserved for MCP JSON-RPC in stdio mode.
|
|
44
|
+
`);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (args[0] === 'mcp' || flags.has('--mcp')) {
|
|
49
|
+
await import('../scripts/mcp-stdio.mjs');
|
|
50
|
+
} else {
|
|
51
|
+
await import('../scripts/service.mjs');
|
|
52
|
+
}
|