@uptimizr/mcp 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/AGENTS.md +43 -0
- package/LICENSE +201 -0
- package/README.md +86 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +23 -0
- package/dist/bin.js.map +1 -0
- package/dist/client.d.ts +23 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +38 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +31 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +28 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +203 -0
- package/dist/tools.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/llms.txt +18 -0
- package/package.json +70 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# AGENTS.md — @uptimizr/mcp
|
|
2
|
+
|
|
3
|
+
> Packaged agent guide. For the human reference see [README.md](./README.md); for design
|
|
4
|
+
> rationale see the project ADRs at https://github.com/RaananW/Uptimizr/tree/main/docs/adr.
|
|
5
|
+
|
|
6
|
+
## What this package is
|
|
7
|
+
|
|
8
|
+
A **read-only** Model Context Protocol (MCP) server over an Uptimizr collector's query API. It
|
|
9
|
+
lets an agent query a consumer's **own** 3D analytics in natural language. Each tool maps to one
|
|
10
|
+
documented collector read endpoint; the server is a thin wrapper that holds no business logic and
|
|
11
|
+
performs `GET` requests only (ADR 0005, ADR 0017).
|
|
12
|
+
|
|
13
|
+
## Run
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
UPTIMIZR_COLLECTOR_URL="https://collect.example.com" UPTIMIZR_API_KEY="utk_…" npx @uptimizr/mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Tools (read-only)
|
|
20
|
+
|
|
21
|
+
`list_sessions`, `pointer_heatmap`, `world_heatmap`, `camera_heatmap`, `click_rays`, `flow_links`,
|
|
22
|
+
`top_meshes`, `perf_summary`, `list_scenes`, `timeseries`, `event_counts`, `session_meta`,
|
|
23
|
+
`scene_representation`. Most accept `since`/`until` (epoch ms) plus endpoint-specific filters
|
|
24
|
+
(`scene`, `session`, `source`, `bins`, `cellSize`, `limit`).
|
|
25
|
+
|
|
26
|
+
## Rules for agents
|
|
27
|
+
|
|
28
|
+
- **Read-only and privacy-preserving.** Never add ingestion, mutation, or raw per-session event
|
|
29
|
+
tools here. No data leaves the consumer's infrastructure (ADR 0003).
|
|
30
|
+
- The server talks only to the configured collector with the consumer's `x-api-key`; never hardcode
|
|
31
|
+
or log credentials.
|
|
32
|
+
- Keep it a thin wrapper: a new tool = a new entry in the `readTools` registry mapping to a
|
|
33
|
+
documented query endpoint. Do not add aggregation/business logic — that lives in the collector.
|
|
34
|
+
- Tool definitions are pure (`buildRequest`) and must stay unit-testable without a live collector.
|
|
35
|
+
|
|
36
|
+
## Programmatic API
|
|
37
|
+
|
|
38
|
+
`readMcpConfig()`, `createCollectorClient(config)`, `createMcpServer(client)`, `readTools`.
|
|
39
|
+
|
|
40
|
+
## More
|
|
41
|
+
|
|
42
|
+
- Package reference: [README.md](./README.md)
|
|
43
|
+
- Integration guide: https://github.com/RaananW/Uptimizr/blob/main/docs/integration.md
|
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 Derivative
|
|
95
|
+
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 do
|
|
117
|
+
not modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
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 for
|
|
125
|
+
use, reproduction, or distribution of Your modifications, or for any
|
|
126
|
+
such Derivative Works as a whole, provided Your use, reproduction,
|
|
127
|
+
and distribution of the Work otherwise complies with the conditions
|
|
128
|
+
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 Uptimizr 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,86 @@
|
|
|
1
|
+
# @uptimizr/mcp
|
|
2
|
+
|
|
3
|
+
A **read-only** [Model Context Protocol](https://modelcontextprotocol.io) server over an
|
|
4
|
+
Uptimizr collector's query API. It lets an AI agent ask natural-language questions about your
|
|
5
|
+
3D analytics ("what was the most-clicked mesh this week?") and have them answered by querying
|
|
6
|
+
**your own** collector — nothing is sent to any third party.
|
|
7
|
+
|
|
8
|
+
The server is a thin wrapper: each tool maps one-to-one to a documented collector query endpoint
|
|
9
|
+
(see [integration docs](https://github.com/RaananW/Uptimizr/blob/main/docs/integration.md)). It
|
|
10
|
+
performs `GET` requests only — there are **no ingestion, mutation, or raw per-session event
|
|
11
|
+
tools**.
|
|
12
|
+
|
|
13
|
+
## Run
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
UPTIMIZR_COLLECTOR_URL="https://collect.example.com" \
|
|
17
|
+
UPTIMIZR_API_KEY="utk_…" \
|
|
18
|
+
npx @uptimizr/mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
| Environment variable | Required | Notes |
|
|
22
|
+
| ------------------------ | -------- | -------------------------------------------------- |
|
|
23
|
+
| `UPTIMIZR_COLLECTOR_URL` | yes | Base URL of **your** collector. |
|
|
24
|
+
| `UPTIMIZR_API_KEY` | yes | Your project API key (`x-api-key`), read-only use. |
|
|
25
|
+
|
|
26
|
+
### Configure an MCP client
|
|
27
|
+
|
|
28
|
+
Most MCP clients (Claude Desktop, VS Code, etc.) launch the server over stdio. Example client
|
|
29
|
+
config:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"uptimizr": {
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": ["-y", "@uptimizr/mcp"],
|
|
37
|
+
"env": {
|
|
38
|
+
"UPTIMIZR_COLLECTOR_URL": "https://collect.example.com",
|
|
39
|
+
"UPTIMIZR_API_KEY": "utk_…"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Tools
|
|
47
|
+
|
|
48
|
+
All tools accept an optional time range (`since` / `until`, epoch ms) and the filters the
|
|
49
|
+
underlying endpoint supports (`scene`, `session`, `source`, `bins`, `cellSize`, `limit`, …).
|
|
50
|
+
|
|
51
|
+
| Tool | Endpoint | Returns |
|
|
52
|
+
| ---------------------- | ----------------------------------- | ------------------------------------------------ |
|
|
53
|
+
| `list_sessions` | `/api/v1/sessions` | Recent sessions. |
|
|
54
|
+
| `pointer_heatmap` | `/api/v1/heatmaps/pointer` | 2D pointer heatmap bins. |
|
|
55
|
+
| `world_heatmap` | `/api/v1/heatmaps/world` | 3D world-space pointer voxels. |
|
|
56
|
+
| `camera_heatmap` | `/api/v1/heatmaps/camera` | View-direction (spherical) bins. |
|
|
57
|
+
| `click_rays` | `/api/v1/heatmaps/click-rays` | View-gated click rays. |
|
|
58
|
+
| `flow_links` | `/api/v1/heatmaps/flow` | Gaze→mesh flow links. |
|
|
59
|
+
| `top_meshes` | `/api/v1/meshes/top` | Most-interacted meshes. |
|
|
60
|
+
| `perf_summary` | `/api/v1/perf` | FPS summary (avg/min/p50). |
|
|
61
|
+
| `list_scenes` | `/api/v1/scenes` | Active scenes. |
|
|
62
|
+
| `timeseries` | `/api/v1/timeseries` | Event-volume buckets over time. |
|
|
63
|
+
| `event_counts` | `/api/v1/event-counts` | Per-event-type counts. |
|
|
64
|
+
| `session_meta` | `/api/v1/sessions/:id/meta` | Coarse session descriptor (no raw event stream). |
|
|
65
|
+
| `scene_representation` | `/api/v1/scenes/:id/representation` | Registered proxy geometry, if any. |
|
|
66
|
+
|
|
67
|
+
## Programmatic use
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { createCollectorClient, createMcpServer, readMcpConfig } from "@uptimizr/mcp";
|
|
71
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
72
|
+
|
|
73
|
+
const client = createCollectorClient(readMcpConfig());
|
|
74
|
+
const server = createMcpServer(client);
|
|
75
|
+
await server.connect(new StdioServerTransport());
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Develop
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm --filter @uptimizr/mcp build
|
|
82
|
+
pnpm --filter @uptimizr/mcp typecheck
|
|
83
|
+
pnpm --filter @uptimizr/mcp test
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Licensed under [Apache-2.0](./LICENSE).
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { createCollectorClient } from "./client.js";
|
|
4
|
+
import { readMcpConfig } from "./config.js";
|
|
5
|
+
import { createMcpServer } from "./server.js";
|
|
6
|
+
/**
|
|
7
|
+
* Entry point: read configuration from the environment, build a read-only
|
|
8
|
+
* collector client and MCP server, and serve over stdio (the transport MCP
|
|
9
|
+
* clients such as Claude Desktop / VS Code launch).
|
|
10
|
+
*/
|
|
11
|
+
async function main() {
|
|
12
|
+
const config = readMcpConfig();
|
|
13
|
+
const client = createCollectorClient(config);
|
|
14
|
+
const server = createMcpServer(client);
|
|
15
|
+
const transport = new StdioServerTransport();
|
|
16
|
+
await server.connect(transport);
|
|
17
|
+
}
|
|
18
|
+
main().catch((err) => {
|
|
19
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
20
|
+
process.stderr.write(`uptimizr-mcp failed to start: ${message}\n`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,OAAO,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { McpConfig } from "./config.js";
|
|
2
|
+
/** A query-string parameter map. `undefined` values are omitted from the request. */
|
|
3
|
+
export type QueryParams = Record<string, string | number | undefined>;
|
|
4
|
+
/**
|
|
5
|
+
* A minimal **read-only** HTTP client over the collector query API. It performs
|
|
6
|
+
* `GET` requests only and holds no business logic — it is a thin transport that
|
|
7
|
+
* mirrors the dashboard's `CollectorApi` so an agent reads the same aggregated
|
|
8
|
+
* results a human would (ADR 0005 / ADR 0017).
|
|
9
|
+
*/
|
|
10
|
+
export interface CollectorClient {
|
|
11
|
+
get(path: string, params?: QueryParams): Promise<unknown>;
|
|
12
|
+
}
|
|
13
|
+
/** Thrown when the collector responds with a non-2xx status. */
|
|
14
|
+
export declare class CollectorError extends Error {
|
|
15
|
+
readonly status: number;
|
|
16
|
+
constructor(message: string, status: number);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build a read-only collector client bound to one `(collectorUrl, apiKey)` pair.
|
|
20
|
+
* `fetchImpl` is injectable for testing; it defaults to the global `fetch`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createCollectorClient(config: McpConfig, fetchImpl?: typeof fetch): CollectorClient;
|
|
23
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3D;AAED,gEAAgE;AAChE,qBAAa,cAAe,SAAQ,KAAK;IAGrC,QAAQ,CAAC,MAAM,EAAE,MAAM;gBADvB,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,MAAM;CAK1B;AAMD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,SAAS,GAAE,OAAO,KAAa,GAC9B,eAAe,CAmBjB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Thrown when the collector responds with a non-2xx status. */
|
|
2
|
+
export class CollectorError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
constructor(message, status) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.status = status;
|
|
7
|
+
this.name = "CollectorError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function ensureTrailingSlash(url) {
|
|
11
|
+
return url.endsWith("/") ? url : `${url}/`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build a read-only collector client bound to one `(collectorUrl, apiKey)` pair.
|
|
15
|
+
* `fetchImpl` is injectable for testing; it defaults to the global `fetch`.
|
|
16
|
+
*/
|
|
17
|
+
export function createCollectorClient(config, fetchImpl = fetch) {
|
|
18
|
+
const base = ensureTrailingSlash(config.collectorUrl);
|
|
19
|
+
return {
|
|
20
|
+
async get(path, params = {}) {
|
|
21
|
+
const url = new URL(path.replace(/^\//, ""), base);
|
|
22
|
+
for (const [key, value] of Object.entries(params)) {
|
|
23
|
+
if (value != null)
|
|
24
|
+
url.searchParams.set(key, String(value));
|
|
25
|
+
}
|
|
26
|
+
const res = await fetchImpl(url, {
|
|
27
|
+
method: "GET",
|
|
28
|
+
headers: { "x-api-key": config.apiKey },
|
|
29
|
+
});
|
|
30
|
+
if (!res.ok) {
|
|
31
|
+
const body = await res.text().catch(() => "");
|
|
32
|
+
throw new CollectorError(body || res.statusText, res.status);
|
|
33
|
+
}
|
|
34
|
+
return res.json();
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AA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,EAAE,CAAC,CAAC;gBAC9C,MAAM,IAAI,cAAc,CAAC,IAAI,IAAI,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC;YACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime configuration for the MCP server. The server only ever talks to the
|
|
3
|
+
* consumer's **own** collector, authenticated with the consumer's project API
|
|
4
|
+
* key — nothing is sent to any third party (ADR 0003 / ADR 0017).
|
|
5
|
+
*/
|
|
6
|
+
export interface McpConfig {
|
|
7
|
+
/** Base URL of the consumer's Uptimizr collector (e.g. https://collect.example.com). */
|
|
8
|
+
collectorUrl: string;
|
|
9
|
+
/** Project API key (`x-api-key`) used for read requests. */
|
|
10
|
+
apiKey: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read and validate configuration from the environment. Throws a clear error if
|
|
14
|
+
* the collector URL or API key is missing or malformed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readMcpConfig(env?: NodeJS.ProcessEnv): McpConfig;
|
|
17
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wFAAwF;IACxF,YAAY,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;CAChB;AAOD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,SAAS,CAY7E"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const envSchema = z.object({
|
|
3
|
+
UPTIMIZR_COLLECTOR_URL: z.string().url("UPTIMIZR_COLLECTOR_URL must be a valid URL"),
|
|
4
|
+
UPTIMIZR_API_KEY: z.string().min(1, "UPTIMIZR_API_KEY must not be empty"),
|
|
5
|
+
});
|
|
6
|
+
/**
|
|
7
|
+
* Read and validate configuration from the environment. Throws a clear error if
|
|
8
|
+
* the collector URL or API key is missing or malformed.
|
|
9
|
+
*/
|
|
10
|
+
export function readMcpConfig(env = process.env) {
|
|
11
|
+
const parsed = envSchema.safeParse(env);
|
|
12
|
+
if (!parsed.success) {
|
|
13
|
+
const issues = parsed.error.issues
|
|
14
|
+
.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`)
|
|
15
|
+
.join("; ");
|
|
16
|
+
throw new Error(`Invalid Uptimizr MCP configuration: ${issues}`);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
collectorUrl: parsed.data.UPTIMIZR_COLLECTOR_URL,
|
|
20
|
+
apiKey: parsed.data.UPTIMIZR_API_KEY,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,4CAA4C,CAAC;IACpF,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,oCAAoC,CAAC;CAC1E,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAyB,OAAO,CAAC,GAAG;IAChE,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;aAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;aAC3D,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO;QACL,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,sBAAsB;QAChD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB;KACrC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { readMcpConfig, type McpConfig } from "./config.js";
|
|
2
|
+
export { createCollectorClient, CollectorError, type CollectorClient, type QueryParams, } from "./client.js";
|
|
3
|
+
export { readTools, type ReadTool, type ReadToolRequest } from "./tools.js";
|
|
4
|
+
export { createMcpServer } from "./server.js";
|
|
5
|
+
export { version } from "./version.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { readMcpConfig } from "./config.js";
|
|
2
|
+
export { createCollectorClient, CollectorError, } from "./client.js";
|
|
3
|
+
export { readTools } from "./tools.js";
|
|
4
|
+
export { createMcpServer } from "./server.js";
|
|
5
|
+
export { version } from "./version.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAuC,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { CollectorClient } from "./client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Build the Uptimizr MCP server: a read-only `McpServer` whose tools each wrap
|
|
5
|
+
* one collector query endpoint via the injected `CollectorClient`. The server
|
|
6
|
+
* holds no business logic — it forwards validated arguments and returns the
|
|
7
|
+
* collector's JSON (ADR 0005 / ADR 0017).
|
|
8
|
+
*/
|
|
9
|
+
export declare function createMcpServer(client: CollectorClient): McpServer;
|
|
10
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAyBlE"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { readTools } from "./tools.js";
|
|
3
|
+
import { version } from "./version.js";
|
|
4
|
+
/**
|
|
5
|
+
* Build the Uptimizr MCP server: a read-only `McpServer` whose tools each wrap
|
|
6
|
+
* one collector query endpoint via the injected `CollectorClient`. The server
|
|
7
|
+
* holds no business logic — it forwards validated arguments and returns the
|
|
8
|
+
* collector's JSON (ADR 0005 / ADR 0017).
|
|
9
|
+
*/
|
|
10
|
+
export function createMcpServer(client) {
|
|
11
|
+
const server = new McpServer({ name: "uptimizr-mcp", version });
|
|
12
|
+
for (const tool of readTools) {
|
|
13
|
+
server.registerTool(tool.name, {
|
|
14
|
+
title: tool.title,
|
|
15
|
+
description: tool.description,
|
|
16
|
+
inputSchema: tool.inputSchema,
|
|
17
|
+
}, async (args) => {
|
|
18
|
+
try {
|
|
19
|
+
const { path, params } = tool.buildRequest(args);
|
|
20
|
+
const data = await client.get(path, params);
|
|
21
|
+
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
25
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return server;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;GAKG;AACH,MAAM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ved read request: the collector path and its query parameters. */
|
|
4
|
+
export interface ReadToolRequest {
|
|
5
|
+
path: string;
|
|
6
|
+
params: QueryParams;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A read-only tool definition. `inputSchema` is a Zod raw shape the MCP runtime
|
|
10
|
+
* uses to validate arguments; `buildRequest` maps validated arguments to a
|
|
11
|
+
* `GET` against the collector. Definitions are pure and unit-testable without a
|
|
12
|
+
* live collector.
|
|
13
|
+
*/
|
|
14
|
+
export interface ReadTool {
|
|
15
|
+
name: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
inputSchema: z.ZodRawShape;
|
|
19
|
+
buildRequest: (args: Record<string, unknown>) => ReadToolRequest;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The catalog of read-only tools. Each wraps one documented collector query
|
|
23
|
+
* endpoint (docs/integration.md §Query). There are intentionally **no**
|
|
24
|
+
* ingestion, mutation, or raw per-session event tools — the surface is
|
|
25
|
+
* aggregate, read-only, and privacy-preserving (ADR 0003 / ADR 0017).
|
|
26
|
+
*/
|
|
27
|
+
export declare const readTools: readonly ReadTool[];
|
|
28
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC;IAC3B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,eAAe,CAAC;CAClE;AAiCD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,QAAQ,EAsKxC,CAAC"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const num = (v) => (typeof v === "number" ? v : undefined);
|
|
3
|
+
const str = (v) => (typeof v === "string" ? v : undefined);
|
|
4
|
+
// Shared, reusable input fields (all optional unless a tool needs otherwise).
|
|
5
|
+
const since = z.number().int().optional().describe("Start of the time range, epoch milliseconds.");
|
|
6
|
+
const until = z.number().int().optional().describe("End of the time range, epoch milliseconds.");
|
|
7
|
+
const bins = z.number().int().positive().max(500).optional().describe("Grid resolution per axis.");
|
|
8
|
+
const limit = z.number().int().positive().max(1000).optional().describe("Maximum rows to return.");
|
|
9
|
+
const scene = z.string().optional().describe("Restrict to one developer-assigned scene id.");
|
|
10
|
+
const session = z.string().optional().describe("Scope the aggregate to a single session id.");
|
|
11
|
+
const cellSize = z.number().positive().max(1000).optional().describe("Voxel size in world units.");
|
|
12
|
+
const interval = z
|
|
13
|
+
.number()
|
|
14
|
+
.int()
|
|
15
|
+
.positive()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Time-series bucket width, seconds.");
|
|
18
|
+
const eventType = z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Restrict to a single event type, e.g. pointer_click.");
|
|
22
|
+
const source = z
|
|
23
|
+
.enum(["mouse", "touch", "stylus", "pen", "xr-controller", "hand", "gaze", "transient", "other"])
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Restrict a pointer/world heatmap to one input source.");
|
|
26
|
+
/** Build the common `{ since, until }` range params from validated args. */
|
|
27
|
+
function range(args) {
|
|
28
|
+
return { since: num(args.since), until: num(args.until) };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The catalog of read-only tools. Each wraps one documented collector query
|
|
32
|
+
* endpoint (docs/integration.md §Query). There are intentionally **no**
|
|
33
|
+
* ingestion, mutation, or raw per-session event tools — the surface is
|
|
34
|
+
* aggregate, read-only, and privacy-preserving (ADR 0003 / ADR 0017).
|
|
35
|
+
*/
|
|
36
|
+
export const readTools = [
|
|
37
|
+
{
|
|
38
|
+
name: "list_sessions",
|
|
39
|
+
title: "List recent sessions",
|
|
40
|
+
description: "Recent sessions with id, visitor, event count, and start/end times.",
|
|
41
|
+
inputSchema: { since, until, limit },
|
|
42
|
+
buildRequest: (args) => ({
|
|
43
|
+
path: "api/v1/sessions",
|
|
44
|
+
params: { ...range(args), limit: num(args.limit) },
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "pointer_heatmap",
|
|
49
|
+
title: "2D pointer heatmap",
|
|
50
|
+
description: "Binned 2D pointer-position heatmap (screen-normalized).",
|
|
51
|
+
inputSchema: { since, until, bins, scene, source, session },
|
|
52
|
+
buildRequest: (args) => ({
|
|
53
|
+
path: "api/v1/heatmaps/pointer",
|
|
54
|
+
params: {
|
|
55
|
+
...range(args),
|
|
56
|
+
bins: num(args.bins),
|
|
57
|
+
scene: str(args.scene),
|
|
58
|
+
source: str(args.source),
|
|
59
|
+
session: str(args.session),
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "world_heatmap",
|
|
65
|
+
title: "3D world-space pointer heatmap",
|
|
66
|
+
description: "Voxelized world-space pointer heatmap.",
|
|
67
|
+
inputSchema: { since, until, cellSize, limit, scene, source },
|
|
68
|
+
buildRequest: (args) => ({
|
|
69
|
+
path: "api/v1/heatmaps/world",
|
|
70
|
+
params: {
|
|
71
|
+
...range(args),
|
|
72
|
+
cellSize: num(args.cellSize),
|
|
73
|
+
limit: num(args.limit),
|
|
74
|
+
scene: str(args.scene),
|
|
75
|
+
source: str(args.source),
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "camera_heatmap",
|
|
81
|
+
title: "View-direction heatmap",
|
|
82
|
+
description: "Camera view-direction distribution as spherical bins.",
|
|
83
|
+
inputSchema: { since, until, bins, scene, session },
|
|
84
|
+
buildRequest: (args) => ({
|
|
85
|
+
path: "api/v1/heatmaps/camera",
|
|
86
|
+
params: {
|
|
87
|
+
...range(args),
|
|
88
|
+
bins: num(args.bins),
|
|
89
|
+
scene: str(args.scene),
|
|
90
|
+
session: str(args.session),
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "click_rays",
|
|
96
|
+
title: "View-gated click rays",
|
|
97
|
+
description: "Clicks ASOF-joined to their nearest camera sample, per voxel and clicked mesh.",
|
|
98
|
+
inputSchema: { since, until, cellSize, limit, scene, source, session },
|
|
99
|
+
buildRequest: (args) => ({
|
|
100
|
+
path: "api/v1/heatmaps/click-rays",
|
|
101
|
+
params: {
|
|
102
|
+
...range(args),
|
|
103
|
+
cellSize: num(args.cellSize),
|
|
104
|
+
limit: num(args.limit),
|
|
105
|
+
scene: str(args.scene),
|
|
106
|
+
source: str(args.source),
|
|
107
|
+
session: str(args.session),
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "flow_links",
|
|
113
|
+
title: "Gaze→mesh flow links",
|
|
114
|
+
description: "Aggregate links from camera-direction bins to clicked meshes.",
|
|
115
|
+
inputSchema: { since, until, bins, limit, scene, session },
|
|
116
|
+
buildRequest: (args) => ({
|
|
117
|
+
path: "api/v1/heatmaps/flow",
|
|
118
|
+
params: {
|
|
119
|
+
...range(args),
|
|
120
|
+
bins: num(args.bins),
|
|
121
|
+
limit: num(args.limit),
|
|
122
|
+
scene: str(args.scene),
|
|
123
|
+
session: str(args.session),
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "top_meshes",
|
|
129
|
+
title: "Most-interacted meshes",
|
|
130
|
+
description: "Meshes ranked by interaction count.",
|
|
131
|
+
inputSchema: { since, until, limit, session },
|
|
132
|
+
buildRequest: (args) => ({
|
|
133
|
+
path: "api/v1/meshes/top",
|
|
134
|
+
params: { ...range(args), limit: num(args.limit), session: str(args.session) },
|
|
135
|
+
}),
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "perf_summary",
|
|
139
|
+
title: "Rendering performance summary",
|
|
140
|
+
description: "Sample count and avg/min/p50 FPS over the range.",
|
|
141
|
+
inputSchema: { since, until, session },
|
|
142
|
+
buildRequest: (args) => ({
|
|
143
|
+
path: "api/v1/perf",
|
|
144
|
+
params: { ...range(args), session: str(args.session) },
|
|
145
|
+
}),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "list_scenes",
|
|
149
|
+
title: "List active scenes",
|
|
150
|
+
description: "Distinct developer-assigned scenes with activity.",
|
|
151
|
+
inputSchema: { since, until, limit },
|
|
152
|
+
buildRequest: (args) => ({
|
|
153
|
+
path: "api/v1/scenes",
|
|
154
|
+
params: { ...range(args), limit: num(args.limit) },
|
|
155
|
+
}),
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "timeseries",
|
|
159
|
+
title: "Event-volume time series",
|
|
160
|
+
description: "Event-volume buckets over time, with average FPS per bucket.",
|
|
161
|
+
inputSchema: { since, until, interval, scene, type: eventType },
|
|
162
|
+
buildRequest: (args) => ({
|
|
163
|
+
path: "api/v1/timeseries",
|
|
164
|
+
params: {
|
|
165
|
+
...range(args),
|
|
166
|
+
interval: num(args.interval),
|
|
167
|
+
scene: str(args.scene),
|
|
168
|
+
type: str(args.type),
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "event_counts",
|
|
174
|
+
title: "Per-event-type counts",
|
|
175
|
+
description: "Counts per event type over the range (scene-health panel).",
|
|
176
|
+
inputSchema: { since, until, scene },
|
|
177
|
+
buildRequest: (args) => ({
|
|
178
|
+
path: "api/v1/event-counts",
|
|
179
|
+
params: { ...range(args), scene: str(args.scene) },
|
|
180
|
+
}),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "session_meta",
|
|
184
|
+
title: "Session descriptor",
|
|
185
|
+
description: "Coarse descriptor for one session (device/scene/user). No raw event stream.",
|
|
186
|
+
inputSchema: { sessionId: z.string().min(1).describe("The session id to describe.") },
|
|
187
|
+
buildRequest: (args) => ({
|
|
188
|
+
path: `api/v1/sessions/${encodeURIComponent(str(args.sessionId) ?? "")}/meta`,
|
|
189
|
+
params: {},
|
|
190
|
+
}),
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "scene_representation",
|
|
194
|
+
title: "Scene representation",
|
|
195
|
+
description: "Registered proxy geometry (bounds/meshes) for one scene, if any.",
|
|
196
|
+
inputSchema: { sceneId: z.string().min(1).describe("The scene id to fetch.") },
|
|
197
|
+
buildRequest: (args) => ({
|
|
198
|
+
path: `api/v1/scenes/${encodeURIComponent(str(args.sceneId) ?? "")}/representation`,
|
|
199
|
+
params: {},
|
|
200
|
+
}),
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,MAAM,GAAG,GAAG,CAAC,CAAU,EAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AACxF,MAAM,GAAG,GAAG,CAAC,CAAU,EAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE;QAC9E,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACvB,IAAI,EAAE,iBAAiB,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,iBAAiB;YACnF,MAAM,EAAE,EAAE;SACX,CAAC;KACH;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @uptimizr/mcp
|
|
2
|
+
|
|
3
|
+
> A read-only Model Context Protocol server over an Uptimizr collector's query API. Lets an agent
|
|
4
|
+
> query a consumer's own 3D analytics; thin wrapper, GET-only, no data egress.
|
|
5
|
+
|
|
6
|
+
## Docs
|
|
7
|
+
|
|
8
|
+
- [Package reference](./README.md): run instructions, MCP client config, the full tool table, programmatic use.
|
|
9
|
+
- [Agent guide](./AGENTS.md): rules and tool catalog for AI agents.
|
|
10
|
+
- [Integration & API reference](https://github.com/RaananW/Uptimizr/blob/main/docs/integration.md): the underlying query endpoints.
|
|
11
|
+
- [Architecture Decision Records](https://github.com/RaananW/Uptimizr/tree/main/docs/adr): privacy model (0003), thin backends (0005), consumer-facing agents (0017).
|
|
12
|
+
|
|
13
|
+
## Key exports
|
|
14
|
+
|
|
15
|
+
- `createMcpServer(client)` — build the read-only MCP server.
|
|
16
|
+
- `createCollectorClient(config)` — the thin GET-only collector client.
|
|
17
|
+
- `readMcpConfig()` — read `UPTIMIZR_COLLECTOR_URL` + `UPTIMIZR_API_KEY` from the environment.
|
|
18
|
+
- `readTools` — the read-only tool catalog (one entry per query endpoint).
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uptimizr/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Read-only Model Context Protocol (MCP) server over an Uptimizr collector's query API — let an agent ask questions of your own 3D analytics, on your own infrastructure.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"uptimizr",
|
|
7
|
+
"analytics",
|
|
8
|
+
"mcp",
|
|
9
|
+
"model-context-protocol",
|
|
10
|
+
"ai",
|
|
11
|
+
"agent",
|
|
12
|
+
"3d"
|
|
13
|
+
],
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/RaananW/Uptimizr.git",
|
|
18
|
+
"directory": "oss/packages/mcp"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/RaananW/Uptimizr/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/RaananW/Uptimizr/tree/main/oss/packages/mcp#readme",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"module": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"bin": {
|
|
38
|
+
"uptimizr-mcp": "./dist/bin.js"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"AGENTS.md",
|
|
45
|
+
"llms.txt"
|
|
46
|
+
],
|
|
47
|
+
"sideEffects": false,
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
50
|
+
"zod": "^4.1.5"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^22.19.21",
|
|
54
|
+
"tsx": "^4.22.4",
|
|
55
|
+
"vitest": "^4.1.9"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=22"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc -p tsconfig.json",
|
|
62
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
63
|
+
"serve": "tsx src/bin.ts",
|
|
64
|
+
"start": "node dist/bin.js",
|
|
65
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"lint": "eslint .",
|
|
68
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
69
|
+
}
|
|
70
|
+
}
|