@rifts_to/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/LICENSE +201 -0
- package/NOTICE +8 -0
- package/README.md +124 -0
- package/dist/client.d.ts +129 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +161 -0
- package/dist/client.js.map +1 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +31 -0
- package/dist/server.js.map +1 -0
- package/dist/stdio.d.ts +17 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +53 -0
- package/dist/stdio.js.map +1 -0
- package/dist/tools.d.ts +30 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +246 -0
- package/dist/tools.js.map +1 -0
- package/dist/worker.d.ts +39 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +247 -0
- package/dist/worker.js.map +1 -0
- package/package.json +64 -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 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 RIFTS TO, LLC
|
|
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/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# rifts.to MCP server
|
|
2
|
+
|
|
3
|
+
[](https://github.com/riftsto/mcp/actions/workflows/ci.yml)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
An MCP server for [rifts.to](https://rifts.to), a live audience survey tool. It lets an AI client create a survey, list the surveys on your account, read back the results, and close a survey when you're done collecting responses.
|
|
7
|
+
|
|
8
|
+
Point a poll at your audience by asking your AI client to do it, and check the answers the same way, without leaving the chat.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
claude mcp add --transport http rifts https://mcp.rifts.to/mcp
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
That is the hosted server, and it signs you in through the browser. [Running your
|
|
15
|
+
own copy](#run-it-yourself) is supported too.
|
|
16
|
+
|
|
17
|
+
## Tools
|
|
18
|
+
|
|
19
|
+
- **`create_survey`**: creates a survey from a title and a list of questions and returns its public link and admin link. Optionally accepts a custom slug.
|
|
20
|
+
- **`list_surveys`**: lists the surveys on your account, with title, status, and response count. Admin links are included only if you ask for them, so a routine listing doesn't hand a model a pile of credentials it didn't need.
|
|
21
|
+
- **`get_survey_results`**: returns a survey's questions and every response.
|
|
22
|
+
- **`close_survey`**: stops a survey from accepting new responses. Reopening, retitling, and editing questions stay in the rifts.to admin dashboard, not here.
|
|
23
|
+
|
|
24
|
+
## Hosted, with sign-in
|
|
25
|
+
|
|
26
|
+
rifts.to runs this server at `https://mcp.rifts.to/mcp`. Add it as a remote MCP
|
|
27
|
+
server and your client walks an OAuth flow: it registers itself, sends you to
|
|
28
|
+
rifts.to to approve, and stores the token it gets back. Nothing to paste, and
|
|
29
|
+
you can revoke it later under "Connected applications" on `/account`.
|
|
30
|
+
|
|
31
|
+
In Claude Desktop, add it as a custom connector with that same URL.
|
|
32
|
+
|
|
33
|
+
Running it yourself, with a token you paste in, is the rest of this document.
|
|
34
|
+
|
|
35
|
+
## Run it yourself
|
|
36
|
+
|
|
37
|
+
Not on npm yet, so clone this repository and build:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/riftsto/mcp.git rifts-mcp
|
|
41
|
+
cd rifts-mcp
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
node dist/stdio.js
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
When `@rifts_to/mcp` is published, `npx @rifts_to/mcp` will replace all of that,
|
|
48
|
+
and every `node /path/to/...` below becomes `npx -y @rifts_to/mcp`.
|
|
49
|
+
|
|
50
|
+
Releases are published from CI with [npm provenance](https://docs.npmjs.com/generating-provenance-statements),
|
|
51
|
+
so each version on npm carries a signed attestation linking it to the commit
|
|
52
|
+
and workflow run that built it. Cutting a GitHub release triggers the publish;
|
|
53
|
+
the tag has to match the version in `package.json` or the run fails.
|
|
54
|
+
|
|
55
|
+
The server reads its configuration from two environment variables:
|
|
56
|
+
|
|
57
|
+
- `RIFTS_TOKEN` (required): your personal access token.
|
|
58
|
+
- `RIFTS_API_URL` (optional): defaults to `https://rifts.to`. Set this only if you're pointing the server at a different rifts.to deployment.
|
|
59
|
+
|
|
60
|
+
### Claude Desktop
|
|
61
|
+
|
|
62
|
+
Add this to your `claude_desktop_config.json`, using the absolute path to your
|
|
63
|
+
build:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"rifts": {
|
|
69
|
+
"command": "node",
|
|
70
|
+
"args": ["/path/to/rifts-mcp/dist/stdio.js"],
|
|
71
|
+
"env": {
|
|
72
|
+
"RIFTS_TOKEN": "your-token-here"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Claude Code
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
claude mcp add rifts -e RIFTS_TOKEN=your-token-here -- node /path/to/rifts-mcp/dist/stdio.js
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Add `-s user` to make it available in every project instead of just the
|
|
86
|
+
current one.
|
|
87
|
+
|
|
88
|
+
## Getting a token
|
|
89
|
+
|
|
90
|
+
1. Sign in at [rifts.to](https://rifts.to).
|
|
91
|
+
2. Go to `/account`.
|
|
92
|
+
3. Create a token under "API tokens."
|
|
93
|
+
|
|
94
|
+
Token creation requires an active subscription. The token is shown once, at creation time, so save it somewhere before you close the dialog. If you lose it, create a new one.
|
|
95
|
+
|
|
96
|
+
## Self-hosting
|
|
97
|
+
|
|
98
|
+
This server is stateless and holds no credentials of its own. Every request carries your `RIFTS_TOKEN` and goes straight to the rifts.to API; the server doesn't store it, cache it, or log it anywhere. Running your own copy, on your own machine or your own infrastructure, is a supported way to use it, and it still needs a token from a real rifts.to account with an active subscription. There's no separate self-hosting tier or discount; the token is what's paid for, not the server.
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install
|
|
104
|
+
npm test # vitest, drives the server over an in-memory transport
|
|
105
|
+
npm run typecheck
|
|
106
|
+
npm run build
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The tests connect a real MCP client to the server and call the tools against a
|
|
110
|
+
stub API, so a schema that rejects a valid question, or a result the SDK
|
|
111
|
+
refuses to serialize, fails in CI rather than in someone's chat window.
|
|
112
|
+
|
|
113
|
+
`src/server.ts` builds the server and is transport-free. `src/stdio.ts` and
|
|
114
|
+
`src/worker.ts` are the two entry points, and neither contains tool logic, so
|
|
115
|
+
the hosted and self-hosted paths cannot drift on what the tools do.
|
|
116
|
+
|
|
117
|
+
## Security
|
|
118
|
+
|
|
119
|
+
Token handling, what this server can reach, and how to report a vulnerability:
|
|
120
|
+
[SECURITY.md](./SECURITY.md).
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed client for rifts.to's public API (`/api/v1`).
|
|
3
|
+
*
|
|
4
|
+
* Plain `fetch`, no generated SDK and no retry layer. Two reasons: the same
|
|
5
|
+
* module has to run unchanged under Node (the stdio entry point) and under
|
|
6
|
+
* Cloudflare Workers (the hosted HTTP server), which rules out anything
|
|
7
|
+
* Node-specific; and a retry would be wrong on this surface anyway — three of
|
|
8
|
+
* the four calls are writes or rate-limited reads, and silently re-sending a
|
|
9
|
+
* `create_survey` that actually succeeded would leave a duplicate survey and
|
|
10
|
+
* hand the model the wrong link.
|
|
11
|
+
*
|
|
12
|
+
* This module reads no environment and holds no default token: the caller
|
|
13
|
+
* supplies both, so nothing here can pick up a credential by accident.
|
|
14
|
+
*/
|
|
15
|
+
/** Public rifts.to. Overridable so a self-hoster can point at their own deploy. */
|
|
16
|
+
export declare const DEFAULT_BASE_URL = "https://rifts.to";
|
|
17
|
+
export interface MultipleChoiceQuestionInput {
|
|
18
|
+
type: "multiple_choice";
|
|
19
|
+
text: string;
|
|
20
|
+
options: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface FreeTextQuestionInput {
|
|
23
|
+
type: "free_text";
|
|
24
|
+
text: string;
|
|
25
|
+
}
|
|
26
|
+
export interface RatingQuestionInput {
|
|
27
|
+
type: "rating";
|
|
28
|
+
text: string;
|
|
29
|
+
/** Always 1–10 — see the note on RATING_SCALE in tools.ts. */
|
|
30
|
+
scale: {
|
|
31
|
+
min: number;
|
|
32
|
+
max: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** A question as sent to the API. No `index`: the server reindexes on write. */
|
|
36
|
+
export type QuestionInput = MultipleChoiceQuestionInput | FreeTextQuestionInput | RatingQuestionInput;
|
|
37
|
+
/** A question as returned by the API, carrying the position answers are keyed by. */
|
|
38
|
+
export type Question = QuestionInput & {
|
|
39
|
+
index: number;
|
|
40
|
+
};
|
|
41
|
+
export interface SurveySummary {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
status: "open" | "closed";
|
|
45
|
+
created_at: string;
|
|
46
|
+
response_count: number;
|
|
47
|
+
url: string;
|
|
48
|
+
/** Present only when the listing was asked for with `include_admin`. */
|
|
49
|
+
admin_token?: string;
|
|
50
|
+
admin_url?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface CreatedSurvey {
|
|
53
|
+
id: string;
|
|
54
|
+
title: string;
|
|
55
|
+
url: string;
|
|
56
|
+
admin_token: string;
|
|
57
|
+
admin_url: string;
|
|
58
|
+
created_at: string;
|
|
59
|
+
}
|
|
60
|
+
export interface SurveyResponseRow {
|
|
61
|
+
id: string;
|
|
62
|
+
submitted_at: string;
|
|
63
|
+
/**
|
|
64
|
+
* Keyed by question index, as a string because that is what JSON does to a
|
|
65
|
+
* numeric key. The API deliberately carries no respondent identifier here and
|
|
66
|
+
* this client must not invent one.
|
|
67
|
+
*/
|
|
68
|
+
answers: Record<string, string | number | string[]>;
|
|
69
|
+
}
|
|
70
|
+
export interface SurveyResults {
|
|
71
|
+
id: string;
|
|
72
|
+
title: string;
|
|
73
|
+
/**
|
|
74
|
+
* Three values here, two on SurveySummary, and that is the API's shape rather
|
|
75
|
+
* than a mistake in this file: the results route reports getEffectiveStatus,
|
|
76
|
+
* which folds `expires_at` in, while the listing reports the stored column.
|
|
77
|
+
* A survey past its expiry therefore lists as "open" and reads as "expired".
|
|
78
|
+
*/
|
|
79
|
+
status: "open" | "closed" | "expired";
|
|
80
|
+
created_at: string;
|
|
81
|
+
expires_at: string | null;
|
|
82
|
+
url: string;
|
|
83
|
+
questions: Question[];
|
|
84
|
+
response_count: number;
|
|
85
|
+
responses: SurveyResponseRow[];
|
|
86
|
+
}
|
|
87
|
+
export interface CloseResult {
|
|
88
|
+
id: string;
|
|
89
|
+
status: "closed";
|
|
90
|
+
}
|
|
91
|
+
export interface CreateSurveyInput {
|
|
92
|
+
title: string;
|
|
93
|
+
questions: QuestionInput[];
|
|
94
|
+
/** Custom slug, e.g. `standup-mood`. Subscriber-only, and may already be taken. */
|
|
95
|
+
slug?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ListSurveysOptions {
|
|
98
|
+
includeAdmin?: boolean;
|
|
99
|
+
includeClosed?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A non-2xx from the API, already turned into something a person reading a
|
|
103
|
+
* chat transcript can act on. `status` and `code` are kept alongside the
|
|
104
|
+
* message so a caller can branch without parsing English.
|
|
105
|
+
*/
|
|
106
|
+
export declare class RiftsApiError extends Error {
|
|
107
|
+
readonly status: number;
|
|
108
|
+
readonly code: string | undefined;
|
|
109
|
+
constructor(message: string, status: number, code?: string);
|
|
110
|
+
}
|
|
111
|
+
export interface RiftsClientOptions {
|
|
112
|
+
/** Origin only, e.g. `https://rifts.to`. Paths are appended by this client. */
|
|
113
|
+
baseUrl?: string;
|
|
114
|
+
token: string;
|
|
115
|
+
/** Injectable for tests; defaults to the global `fetch` (Node 20+, Workers). */
|
|
116
|
+
fetchImpl?: typeof fetch;
|
|
117
|
+
}
|
|
118
|
+
export declare class RiftsClient {
|
|
119
|
+
private readonly baseUrl;
|
|
120
|
+
private readonly token;
|
|
121
|
+
private readonly fetchImpl;
|
|
122
|
+
constructor(options: RiftsClientOptions);
|
|
123
|
+
listSurveys(options?: ListSurveysOptions): Promise<SurveySummary[]>;
|
|
124
|
+
createSurvey(input: CreateSurveyInput): Promise<CreatedSurvey>;
|
|
125
|
+
getSurveyResults(id: string): Promise<SurveyResults>;
|
|
126
|
+
closeSurvey(id: string): Promise<CloseResult>;
|
|
127
|
+
private request;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;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,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIpD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;YAMrC,OAAO;CA0CtB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed client for rifts.to's public API (`/api/v1`).
|
|
3
|
+
*
|
|
4
|
+
* Plain `fetch`, no generated SDK and no retry layer. Two reasons: the same
|
|
5
|
+
* module has to run unchanged under Node (the stdio entry point) and under
|
|
6
|
+
* Cloudflare Workers (the hosted HTTP server), which rules out anything
|
|
7
|
+
* Node-specific; and a retry would be wrong on this surface anyway — three of
|
|
8
|
+
* the four calls are writes or rate-limited reads, and silently re-sending a
|
|
9
|
+
* `create_survey` that actually succeeded would leave a duplicate survey and
|
|
10
|
+
* hand the model the wrong link.
|
|
11
|
+
*
|
|
12
|
+
* This module reads no environment and holds no default token: the caller
|
|
13
|
+
* supplies both, so nothing here can pick up a credential by accident.
|
|
14
|
+
*/
|
|
15
|
+
/** Public rifts.to. Overridable so a self-hoster can point at their own deploy. */
|
|
16
|
+
export const DEFAULT_BASE_URL = "https://rifts.to";
|
|
17
|
+
/**
|
|
18
|
+
* A non-2xx from the API, already turned into something a person reading a
|
|
19
|
+
* chat transcript can act on. `status` and `code` are kept alongside the
|
|
20
|
+
* message so a caller can branch without parsing English.
|
|
21
|
+
*/
|
|
22
|
+
export class RiftsApiError extends Error {
|
|
23
|
+
status;
|
|
24
|
+
code;
|
|
25
|
+
constructor(message, status, code) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "RiftsApiError";
|
|
28
|
+
this.status = status;
|
|
29
|
+
this.code = code;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class RiftsClient {
|
|
33
|
+
baseUrl;
|
|
34
|
+
token;
|
|
35
|
+
fetchImpl;
|
|
36
|
+
constructor(options) {
|
|
37
|
+
// Trailing slashes are the classic way a config value produces `//api/v1`,
|
|
38
|
+
// which Cloudflare answers with a redirect the fetch then follows without
|
|
39
|
+
// the Authorization header.
|
|
40
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
41
|
+
this.token = options.token;
|
|
42
|
+
this.fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
43
|
+
}
|
|
44
|
+
async listSurveys(options = {}) {
|
|
45
|
+
const params = new URLSearchParams();
|
|
46
|
+
// Both are sent only when they differ from the API's own default, so a
|
|
47
|
+
// change of default on the server side is not silently pinned here.
|
|
48
|
+
if (options.includeAdmin)
|
|
49
|
+
params.set("include_admin", "1");
|
|
50
|
+
if (options.includeClosed === false)
|
|
51
|
+
params.set("include_closed", "0");
|
|
52
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
53
|
+
const body = await this.request("GET", `/api/v1/surveys${query}`);
|
|
54
|
+
return body.surveys;
|
|
55
|
+
}
|
|
56
|
+
async createSurvey(input) {
|
|
57
|
+
return this.request("POST", "/api/v1/surveys", input);
|
|
58
|
+
}
|
|
59
|
+
async getSurveyResults(id) {
|
|
60
|
+
return this.request("GET", `/api/v1/surveys/${encodeURIComponent(id)}`);
|
|
61
|
+
}
|
|
62
|
+
async closeSurvey(id) {
|
|
63
|
+
return this.request("PATCH", `/api/v1/surveys/${encodeURIComponent(id)}`, {
|
|
64
|
+
status: "closed",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async request(method, path, body) {
|
|
68
|
+
const url = `${this.baseUrl}${path}`;
|
|
69
|
+
const headers = {
|
|
70
|
+
// OAuth 2.1 and the MCP spec both forbid a token in a URI, and the API
|
|
71
|
+
// reads the header only. Never move this to a query parameter.
|
|
72
|
+
Authorization: `Bearer ${this.token}`,
|
|
73
|
+
Accept: "application/json",
|
|
74
|
+
};
|
|
75
|
+
if (body !== undefined)
|
|
76
|
+
headers["Content-Type"] = "application/json";
|
|
77
|
+
let response;
|
|
78
|
+
try {
|
|
79
|
+
response = await this.fetchImpl(url, {
|
|
80
|
+
method,
|
|
81
|
+
headers,
|
|
82
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (cause) {
|
|
86
|
+
// A bare `TypeError: fetch failed` in a chat window is unactionable. The
|
|
87
|
+
// base URL is the thing a self-hoster typically got wrong, so name it.
|
|
88
|
+
throw new Error(`could not reach the rifts.to API at ${this.baseUrl}: ${errorMessage(cause)}`, { cause });
|
|
89
|
+
}
|
|
90
|
+
if (!response.ok)
|
|
91
|
+
throw await toApiError(response);
|
|
92
|
+
// 204 has no body; nothing on /api/v1 returns one today, but a client that
|
|
93
|
+
// assumes otherwise fails with a JSON parse error rather than a clear one.
|
|
94
|
+
if (response.status === 204)
|
|
95
|
+
return undefined;
|
|
96
|
+
try {
|
|
97
|
+
return (await response.json());
|
|
98
|
+
}
|
|
99
|
+
catch (cause) {
|
|
100
|
+
throw new Error(`the rifts.to API returned a ${response.status} that was not JSON`, { cause });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Turns a non-2xx into a message that says what to do about it. The four
|
|
106
|
+
* statuses below are the ones `guardApiV1` and the route handlers produce
|
|
107
|
+
* deliberately; everything else falls through to the generic branch carrying
|
|
108
|
+
* the status and whatever the body's `error` field said.
|
|
109
|
+
*/
|
|
110
|
+
async function toApiError(response) {
|
|
111
|
+
const { error, code } = await readErrorBody(response);
|
|
112
|
+
switch (response.status) {
|
|
113
|
+
case 401:
|
|
114
|
+
return new RiftsApiError("rifts.to rejected the token (401). Check RIFTS_TOKEN: it may be mistyped, revoked, or from a different rifts.to deployment.", 401, code);
|
|
115
|
+
case 403:
|
|
116
|
+
// Every paid route on rifts.to answers with this exact code, and
|
|
117
|
+
// entitlement is re-checked on every request — so this is as likely to
|
|
118
|
+
// mean "the subscription lapsed today" as "there never was one".
|
|
119
|
+
if (code === "entitlement_required") {
|
|
120
|
+
return new RiftsApiError("an active rifts.to subscription is required to use the API (403). Check the subscription at https://rifts.to/en/account/billing.", 403, code);
|
|
121
|
+
}
|
|
122
|
+
return new RiftsApiError(`rifts.to refused the request (403)${suffix(error)}`, 403, code);
|
|
123
|
+
case 404:
|
|
124
|
+
// The API answers 404 for a survey that belongs to someone else as well
|
|
125
|
+
// as one that does not exist, on purpose, so this message must not claim
|
|
126
|
+
// to know which it was.
|
|
127
|
+
return new RiftsApiError("no such survey (or not yours) (404)", 404, code);
|
|
128
|
+
case 429: {
|
|
129
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
130
|
+
const wait = retryAfter ? ` Retry after ${retryAfter}s.` : "";
|
|
131
|
+
return new RiftsApiError(`rate limited by rifts.to (429).${wait}`, 429, code);
|
|
132
|
+
}
|
|
133
|
+
default:
|
|
134
|
+
return new RiftsApiError(`rifts.to API error (${response.status})${suffix(error)}`, response.status, code);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function readErrorBody(response) {
|
|
138
|
+
// A gateway or the edge can answer with HTML, so parsing must never be what
|
|
139
|
+
// turns a 502 into an unrelated crash.
|
|
140
|
+
try {
|
|
141
|
+
const text = await response.text();
|
|
142
|
+
if (!text)
|
|
143
|
+
return {};
|
|
144
|
+
const parsed = JSON.parse(text);
|
|
145
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
146
|
+
return {};
|
|
147
|
+
const { error, code } = parsed;
|
|
148
|
+
return {
|
|
149
|
+
...(typeof error === "string" ? { error } : {}),
|
|
150
|
+
...(typeof code === "string" ? { code } : {}),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const suffix = (error) => (error ? `: ${error}` : "");
|
|
158
|
+
function errorMessage(value) {
|
|
159
|
+
return value instanceof Error ? value.message : String(value);
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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AC,CAAC,CAAC,EAAE,CAAC;YAC/C,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE/D,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the MCP server. Transport-free on purpose: `stdio.ts` connects a
|
|
3
|
+
* stdio transport to it, and the hosted deployment will connect an HTTP one to
|
|
4
|
+
* the same object, so neither entry point can drift on which tools exist or
|
|
5
|
+
* how they behave.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import type { RiftsClient } from "./client.js";
|
|
9
|
+
/**
|
|
10
|
+
* The protocol identifier, not the brand. Clients namespace tool names with it
|
|
11
|
+
* (`mcp__rifts__create_survey`), so it stays a bare slug: a dot in here would
|
|
12
|
+
* ride along into every tool name. `title` below is where "rifts.to" belongs.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SERVER_NAME = "rifts";
|
|
15
|
+
/** Kept in step with package.json by hand; nothing imports JSON at runtime. */
|
|
16
|
+
export declare const SERVER_VERSION = "0.1.0";
|
|
17
|
+
export declare function createServer(client: RiftsClient): McpServer;
|
|
18
|
+
export { RiftsClient, RiftsApiError, DEFAULT_BASE_URL } from "./client.js";
|
|
19
|
+
export type { CreateSurveyInput, CreatedSurvey, Question, QuestionInput, RiftsClientOptions, SurveyResults, SurveySummary, } from "./client.js";
|
|
20
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,+EAA+E;AAC/E,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAkB3D;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC"}
|