@elvix.is/sdk 0.3.1 → 0.3.2
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
CHANGED
|
@@ -125,8 +125,8 @@ elvix ships first-class agent support. Three surfaces:
|
|
|
125
125
|
{
|
|
126
126
|
"mcpServers": {
|
|
127
127
|
"elvix": {
|
|
128
|
-
"command": "
|
|
129
|
-
"args": ["@elvix.is/sdk", "elvix-mcp"],
|
|
128
|
+
"command": "npx",
|
|
129
|
+
"args": ["-y", "-p", "@elvix.is/sdk", "elvix-mcp"],
|
|
130
130
|
"env": { "ELVIX_API_KEY": "eak_..." }
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -142,9 +142,10 @@ Full agent guide: <https://elvix.is/docs/agents>
|
|
|
142
142
|
Every `<Elvix*>` component the SDK ships. Drop-in React, brand chord from `<ElvixProvider>`, no prop drilling.
|
|
143
143
|
|
|
144
144
|
- Primitives: `ElvixCard`, `ElvixProvider`
|
|
145
|
-
- Sign-in: `ElvixSignIn
|
|
145
|
+
- Sign-in: `ElvixSignIn`
|
|
146
146
|
- Identity: `ElvixUsername`, `ElvixIdentityForm`, `ElvixAvatar`, `ElvixBanner`, `ElvixRegion`, `ElvixLanguages`
|
|
147
147
|
- Account: `ElvixAddressBook`, `ElvixLegalEntities`, `ElvixSessions`, `ElvixExport`, `ElvixDeactivate`, `ElvixLeave`
|
|
148
|
+
- Hooks: `useElvixApp()`, `useElvixContext()`
|
|
148
149
|
|
|
149
150
|
Full catalog with previews: <https://elvix.is/docs/components>
|
|
150
151
|
|
|
@@ -7,6 +7,11 @@ import {
|
|
|
7
7
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
8
8
|
var DEFAULT_BASE_URL = "https://elvix.is";
|
|
9
9
|
var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
10
|
+
function splitEndpoint(endpoint) {
|
|
11
|
+
const idx = endpoint.indexOf(" ");
|
|
12
|
+
if (idx === -1) return { method: "GET", path: endpoint };
|
|
13
|
+
return { method: endpoint.slice(0, idx), path: endpoint.slice(idx + 1) };
|
|
14
|
+
}
|
|
10
15
|
function toolName(method, path) {
|
|
11
16
|
return `${method.toLowerCase()}_${path.replace(/^\/api\//, "").replace(/[\/{}]+/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "")}`;
|
|
12
17
|
}
|
|
@@ -15,9 +20,9 @@ async function createElvixMcpServer(opts) {
|
|
|
15
20
|
const readonly = opts.readonly ?? true;
|
|
16
21
|
const manifestRes = await fetch(`${baseUrl}/openapi.roles.json`);
|
|
17
22
|
const manifest = await manifestRes.json();
|
|
18
|
-
const tools = manifest.
|
|
19
|
-
name: toolName(
|
|
20
|
-
description: `${
|
|
23
|
+
const tools = manifest.filter((e) => e.role === "api").map((e) => ({ entry: e, ...splitEndpoint(e.endpoint) })).filter(({ method }) => readonly ? SAFE_METHODS.has(method.toUpperCase()) : true).map(({ entry, method, path }) => ({
|
|
24
|
+
name: toolName(method, path),
|
|
25
|
+
description: `${entry.summary ?? `${method} ${path}`}${entry.adminScope ? " (requires admin scope)" : ""}`,
|
|
21
26
|
inputSchema: {
|
|
22
27
|
type: "object",
|
|
23
28
|
properties: {
|
|
@@ -27,7 +32,7 @@ async function createElvixMcpServer(opts) {
|
|
|
27
32
|
},
|
|
28
33
|
required: ["path"]
|
|
29
34
|
},
|
|
30
|
-
_meta: { method
|
|
35
|
+
_meta: { method, path, adminScope: entry.adminScope ?? false }
|
|
31
36
|
}));
|
|
32
37
|
const server = new Server(
|
|
33
38
|
{ name: "elvix", version: "0.1.0" },
|
package/dist/mcp/bin.js
CHANGED
package/dist/mcp/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvix.is/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Official elvix SDK. Drop-in React components, server helpers, and an MCP server so AI coding agents integrate elvix on the first try.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://elvix.is",
|