riveter-mcp-server 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -7
- package/dist/http.d.ts +2 -0
- package/dist/http.js +151 -0
- package/dist/http.js.map +1 -0
- package/dist/index.js +7 -275
- package/dist/index.js.map +1 -1
- package/dist/openapi-parser.d.ts +2 -0
- package/dist/openapi-parser.js +4 -0
- package/dist/openapi-parser.js.map +1 -1
- package/dist/server.d.ts +15 -0
- package/dist/server.js +253 -0
- package/dist/server.js.map +1 -0
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -4,13 +4,42 @@ An [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that c
|
|
|
4
4
|
|
|
5
5
|
Tools are generated dynamically from Riveter's [OpenAPI spec](https://docs.riveterhq.com/openapi.yaml), so they stay up to date automatically.
|
|
6
6
|
|
|
7
|
+
Two ways to connect:
|
|
8
|
+
|
|
9
|
+
- **Hosted** — `https://mcp.riveterhq.com/mcp`. Nothing to install. Works from claude.ai, Claude Desktop, Cowork, Claude mobile, ChatGPT, Claude Code, and Cursor.
|
|
10
|
+
- **Local (`npx`)** — this npm package, run on your machine over stdio. Use it when your client cannot reach remote servers.
|
|
11
|
+
|
|
7
12
|
## Setup
|
|
8
13
|
|
|
9
|
-
###
|
|
14
|
+
### 1a. Hosted server (no API key needed up front)
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
Add `https://mcp.riveterhq.com/mcp` as a custom connector and click Connect. A browser window opens on Riveter: sign in and click **Allow**. Riveter creates an API key for that connection; it is listed in [Settings → API keys](https://app.riveterhq.com/settings/api), and revoking it disconnects the client.
|
|
17
|
+
|
|
18
|
+
**Claude Code:**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
claude mcp add --transport http riveter https://mcp.riveterhq.com/mcp
|
|
22
|
+
```
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
Then run `/mcp` and choose Authenticate.
|
|
25
|
+
|
|
26
|
+
**Cursor:**
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"riveter": {
|
|
32
|
+
"url": "https://mcp.riveterhq.com/mcp"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If the client cannot open a browser, pass a key as a header instead: `Authorization: Bearer sk_riv_your_key_here` (Claude Code `--header "Authorization: Bearer sk_riv_..."`, Cursor `"headers": { "Authorization": "Bearer sk_riv_..." }`).
|
|
39
|
+
|
|
40
|
+
### 1b. Local server (npx)
|
|
41
|
+
|
|
42
|
+
Get a Riveter API key at [app.riveterhq.com/settings/api](https://app.riveterhq.com/settings/api).
|
|
14
43
|
|
|
15
44
|
**Claude Desktop** — open the config file:
|
|
16
45
|
|
|
@@ -49,21 +78,35 @@ codex mcp add riveter --env RIVETER_API_KEY=sk_riv_your_key_here -- npx -y rivet
|
|
|
49
78
|
|
|
50
79
|
## Environment variables
|
|
51
80
|
|
|
81
|
+
Local (stdio) server — `dist/index.js`:
|
|
82
|
+
|
|
52
83
|
| Variable | Required | Default | Description |
|
|
53
84
|
| ---------------------- | -------- | ----------------------------------------- | -------------------- |
|
|
54
85
|
| `RIVETER_API_KEY` | Yes | — | Your Riveter API key |
|
|
55
86
|
| `RIVETER_API_BASE_URL` | No | `https://api.riveterhq.com/v1` | API base URL |
|
|
56
87
|
| `RIVETER_OPENAPI_URL` | No | `https://docs.riveterhq.com/openapi.yaml` | OpenAPI spec URL |
|
|
57
88
|
|
|
89
|
+
Hosted (Streamable HTTP) server — `dist/http.js`, deployed by Riveter:
|
|
90
|
+
|
|
91
|
+
| Variable | Default | Description |
|
|
92
|
+
| -------------------------- | ---------------------------------- | -------------------------------------------------------------------- |
|
|
93
|
+
| `PORT` | `8080` | Listen port |
|
|
94
|
+
| `MCP_PUBLIC_URL` | `https://mcp.riveterhq.com/mcp` | Public URL, exactly as users enter it (RFC 9728 `resource`) |
|
|
95
|
+
| `OAUTH_ISSUER_URL` | `https://app.riveterhq.com` | Authorization server advertised in the protected resource metadata |
|
|
96
|
+
| `SPEC_REFRESH_INTERVAL_MS` | `600000` | How often the spec is re-fetched; `0` disables |
|
|
97
|
+
| `RIVETER_API_BASE_URL`, `RIVETER_OPENAPI_URL` | as above | |
|
|
98
|
+
|
|
99
|
+
The hosted server holds no API key. It forwards the caller's `Authorization: Bearer ...` header to the API on every call and answers `401` with a `WWW-Authenticate` challenge when the header is missing.
|
|
100
|
+
|
|
58
101
|
## How it works
|
|
59
102
|
|
|
60
103
|
On startup, the server:
|
|
61
104
|
|
|
62
105
|
1. Fetches the OpenAPI spec from `docs.riveterhq.com/openapi.yaml`
|
|
63
|
-
2. Parses each endpoint into an MCP tool with typed parameters
|
|
64
|
-
3. Serves the tools over stdio
|
|
106
|
+
2. Parses each endpoint into an MCP tool with typed parameters and annotations (`readOnlyHint` from `GET`, `destructiveHint` from `DELETE` or the spec's `x-mcp-destructive`)
|
|
107
|
+
3. Serves the tools over stdio (local) or Streamable HTTP (hosted)
|
|
65
108
|
|
|
66
|
-
When the API docs are updated, the
|
|
109
|
+
When the API docs are updated, the local server picks up the changes the next time your assistant launches, and the hosted server re-fetches the spec every 10 minutes — no rebuild or republish needed.
|
|
67
110
|
|
|
68
111
|
## Development
|
|
69
112
|
|
|
@@ -73,7 +116,9 @@ This package lives in the `riveter` monorepo under `mcp-server/`. From the repo
|
|
|
73
116
|
pnpm --filter riveter-mcp-server test # build + unit + e2e + spec-contract tests
|
|
74
117
|
```
|
|
75
118
|
|
|
76
|
-
The spec-contract tests parse the repo's real `public/api_docs/openapi.yaml` (and the legacy spec), so a spec change that would break tool generation fails CI. To publish: bump the version in `package.json`, `server.json`, and `src/
|
|
119
|
+
The spec-contract tests parse the repo's real `public/api_docs/openapi.yaml` (and the legacy spec), so a spec change that would break tool generation fails CI. To publish: bump the version in `package.json`, `server.json`, and `src/server.ts`, then run `pnpm publish` from `mcp-server/`.
|
|
120
|
+
|
|
121
|
+
Run the hosted server locally with `pnpm dev:http` (defaults to port 8080; set `MCP_PUBLIC_URL=http://localhost:8080/mcp`). The hosted service is deployed from `Dockerfile` by Render (`mcp-server` in the root `render.yaml`).
|
|
77
122
|
|
|
78
123
|
## Support
|
|
79
124
|
|
package/dist/http.d.ts
ADDED
package/dist/http.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Hosted entrypoint (mcp.riveterhq.com). Same tools as the stdio server, served
|
|
3
|
+
// over Streamable HTTP so cloud MCP clients (claude.ai, Cowork, ChatGPT) can
|
|
4
|
+
// reach it. Stateless: every request builds a throwaway McpServer bound to the
|
|
5
|
+
// caller's bearer token, which is forwarded verbatim to the Riveter API.
|
|
6
|
+
import { createServer } from "node:http";
|
|
7
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
8
|
+
import { buildMcpServer, fetchAndParseSpec, DEFAULT_API_BASE_URL, DEFAULT_OPENAPI_SPEC_URL, SERVER_VERSION, } from "./server.js";
|
|
9
|
+
const PORT = Number(process.env.PORT || 8080);
|
|
10
|
+
const OPENAPI_SPEC_URL = process.env.RIVETER_OPENAPI_URL || DEFAULT_OPENAPI_SPEC_URL;
|
|
11
|
+
const API_BASE_URL = process.env.RIVETER_API_BASE_URL || DEFAULT_API_BASE_URL;
|
|
12
|
+
// Must match the URL users paste into their MCP client exactly (RFC 9728
|
|
13
|
+
// `resource`), path included.
|
|
14
|
+
const MCP_PUBLIC_URL = process.env.MCP_PUBLIC_URL || "https://mcp.riveterhq.com/mcp";
|
|
15
|
+
const OAUTH_ISSUER_URL = process.env.OAUTH_ISSUER_URL || "https://app.riveterhq.com";
|
|
16
|
+
// The stdio server re-reads the spec on every client restart; the hosted one
|
|
17
|
+
// runs for weeks, so it re-fetches on a timer to keep the "spec change = tool
|
|
18
|
+
// change, no redeploy" property.
|
|
19
|
+
const SPEC_REFRESH_INTERVAL_MS = Number(process.env.SPEC_REFRESH_INTERVAL_MS || 10 * 60 * 1000);
|
|
20
|
+
const mcpPublicUrl = new URL(MCP_PUBLIC_URL);
|
|
21
|
+
const MCP_PATH = mcpPublicUrl.pathname;
|
|
22
|
+
const PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource";
|
|
23
|
+
const PROTECTED_RESOURCE_METADATA_URL = `${mcpPublicUrl.origin}${PROTECTED_RESOURCE_METADATA_PATH}${MCP_PATH}`;
|
|
24
|
+
let parsedSpec;
|
|
25
|
+
function sendJson(res, status, body, headers = {}) {
|
|
26
|
+
res.writeHead(status, { "Content-Type": "application/json", ...headers });
|
|
27
|
+
res.end(JSON.stringify(body));
|
|
28
|
+
}
|
|
29
|
+
function protectedResourceMetadata() {
|
|
30
|
+
return {
|
|
31
|
+
resource: MCP_PUBLIC_URL,
|
|
32
|
+
authorization_servers: [OAUTH_ISSUER_URL],
|
|
33
|
+
bearer_methods_supported: ["header"],
|
|
34
|
+
scopes_supported: ["api"],
|
|
35
|
+
resource_name: "Riveter",
|
|
36
|
+
resource_documentation: "https://docs.riveterhq.com",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function extractBearerToken(req) {
|
|
40
|
+
const header = req.headers.authorization;
|
|
41
|
+
if (!header)
|
|
42
|
+
return null;
|
|
43
|
+
const match = header.match(/^Bearer\s+(.+)$/i);
|
|
44
|
+
return match ? match[1].trim() : null;
|
|
45
|
+
}
|
|
46
|
+
function respondUnauthorized(res) {
|
|
47
|
+
sendJson(res, 401, {
|
|
48
|
+
error: "unauthorized",
|
|
49
|
+
error_description: "Provide a Riveter API key as `Authorization: Bearer sk_riv_...` or connect through OAuth.",
|
|
50
|
+
}, { "WWW-Authenticate": `Bearer resource_metadata="${PROTECTED_RESOURCE_METADATA_URL}", scope="api"` });
|
|
51
|
+
}
|
|
52
|
+
// Browsers send Origin; MCP clients (Anthropic, OpenAI) do not. Rejecting a
|
|
53
|
+
// foreign Origin blocks DNS-rebinding style calls from a web page.
|
|
54
|
+
function originAllowed(req) {
|
|
55
|
+
const origin = req.headers.origin;
|
|
56
|
+
if (!origin)
|
|
57
|
+
return true;
|
|
58
|
+
try {
|
|
59
|
+
return new URL(origin).host === mcpPublicUrl.host;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function handleMcpRequest(req, res) {
|
|
66
|
+
if (!originAllowed(req)) {
|
|
67
|
+
sendJson(res, 403, { error: "forbidden", error_description: "Origin not allowed" });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const bearerToken = extractBearerToken(req);
|
|
71
|
+
if (!bearerToken) {
|
|
72
|
+
respondUnauthorized(res);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const server = buildMcpServer({ parsedSpec, apiBaseUrl: API_BASE_URL, bearerToken });
|
|
76
|
+
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
|
|
77
|
+
res.on("close", () => {
|
|
78
|
+
void transport.close();
|
|
79
|
+
void server.close();
|
|
80
|
+
});
|
|
81
|
+
await server.connect(transport);
|
|
82
|
+
await transport.handleRequest(req, res);
|
|
83
|
+
}
|
|
84
|
+
function isProtectedResourceMetadataPath(pathname) {
|
|
85
|
+
return (pathname === PROTECTED_RESOURCE_METADATA_PATH ||
|
|
86
|
+
pathname === `${PROTECTED_RESOURCE_METADATA_PATH}/` ||
|
|
87
|
+
pathname === `${PROTECTED_RESOURCE_METADATA_PATH}${MCP_PATH}`);
|
|
88
|
+
}
|
|
89
|
+
async function route(req, res) {
|
|
90
|
+
const pathname = new URL(req.url || "/", mcpPublicUrl.origin).pathname;
|
|
91
|
+
if (pathname === "/healthz") {
|
|
92
|
+
sendJson(res, 200, { status: "ok", version: SERVER_VERSION, tools: parsedSpec.operations.length });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (isProtectedResourceMetadataPath(pathname)) {
|
|
96
|
+
sendJson(res, 200, protectedResourceMetadata());
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (pathname === MCP_PATH) {
|
|
100
|
+
await handleMcpRequest(req, res);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
sendJson(res, 404, { error: "not_found" });
|
|
104
|
+
}
|
|
105
|
+
async function refreshSpec() {
|
|
106
|
+
try {
|
|
107
|
+
parsedSpec = await fetchAndParseSpec(OPENAPI_SPEC_URL);
|
|
108
|
+
console.error(`riveter-mcp-server: loaded ${parsedSpec.operations.length} tools from ${OPENAPI_SPEC_URL}`);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
console.error(`riveter-mcp-server: spec refresh failed, keeping previous spec: ${err}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async function main() {
|
|
115
|
+
try {
|
|
116
|
+
parsedSpec = await fetchAndParseSpec(OPENAPI_SPEC_URL);
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
console.error(`Failed to fetch OpenAPI spec: ${err}`);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
console.error(`riveter-mcp-server: loaded ${parsedSpec.operations.length} tools from ${OPENAPI_SPEC_URL}`);
|
|
123
|
+
if (SPEC_REFRESH_INTERVAL_MS > 0) {
|
|
124
|
+
setInterval(() => void refreshSpec(), SPEC_REFRESH_INTERVAL_MS).unref();
|
|
125
|
+
}
|
|
126
|
+
const httpServer = createServer((req, res) => {
|
|
127
|
+
route(req, res).catch((err) => {
|
|
128
|
+
console.error("riveter-mcp-server: request failed:", err);
|
|
129
|
+
if (!res.headersSent) {
|
|
130
|
+
sendJson(res, 500, { error: "internal_error" });
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
res.end();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
const shutdown = () => {
|
|
138
|
+
httpServer.close(() => process.exit(0));
|
|
139
|
+
setTimeout(() => process.exit(0), 10_000).unref();
|
|
140
|
+
};
|
|
141
|
+
process.on("SIGTERM", shutdown);
|
|
142
|
+
process.on("SIGINT", shutdown);
|
|
143
|
+
httpServer.listen(PORT, () => {
|
|
144
|
+
console.error(`riveter-mcp-server v${SERVER_VERSION} listening on :${PORT} (public URL ${MCP_PUBLIC_URL})`);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
main().catch((err) => {
|
|
148
|
+
console.error("Fatal error:", err);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
});
|
|
151
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";AAEA,gFAAgF;AAChF,6EAA6E;AAC7E,+EAA+E;AAC/E,yEAAyE;AAEzE,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAA;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAA;AAElG,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,GACf,MAAM,aAAa,CAAA;AAEpB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAA;AAC7C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,wBAAwB,CAAA;AACpF,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,oBAAoB,CAAA;AAC7E,yEAAyE;AACzE,8BAA8B;AAC9B,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,+BAA+B,CAAA;AACpF,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,2BAA2B,CAAA;AACpF,6EAA6E;AAC7E,8EAA8E;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QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACvC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAA;IACnD,CAAC,CAAA;IACD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAE9B,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QAC3B,OAAO,CAAC,KAAK,CAAC,uBAAuB,cAAc,kBAAkB,IAAI,gBAAgB,cAAc,GAAG,CAAC,CAAA;IAC7G,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;IAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,292 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const API_BASE_URL = process.env.RIVETER_API_BASE_URL || "https://api.riveterhq.com/v1";
|
|
3
|
+
import { buildMcpServer, fetchAndParseSpec, DEFAULT_API_BASE_URL, DEFAULT_OPENAPI_SPEC_URL, } from "./server.js";
|
|
4
|
+
const OPENAPI_SPEC_URL = process.env.RIVETER_OPENAPI_URL || DEFAULT_OPENAPI_SPEC_URL;
|
|
5
|
+
const API_BASE_URL = process.env.RIVETER_API_BASE_URL || DEFAULT_API_BASE_URL;
|
|
8
6
|
const API_KEY = process.env.RIVETER_API_KEY || "";
|
|
9
|
-
async function fetchSpec() {
|
|
10
|
-
const res = await fetch(OPENAPI_SPEC_URL);
|
|
11
|
-
if (!res.ok) {
|
|
12
|
-
throw new Error(`Failed to fetch OpenAPI spec from ${OPENAPI_SPEC_URL}: ${res.status}`);
|
|
13
|
-
}
|
|
14
|
-
return res.text();
|
|
15
|
-
}
|
|
16
|
-
async function callApi(method, path, queryParams, body, headerParams) {
|
|
17
|
-
const url = new URL(`${API_BASE_URL}${path}`);
|
|
18
|
-
if (queryParams) {
|
|
19
|
-
for (const [key, value] of Object.entries(queryParams)) {
|
|
20
|
-
if (value !== undefined && value !== "") {
|
|
21
|
-
url.searchParams.set(key, value);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const headers = {
|
|
26
|
-
Authorization: `Bearer ${API_KEY}`,
|
|
27
|
-
"Content-Type": "application/json",
|
|
28
|
-
Accept: "application/json",
|
|
29
|
-
...headerParams,
|
|
30
|
-
};
|
|
31
|
-
const fetchOptions = { method: method.toUpperCase(), headers };
|
|
32
|
-
if (body && (method === "post" || method === "put" || method === "patch")) {
|
|
33
|
-
fetchOptions.body = JSON.stringify(body);
|
|
34
|
-
}
|
|
35
|
-
const res = await fetch(url.toString(), fetchOptions);
|
|
36
|
-
const text = await res.text();
|
|
37
|
-
let data;
|
|
38
|
-
try {
|
|
39
|
-
data = JSON.parse(text);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
data = { raw_response: text, status_code: res.status };
|
|
43
|
-
}
|
|
44
|
-
if (!res.ok) {
|
|
45
|
-
return {
|
|
46
|
-
error: true,
|
|
47
|
-
status_code: res.status,
|
|
48
|
-
...(typeof data === "object" && data !== null ? data : { message: text }),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
// Workflow hints appended to tool descriptions so Claude knows the async patterns.
|
|
54
|
-
// Keyed by operationId. Covers the current spec (docs.riveterhq.com/openapi.yaml)
|
|
55
|
-
// plus legacy-only operationIds (openapi.legacy.yaml via RIVETER_OPENAPI_URL).
|
|
56
|
-
const WORKFLOW_HINTS = {
|
|
57
|
-
// Current API — every kickoff returns a run; poll get_run, fetch get_run_result
|
|
58
|
-
enrich: "\n\n**Workflow:** Starts an async run. Poll `get_run` with the returned run id until status is 'success', then call `get_run_result` for the output.",
|
|
59
|
-
getRun: "\n\n**Workflow:** Poll this endpoint until `status` is 'success' or 'stopped'. Typical runs take 10-120 seconds. Poll every 5-10 seconds.",
|
|
60
|
-
getRunResult: "\n\n**Workflow:** `output` is null until the run finishes. Pass `wait` (seconds, up to 60) to long-poll instead of sleeping between calls.",
|
|
61
|
-
stopRun: "\n\n**Workflow:** Stops a running run. The run cannot be resumed after stopping.",
|
|
62
|
-
buildDataset: "\n\n**Workflow:** Starts an async dataset build run. Poll `get_run` until status is 'success', then fetch the rows with `get_run_result`. Pass `auto_run_enrichment: true` to enrich the rows in the same flow.",
|
|
63
|
-
buildDatasetForEnrichment: "\n\n**Workflow:** Starts an async dataset build run matching the enrichment's input columns. Poll `get_run`, then fetch rows with `get_run_result`.",
|
|
64
|
-
extendDataset: "\n\n**Workflow:** Starts an async run that adds rows to an existing dataset. Poll `get_run`, then fetch with `get_run_result`.",
|
|
65
|
-
buildConfiguredDataset: "\n\n**Workflow:** Starts an async run of a configured dataset. Poll `get_run`, then fetch with `get_run_result`.",
|
|
66
|
-
runExtraction: "\n\n**Workflow:** Starts an async extraction run. Poll `get_run`, then fetch the records with `get_run_result`.",
|
|
67
|
-
createExtraction: "\n\n**Workflow:** Discovery is async but returns no run — poll `get_extraction` until `status` is 'ready', then execute with `run_extraction`.",
|
|
68
|
-
createMonitor: "\n\n**Workflow:** Creates a scheduled monitor. Check it with `get_monitor`, pause it with `update_monitor` (enabled: false), and list its runs with `list_monitor_runs`.",
|
|
69
|
-
// Legacy API (openapi.legacy.yaml)
|
|
70
|
-
runNewEnrichment: "\n\n**Workflow:** This starts an async run. Use the returned `run_key` with `get_run_status` to poll until status is 'success', then `get_run_data` to retrieve results.",
|
|
71
|
-
runExistingEnrichment: "\n\n**Workflow:** This starts an async run. Use the returned `run_key` with `get_run_status` to poll until status is 'success', then `get_run_data` to retrieve results.",
|
|
72
|
-
getRunStatus: "\n\n**Workflow:** Poll this endpoint until `status` is 'success' or 'stopped'. Typical runs take 10-120 seconds. Poll every 5-10 seconds.",
|
|
73
|
-
getRunData: "\n\n**Workflow:** Call this after `get_run_status` shows 'success' to get the full results.",
|
|
74
|
-
monitorEnrichment: "\n\n**Workflow:** Creates a scheduled monitor. Use the returned `monitor_uuid` with `get_monitor_status` to check on it, or `pause_monitor` to pause it.",
|
|
75
|
-
getMonitorStatus: "\n\n**Workflow:** Returns the monitor's schedule, enabled state, and next run time.",
|
|
76
|
-
getMonitorRecentRunData: "\n\n**Workflow:** Returns the results from the monitor's most recent run.",
|
|
77
|
-
getDatasetBuildStatus: "\n\n**Workflow:** Poll this endpoint until `state` is 'completed' or 'failed'. Then use `get_dataset_build_data` to get the generated rows.",
|
|
78
|
-
getDatasetBuildData: "\n\n**Workflow:** Call this after `get_dataset_build_status` shows state 'completed' to get the generated rows.",
|
|
79
|
-
stopDatasetBuild: "\n\n**Workflow:** Stops a dataset build in progress.",
|
|
80
|
-
createEnrichmentFromDataset: "\n\n**Workflow:** Creates an enrichment from a completed dataset build. Then use `run_enrichment_from_dataset` with the same `run_key` to execute it.",
|
|
81
|
-
runEnrichmentFromDataset: "\n\n**Workflow:** Starts an async enrichment run using the dataset as input. Use the returned `run_key` with `get_run_status` to poll until status is 'success', then `get_run_data` to retrieve results.",
|
|
82
|
-
};
|
|
83
|
-
function operationIdToToolName(operationId) {
|
|
84
|
-
return operationId
|
|
85
|
-
.replace(/([a-z])([A-Z])/g, "$1_$2")
|
|
86
|
-
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2")
|
|
87
|
-
.toLowerCase();
|
|
88
|
-
}
|
|
89
|
-
function buildZodShape(params, bodyProps) {
|
|
90
|
-
const shape = {};
|
|
91
|
-
for (const param of params) {
|
|
92
|
-
let fieldSchema;
|
|
93
|
-
if (param.schema.enum && param.schema.enum.length > 0) {
|
|
94
|
-
fieldSchema = z
|
|
95
|
-
.enum(param.schema.enum)
|
|
96
|
-
.describe(param.description || param.name);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
switch (param.schema.type) {
|
|
100
|
-
case "integer":
|
|
101
|
-
fieldSchema = z
|
|
102
|
-
.number()
|
|
103
|
-
.int()
|
|
104
|
-
.describe(param.description || param.name);
|
|
105
|
-
break;
|
|
106
|
-
case "boolean":
|
|
107
|
-
fieldSchema = z.boolean().describe(param.description || param.name);
|
|
108
|
-
break;
|
|
109
|
-
default:
|
|
110
|
-
fieldSchema = z.string().describe(param.description || param.name);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (!param.required) {
|
|
114
|
-
fieldSchema = fieldSchema.optional();
|
|
115
|
-
}
|
|
116
|
-
shape[param.name] = fieldSchema;
|
|
117
|
-
}
|
|
118
|
-
for (const [name, prop] of Object.entries(bodyProps)) {
|
|
119
|
-
if (shape[name])
|
|
120
|
-
continue;
|
|
121
|
-
let fieldSchema;
|
|
122
|
-
if (prop.enum && prop.enum.length > 0) {
|
|
123
|
-
fieldSchema = z
|
|
124
|
-
.enum(prop.enum)
|
|
125
|
-
.describe(prop.description || name);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
switch (prop.type) {
|
|
129
|
-
case "integer":
|
|
130
|
-
fieldSchema = z
|
|
131
|
-
.number()
|
|
132
|
-
.int()
|
|
133
|
-
.describe(prop.description || name);
|
|
134
|
-
break;
|
|
135
|
-
case "number":
|
|
136
|
-
fieldSchema = z.number().describe(prop.description || name);
|
|
137
|
-
break;
|
|
138
|
-
case "boolean":
|
|
139
|
-
fieldSchema = z.boolean().describe(prop.description || name);
|
|
140
|
-
break;
|
|
141
|
-
case "array": {
|
|
142
|
-
const itemType = prop.items?.type;
|
|
143
|
-
let inner;
|
|
144
|
-
if (itemType === "object" && prop.items?.objectProperties) {
|
|
145
|
-
const itemShape = {};
|
|
146
|
-
for (const [itemPropName, itemProp] of Object.entries(prop.items.objectProperties)) {
|
|
147
|
-
let itemField;
|
|
148
|
-
if (itemProp.enum && itemProp.enum.length > 0) {
|
|
149
|
-
itemField = z.enum(itemProp.enum);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
switch (itemProp.type) {
|
|
153
|
-
case "integer":
|
|
154
|
-
itemField = z.number().int();
|
|
155
|
-
break;
|
|
156
|
-
case "number":
|
|
157
|
-
itemField = z.number();
|
|
158
|
-
break;
|
|
159
|
-
case "boolean":
|
|
160
|
-
itemField = z.boolean();
|
|
161
|
-
break;
|
|
162
|
-
default:
|
|
163
|
-
itemField = z.string();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
itemField = itemField.describe(itemProp.description || itemPropName);
|
|
167
|
-
itemShape[itemPropName] = itemProp.required ? itemField : itemField.optional();
|
|
168
|
-
}
|
|
169
|
-
inner = z.object(itemShape);
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
inner =
|
|
173
|
-
itemType === "string"
|
|
174
|
-
? z.string()
|
|
175
|
-
: itemType === "integer"
|
|
176
|
-
? z.number().int()
|
|
177
|
-
: itemType === "number"
|
|
178
|
-
? z.number()
|
|
179
|
-
: z.any();
|
|
180
|
-
}
|
|
181
|
-
fieldSchema = z.array(inner).describe(prop.description || name);
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
case "object":
|
|
185
|
-
fieldSchema = z
|
|
186
|
-
.record(z.string(), z.any())
|
|
187
|
-
.describe(prop.description || name);
|
|
188
|
-
break;
|
|
189
|
-
default:
|
|
190
|
-
fieldSchema = z.string().describe(prop.description || name);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (!prop.required) {
|
|
194
|
-
fieldSchema = fieldSchema.optional();
|
|
195
|
-
}
|
|
196
|
-
shape[name] = fieldSchema;
|
|
197
|
-
}
|
|
198
|
-
return shape;
|
|
199
|
-
}
|
|
200
7
|
async function main() {
|
|
201
8
|
if (!API_KEY) {
|
|
202
9
|
console.error("RIVETER_API_KEY environment variable is required. Get one at https://app.riveterhq.com/settings/api");
|
|
203
10
|
process.exit(1);
|
|
204
11
|
}
|
|
205
|
-
let
|
|
12
|
+
let parsedSpec;
|
|
206
13
|
try {
|
|
207
|
-
|
|
14
|
+
parsedSpec = await fetchAndParseSpec(OPENAPI_SPEC_URL);
|
|
208
15
|
}
|
|
209
16
|
catch (err) {
|
|
210
17
|
console.error(`Failed to fetch OpenAPI spec: ${err}`);
|
|
211
18
|
process.exit(1);
|
|
212
19
|
}
|
|
213
|
-
const {
|
|
214
|
-
|
|
215
|
-
name: "riveter",
|
|
216
|
-
version: "0.2.3",
|
|
217
|
-
}, {
|
|
218
|
-
instructions: apiOverview +
|
|
219
|
-
"\n\nNote: Authentication is handled automatically by this MCP server. You do not need to manage API keys or headers.",
|
|
220
|
-
});
|
|
221
|
-
for (const op of operations) {
|
|
222
|
-
const toolName = operationIdToToolName(op.operationId);
|
|
223
|
-
const hint = WORKFLOW_HINTS[op.operationId] || "";
|
|
224
|
-
const description = (op.summary ? `${op.summary}\n\n` : "") + op.description + hint;
|
|
225
|
-
const shape = buildZodShape(op.parameters, op.requestBodyProperties);
|
|
226
|
-
const pathParamNames = new Set(op.parameters.filter((p) => p.in === "path").map((p) => p.name));
|
|
227
|
-
const queryParamNames = new Set(op.parameters.filter((p) => p.in === "query").map((p) => p.name));
|
|
228
|
-
const headerParamNames = new Set(op.parameters.filter((p) => p.in === "header").map((p) => p.name));
|
|
229
|
-
const method = op.method;
|
|
230
|
-
const path = op.path;
|
|
231
|
-
server.tool(toolName, description, shape, async (args) => {
|
|
232
|
-
let resolvedPath = path;
|
|
233
|
-
const queryParams = {};
|
|
234
|
-
const bodyParams = {};
|
|
235
|
-
const headerParams = {};
|
|
236
|
-
for (const [key, value] of Object.entries(args)) {
|
|
237
|
-
if (value === undefined)
|
|
238
|
-
continue;
|
|
239
|
-
if (pathParamNames.has(key)) {
|
|
240
|
-
resolvedPath = resolvedPath.replaceAll(`{${key}}`, encodeURIComponent(String(value)));
|
|
241
|
-
}
|
|
242
|
-
else if (queryParamNames.has(key)) {
|
|
243
|
-
queryParams[key] = String(value);
|
|
244
|
-
}
|
|
245
|
-
else if (headerParamNames.has(key)) {
|
|
246
|
-
headerParams[key] = String(value);
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
bodyParams[key] = value;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
const unresolvedPlaceholder = resolvedPath.match(/\{[^}]+\}/);
|
|
253
|
-
if (unresolvedPlaceholder) {
|
|
254
|
-
return {
|
|
255
|
-
content: [
|
|
256
|
-
{
|
|
257
|
-
type: "text",
|
|
258
|
-
text: `Missing required path parameter ${unresolvedPlaceholder[0]} for ${path}`,
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
isError: true,
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
try {
|
|
265
|
-
const result = await callApi(method, resolvedPath, Object.keys(queryParams).length > 0 ? queryParams : undefined, Object.keys(bodyParams).length > 0 ? bodyParams : undefined, Object.keys(headerParams).length > 0 ? headerParams : undefined);
|
|
266
|
-
return {
|
|
267
|
-
content: [
|
|
268
|
-
{
|
|
269
|
-
type: "text",
|
|
270
|
-
text: JSON.stringify(result, null, 2),
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
catch (err) {
|
|
276
|
-
return {
|
|
277
|
-
content: [
|
|
278
|
-
{
|
|
279
|
-
type: "text",
|
|
280
|
-
text: `API request failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
281
|
-
},
|
|
282
|
-
],
|
|
283
|
-
isError: true,
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
const transport = new StdioServerTransport();
|
|
289
|
-
await server.connect(transport);
|
|
20
|
+
const server = buildMcpServer({ parsedSpec, apiBaseUrl: API_BASE_URL, bearerToken: API_KEY });
|
|
21
|
+
await server.connect(new StdioServerTransport());
|
|
290
22
|
}
|
|
291
23
|
main().catch((err) => {
|
|
292
24
|
console.error("Fatal error:", err);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAyB,MAAM,qBAAqB,CAAA;AAE7E,MAAM,gBAAgB,GACpB,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,yCAAyC,CAAA;AAE9E,MAAM,YAAY,GAChB,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,8BAA8B,CAAA;AAEpE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAA;AAEjD,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAA;IACzC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,qCAAqC,gBAAgB,KAAK,GAAG,CAAC,MAAM,EAAE,CACvE,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,MAAc,EACd,IAAY,EACZ,WAA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AED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;IAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/openapi-parser.d.ts
CHANGED
package/dist/openapi-parser.js
CHANGED
|
@@ -172,6 +172,10 @@ export function parseOpenApiSpec(specText) {
|
|
|
172
172
|
path,
|
|
173
173
|
summary: operation.summary || "",
|
|
174
174
|
description: cleanDescription(operation.description) + examplesText,
|
|
175
|
+
deprecated: operation.deprecated === true,
|
|
176
|
+
destructive: typeof operation["x-mcp-destructive"] === "boolean"
|
|
177
|
+
? operation["x-mcp-destructive"]
|
|
178
|
+
: undefined,
|
|
175
179
|
parameters,
|
|
176
180
|
requestBodyProperties,
|
|
177
181
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-parser.js","sourceRoot":"","sources":["../src/openapi-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"openapi-parser.js","sourceRoot":"","sources":["../src/openapi-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AA4C1C,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AAC7E,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAE5D,SAAS,uBAAuB,CAAC,IAAa;IAC5C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,uBAAuB,CAAC,WAAmB,EAAE,YAAqB;IACzE,OAAO,CAAC,KAAK,CACX,yCAAyC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,WAAW,KAAK;QAC1F,6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AC;IAED,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type OpenApiOperation, type ParseResult } from "./openapi-parser.js";
|
|
4
|
+
export declare const SERVER_VERSION = "0.3.0";
|
|
5
|
+
export declare const DEFAULT_OPENAPI_SPEC_URL = "https://docs.riveterhq.com/openapi.yaml";
|
|
6
|
+
export declare const DEFAULT_API_BASE_URL = "https://api.riveterhq.com/v1";
|
|
7
|
+
export declare function fetchAndParseSpec(specUrl: string): Promise<ParseResult>;
|
|
8
|
+
export declare function operationIdToToolName(operationId: string): string;
|
|
9
|
+
export declare function toolAnnotationsFor(op: OpenApiOperation): ToolAnnotations;
|
|
10
|
+
export interface RiveterMcpServerConfig {
|
|
11
|
+
parsedSpec: ParseResult;
|
|
12
|
+
apiBaseUrl: string;
|
|
13
|
+
bearerToken: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildMcpServer(config: RiveterMcpServerConfig): McpServer;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { parseOpenApiSpec, } from "./openapi-parser.js";
|
|
4
|
+
export const SERVER_VERSION = "0.3.0";
|
|
5
|
+
export const DEFAULT_OPENAPI_SPEC_URL = "https://docs.riveterhq.com/openapi.yaml";
|
|
6
|
+
export const DEFAULT_API_BASE_URL = "https://api.riveterhq.com/v1";
|
|
7
|
+
// Flat client-side ceiling for a single API call. Kept well above the server's
|
|
8
|
+
// max long-poll budget (GET /runs/{id}/result?wait=N) so a long-poll never
|
|
9
|
+
// races this timeout — it only trips on a genuinely stalled connection.
|
|
10
|
+
const REQUEST_TIMEOUT_MS = 120_000;
|
|
11
|
+
export async function fetchAndParseSpec(specUrl) {
|
|
12
|
+
const res = await fetch(specUrl);
|
|
13
|
+
if (!res.ok) {
|
|
14
|
+
throw new Error(`Failed to fetch OpenAPI spec from ${specUrl}: ${res.status}`);
|
|
15
|
+
}
|
|
16
|
+
return parseOpenApiSpec(await res.text());
|
|
17
|
+
}
|
|
18
|
+
async function callApi(apiBaseUrl, bearerToken, method, path, queryParams, body, headerParams) {
|
|
19
|
+
const url = new URL(`${apiBaseUrl}${path}`);
|
|
20
|
+
if (queryParams) {
|
|
21
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
22
|
+
if (value !== undefined && value !== "") {
|
|
23
|
+
url.searchParams.set(key, value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const headers = {
|
|
28
|
+
Authorization: `Bearer ${bearerToken}`,
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
Accept: "application/json",
|
|
31
|
+
...headerParams,
|
|
32
|
+
};
|
|
33
|
+
const fetchOptions = { method: method.toUpperCase(), headers };
|
|
34
|
+
if (body && (method === "post" || method === "put" || method === "patch")) {
|
|
35
|
+
fetchOptions.body = JSON.stringify(body);
|
|
36
|
+
}
|
|
37
|
+
const controller = new AbortController();
|
|
38
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
39
|
+
try {
|
|
40
|
+
const res = await fetch(url.toString(), {
|
|
41
|
+
...fetchOptions,
|
|
42
|
+
signal: controller.signal,
|
|
43
|
+
});
|
|
44
|
+
const text = await res.text();
|
|
45
|
+
let data;
|
|
46
|
+
try {
|
|
47
|
+
data = JSON.parse(text);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
data = { raw_response: text, status_code: res.status };
|
|
51
|
+
}
|
|
52
|
+
if (!res.ok) {
|
|
53
|
+
return {
|
|
54
|
+
error: true,
|
|
55
|
+
status_code: res.status,
|
|
56
|
+
...(typeof data === "object" && data !== null ? data : { message: text }),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
if (controller.signal.aborted) {
|
|
63
|
+
return {
|
|
64
|
+
error: true,
|
|
65
|
+
status_code: 0,
|
|
66
|
+
message: `Request to ${path} timed out after ${REQUEST_TIMEOUT_MS / 1000}s`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
throw err;
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
clearTimeout(timeout);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Workflow hints appended to tool descriptions so Claude knows the async patterns.
|
|
76
|
+
// Keyed by operationId. Covers the current spec (docs.riveterhq.com/openapi.yaml)
|
|
77
|
+
// plus legacy-only operationIds (openapi.legacy.yaml via RIVETER_OPENAPI_URL).
|
|
78
|
+
const WORKFLOW_HINTS = {
|
|
79
|
+
// Current API — every kickoff returns a run; poll get_run, fetch get_run_result
|
|
80
|
+
enrich: "\n\n**Workflow:** Starts an async run. Poll `get_run` with the returned run id until status is 'success', then call `get_run_result` for the output.",
|
|
81
|
+
getRun: "\n\n**Workflow:** Poll this endpoint until `status` is 'success' or 'stopped'. Typical runs take 10-120 seconds. Poll every 5-10 seconds.",
|
|
82
|
+
getRunResult: "\n\n**Workflow:** `output` is null until the run finishes. Pass `wait` (seconds, see the parameter's max) to long-poll instead of sleeping between calls.",
|
|
83
|
+
stopRun: "\n\n**Workflow:** Stops a running run. The run cannot be resumed after stopping.",
|
|
84
|
+
buildDataset: "\n\n**Workflow:** Starts an async dataset build run. Poll `get_run` until status is 'success', then fetch the rows with `get_run_result`. Pass `auto_run_enrichment: true` to enrich the rows in the same flow.",
|
|
85
|
+
buildDatasetForEnrichment: "\n\n**Workflow:** Starts an async dataset build run matching the enrichment's input columns. Poll `get_run`, then fetch rows with `get_run_result`.",
|
|
86
|
+
extendDataset: "\n\n**Workflow:** Starts an async run that adds rows to an existing dataset. Poll `get_run`, then fetch with `get_run_result`.",
|
|
87
|
+
buildConfiguredDataset: "\n\n**Workflow:** Starts an async run of a configured dataset. Poll `get_run`, then fetch with `get_run_result`.",
|
|
88
|
+
runExtraction: "\n\n**Workflow:** Starts an async extraction run. Poll `get_run`, then fetch the records with `get_run_result`.",
|
|
89
|
+
createExtraction: "\n\n**Workflow:** Discovery is async but returns no run — poll `get_extraction` until `status` is 'ready', then execute with `run_extraction`.",
|
|
90
|
+
createMonitor: "\n\n**Workflow:** Creates a scheduled monitor. Check it with `get_monitor`, pause it with `update_monitor` (enabled: false), and list its runs with `list_monitor_runs`.",
|
|
91
|
+
// Legacy API (openapi.legacy.yaml)
|
|
92
|
+
runNewEnrichment: "\n\n**Workflow:** This starts an async run. Use the returned `run_key` with `get_run_status` to poll until status is 'success', then `get_run_data` to retrieve results.",
|
|
93
|
+
runExistingEnrichment: "\n\n**Workflow:** This starts an async run. Use the returned `run_key` with `get_run_status` to poll until status is 'success', then `get_run_data` to retrieve results.",
|
|
94
|
+
getRunStatus: "\n\n**Workflow:** Poll this endpoint until `status` is 'success' or 'stopped'. Typical runs take 10-120 seconds. Poll every 5-10 seconds.",
|
|
95
|
+
getRunData: "\n\n**Workflow:** Call this after `get_run_status` shows 'success' to get the full results.",
|
|
96
|
+
monitorEnrichment: "\n\n**Workflow:** Creates a scheduled monitor. Use the returned `monitor_uuid` with `get_monitor_status` to check on it, or `pause_monitor` to pause it.",
|
|
97
|
+
getMonitorStatus: "\n\n**Workflow:** Returns the monitor's schedule, enabled state, and next run time.",
|
|
98
|
+
getMonitorRecentRunData: "\n\n**Workflow:** Returns the results from the monitor's most recent run.",
|
|
99
|
+
getDatasetBuildStatus: "\n\n**Workflow:** Poll this endpoint until `state` is 'completed' or 'failed'. Then use `get_dataset_build_data` to get the generated rows.",
|
|
100
|
+
getDatasetBuildData: "\n\n**Workflow:** Call this after `get_dataset_build_status` shows state 'completed' to get the generated rows.",
|
|
101
|
+
stopDatasetBuild: "\n\n**Workflow:** Stops a dataset build in progress.",
|
|
102
|
+
createEnrichmentFromDataset: "\n\n**Workflow:** Creates an enrichment from a completed dataset build. Then use `run_enrichment_from_dataset` with the same `run_key` to execute it.",
|
|
103
|
+
runEnrichmentFromDataset: "\n\n**Workflow:** Starts an async enrichment run using the dataset as input. Use the returned `run_key` with `get_run_status` to poll until status is 'success', then `get_run_data` to retrieve results.",
|
|
104
|
+
};
|
|
105
|
+
export function operationIdToToolName(operationId) {
|
|
106
|
+
return operationId
|
|
107
|
+
.replace(/([a-z])([A-Z])/g, "$1_$2")
|
|
108
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2")
|
|
109
|
+
.toLowerCase();
|
|
110
|
+
}
|
|
111
|
+
function capitalizeFirst(text) {
|
|
112
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
113
|
+
}
|
|
114
|
+
// Client UIs (Claude connectors, ChatGPT) read these to label tools and to
|
|
115
|
+
// decide when to ask the user for confirmation. Derived from the HTTP method,
|
|
116
|
+
// with the spec's `x-mcp-destructive` extension as the only override.
|
|
117
|
+
export function toolAnnotationsFor(op) {
|
|
118
|
+
const isReadOnly = op.method === "get";
|
|
119
|
+
const isDestructive = op.destructive ?? op.method === "delete";
|
|
120
|
+
return {
|
|
121
|
+
title: op.summary ? capitalizeFirst(op.summary) : undefined,
|
|
122
|
+
readOnlyHint: isReadOnly,
|
|
123
|
+
destructiveHint: isDestructive,
|
|
124
|
+
idempotentHint: isReadOnly || op.method === "put" || op.method === "delete",
|
|
125
|
+
openWorldHint: true,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function zodScalarFor(type, enumValues, description) {
|
|
129
|
+
if (enumValues && enumValues.length > 0) {
|
|
130
|
+
return z.enum(enumValues).describe(description);
|
|
131
|
+
}
|
|
132
|
+
switch (type) {
|
|
133
|
+
case "integer":
|
|
134
|
+
return z.number().int().describe(description);
|
|
135
|
+
case "number":
|
|
136
|
+
return z.number().describe(description);
|
|
137
|
+
case "boolean":
|
|
138
|
+
return z.boolean().describe(description);
|
|
139
|
+
default:
|
|
140
|
+
return z.string().describe(description);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function zodArrayItemFor(items) {
|
|
144
|
+
const itemType = items?.type;
|
|
145
|
+
if (itemType === "object" && items?.objectProperties) {
|
|
146
|
+
const itemShape = {};
|
|
147
|
+
for (const [itemPropName, itemProp] of Object.entries(items.objectProperties)) {
|
|
148
|
+
const itemField = zodScalarFor(itemProp.type, itemProp.enum, itemProp.description || itemPropName);
|
|
149
|
+
itemShape[itemPropName] = itemProp.required ? itemField : itemField.optional();
|
|
150
|
+
}
|
|
151
|
+
return z.object(itemShape);
|
|
152
|
+
}
|
|
153
|
+
switch (itemType) {
|
|
154
|
+
case "string":
|
|
155
|
+
return z.string();
|
|
156
|
+
case "integer":
|
|
157
|
+
return z.number().int();
|
|
158
|
+
case "number":
|
|
159
|
+
return z.number();
|
|
160
|
+
default:
|
|
161
|
+
return z.any();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function zodBodyPropertyFor(name, prop) {
|
|
165
|
+
const description = prop.description || name;
|
|
166
|
+
if (prop.enum && prop.enum.length > 0) {
|
|
167
|
+
return z.enum(prop.enum).describe(description);
|
|
168
|
+
}
|
|
169
|
+
switch (prop.type) {
|
|
170
|
+
case "array":
|
|
171
|
+
return z.array(zodArrayItemFor(prop.items)).describe(description);
|
|
172
|
+
case "object":
|
|
173
|
+
return z.record(z.string(), z.any()).describe(description);
|
|
174
|
+
default:
|
|
175
|
+
return zodScalarFor(prop.type, undefined, description);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function buildZodShape(params, bodyProps) {
|
|
179
|
+
const shape = {};
|
|
180
|
+
for (const param of params) {
|
|
181
|
+
const fieldSchema = zodScalarFor(param.schema.type, param.schema.enum, param.description || param.name);
|
|
182
|
+
shape[param.name] = param.required ? fieldSchema : fieldSchema.optional();
|
|
183
|
+
}
|
|
184
|
+
for (const [name, prop] of Object.entries(bodyProps)) {
|
|
185
|
+
if (shape[name])
|
|
186
|
+
continue;
|
|
187
|
+
const fieldSchema = zodBodyPropertyFor(name, prop);
|
|
188
|
+
shape[name] = prop.required ? fieldSchema : fieldSchema.optional();
|
|
189
|
+
}
|
|
190
|
+
return shape;
|
|
191
|
+
}
|
|
192
|
+
function textResult(text, isError = false) {
|
|
193
|
+
return { content: [{ type: "text", text }], ...(isError ? { isError: true } : {}) };
|
|
194
|
+
}
|
|
195
|
+
function registerOperation(server, op, config) {
|
|
196
|
+
const toolName = operationIdToToolName(op.operationId);
|
|
197
|
+
const hint = WORKFLOW_HINTS[op.operationId] || "";
|
|
198
|
+
const deprecationNotice = op.deprecated
|
|
199
|
+
? "[DEPRECATED] This endpoint still works but has a preferred successor — see the API overview for the replacement.\n\n"
|
|
200
|
+
: "";
|
|
201
|
+
const description = deprecationNotice + (op.summary ? `${op.summary}\n\n` : "") + op.description + hint;
|
|
202
|
+
const shape = buildZodShape(op.parameters, op.requestBodyProperties);
|
|
203
|
+
const annotations = toolAnnotationsFor(op);
|
|
204
|
+
const pathParamNames = new Set(op.parameters.filter((p) => p.in === "path").map((p) => p.name));
|
|
205
|
+
const queryParamNames = new Set(op.parameters.filter((p) => p.in === "query").map((p) => p.name));
|
|
206
|
+
const headerParamNames = new Set(op.parameters.filter((p) => p.in === "header").map((p) => p.name));
|
|
207
|
+
server.registerTool(toolName, { title: annotations.title, description, inputSchema: shape, annotations }, async (args) => {
|
|
208
|
+
let resolvedPath = op.path;
|
|
209
|
+
const queryParams = {};
|
|
210
|
+
const bodyParams = {};
|
|
211
|
+
const headerParams = {};
|
|
212
|
+
for (const [key, value] of Object.entries(args)) {
|
|
213
|
+
if (value === undefined)
|
|
214
|
+
continue;
|
|
215
|
+
if (pathParamNames.has(key)) {
|
|
216
|
+
resolvedPath = resolvedPath.replaceAll(`{${key}}`, encodeURIComponent(String(value)));
|
|
217
|
+
}
|
|
218
|
+
else if (queryParamNames.has(key)) {
|
|
219
|
+
queryParams[key] = String(value);
|
|
220
|
+
}
|
|
221
|
+
else if (headerParamNames.has(key)) {
|
|
222
|
+
headerParams[key] = String(value);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
bodyParams[key] = value;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const unresolvedPlaceholder = resolvedPath.match(/\{[^}]+\}/);
|
|
229
|
+
if (unresolvedPlaceholder) {
|
|
230
|
+
return textResult(`Missing required path parameter ${unresolvedPlaceholder[0]} for ${op.path}`, true);
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
const result = await callApi(config.apiBaseUrl, config.bearerToken, op.method, resolvedPath, Object.keys(queryParams).length > 0 ? queryParams : undefined, Object.keys(bodyParams).length > 0 ? bodyParams : undefined, Object.keys(headerParams).length > 0 ? headerParams : undefined);
|
|
234
|
+
return textResult(JSON.stringify(result, null, 2));
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
return textResult(`API request failed: ${err instanceof Error ? err.message : String(err)}`, true);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
// One McpServer per bearer token. Cheap to build (the spec is already parsed),
|
|
242
|
+
// so the HTTP entrypoint creates one per request; stdio builds one for the process.
|
|
243
|
+
export function buildMcpServer(config) {
|
|
244
|
+
const server = new McpServer({ name: "riveter", version: SERVER_VERSION }, {
|
|
245
|
+
instructions: config.parsedSpec.apiOverview +
|
|
246
|
+
"\n\nNote: Authentication is handled automatically by this MCP server. You do not need to manage API keys or headers.",
|
|
247
|
+
});
|
|
248
|
+
for (const op of config.parsedSpec.operations) {
|
|
249
|
+
registerOperation(server, op, config);
|
|
250
|
+
}
|
|
251
|
+
return server;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA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AAC,CAAC,CAAC,SAAS,CAChE,CAAA;YACD,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,UAAU,CACf,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EACzE,IAAI,CACL,CAAA;QACH,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC;AAED,+EAA+E;AAC/E,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,MAA8B;IAC3D,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,EAC5C;QACE,YAAY,EACV,MAAM,CAAC,UAAU,CAAC,WAAW;YAC7B,sHAAsH;KACzH,CACF,CAAA;IAED,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAC9C,iBAAiB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "riveter-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"mcpName": "io.github.CodyWatters/riveter",
|
|
5
5
|
"description": "MCP server for the Riveter API — connects Claude to Riveter's enrichment, scraping, and monitoring tools",
|
|
6
6
|
"homepage": "https://docs.riveterhq.com",
|
|
@@ -13,14 +13,6 @@
|
|
|
13
13
|
"bin": {
|
|
14
14
|
"riveter-mcp-server": "dist/index.js"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"dev": "tsx watch src/index.ts",
|
|
18
|
-
"build": "tsc",
|
|
19
|
-
"start": "node dist/index.js",
|
|
20
|
-
"typecheck": "tsc --noEmit",
|
|
21
|
-
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
22
|
-
"prepublishOnly": "pnpm test"
|
|
23
|
-
},
|
|
24
16
|
"dependencies": {
|
|
25
17
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
26
18
|
"yaml": "^2.7.1",
|
|
@@ -45,5 +37,14 @@
|
|
|
45
37
|
"enrichment",
|
|
46
38
|
"api"
|
|
47
39
|
],
|
|
48
|
-
"license": "MIT"
|
|
49
|
-
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"dev": "tsx watch src/index.ts",
|
|
43
|
+
"build": "tsc",
|
|
44
|
+
"start": "node dist/index.js",
|
|
45
|
+
"start:http": "node dist/http.js",
|
|
46
|
+
"dev:http": "tsx watch src/http.ts",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"test": "pnpm run build && node --test test/*.test.mjs"
|
|
49
|
+
}
|
|
50
|
+
}
|