@tryvira/mcp 0.1.22 → 0.1.25
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 +21 -21
- package/README.md +79 -79
- package/dist/cli.js +12 -2
- package/dist/migrations/001_vnext_foundation.sql +628 -628
- package/package.json +52 -52
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Vira / Esad Türkel
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vira / Esad Türkel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
# @tryvira/mcp
|
|
2
|
-
|
|
3
|
-
MIT-licensed MCP client/server package. The Vira service, application, and
|
|
4
|
-
backend remain proprietary and are governed separately.
|
|
5
|
-
|
|
6
|
-
An npx-ready MCP server for Vira's existing scoped authority boundary.
|
|
7
|
-
|
|
8
|
-
## Run it
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npx @tryvira/mcp
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
The default transport is the official MCP transport. The legacy custom transport is an
|
|
15
|
-
explicit migration option only: `VIRA_MCP_PROTOCOL_MODE=legacy npx @tryvira/mcp`.
|
|
16
|
-
|
|
17
|
-
The launcher reads environment variables from its parent process. It does not automatically load a
|
|
18
|
-
`.env` file. For a local shell, export the variables first; for an MCP client, put them in the
|
|
19
|
-
client's `env` configuration:
|
|
20
|
-
|
|
21
|
-
```dotenv
|
|
22
|
-
VIRA_API_URL=http://127.0.0.1:4185
|
|
23
|
-
VIRA_API_KEY=vira_dev_local.local-development-only-32chars
|
|
24
|
-
VIRA_MCP_AUTH_TOKEN=replace-with-a-long-random-mcp-token
|
|
25
|
-
VIRA_ORGANIZATION_ID=local-org
|
|
26
|
-
VIRA_PROJECT_ID=local-project
|
|
27
|
-
VIRA_ENVIRONMENT_ID=local
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
For example, an MCP client configuration uses the same names:
|
|
31
|
-
|
|
32
|
-
```json
|
|
33
|
-
{"env":{"VIRA_API_URL":"https://api.example","VIRA_API_KEY":"<customer-api-key>","VIRA_MCP_AUTH_TOKEN":"<mcp-token>","VIRA_ORGANIZATION_ID":"<org>","VIRA_PROJECT_ID":"<project>","VIRA_ENVIRONMENT_ID":"<environment>"}}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
The default launcher uses MCP stdio. To run the optional HTTP transport explicitly, use
|
|
37
|
-
`npx @tryvira/mcp --http`; it binds to `127.0.0.1` by default and requires `Authorization: Bearer
|
|
38
|
-
<VIRA_MCP_AUTH_TOKEN>`. Effectful MCP tools are denied by default. Local-only effectful
|
|
39
|
-
execution requires the explicit `VIRA_MCP_ALLOW_EFFECTFUL=true` opt-in; production never
|
|
40
|
-
accepts that shortcut. Set `VIRA_MCP_BIND_PUBLIC=true` only when an authenticated reverse
|
|
41
|
-
proxy or equivalent network boundary is present.
|
|
42
|
-
|
|
43
|
-
Effectful MCP tools remain authority-gated; the launcher does not create a second execution or telemetry path.
|
|
44
|
-
|
|
45
|
-
## What a client can discover
|
|
46
|
-
|
|
47
|
-
After `initialize`, call `tools/list`. Read-only tools such as `resolve_semantic` may return
|
|
48
|
-
semantic candidates. Effectful tools such as `resolve_runtime`, pack installation/release
|
|
49
|
-
and Strategy execution call the configured authority endpoint and can be denied by scope,
|
|
50
|
-
role, release state or policy.
|
|
51
|
-
|
|
52
|
-
## Minimal MCP client configuration
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
{
|
|
56
|
-
"mcpServers": {
|
|
57
|
-
"vira": {
|
|
58
|
-
"command": "npx",
|
|
59
|
-
"args": ["-y", "@tryvira/mcp"],
|
|
60
|
-
"env": {
|
|
61
|
-
"VIRA_API_URL": "https://api.example.invalid",
|
|
62
|
-
"VIRA_API_KEY": "<customer-api-key>",
|
|
63
|
-
"VIRA_MCP_AUTH_TOKEN": "<mcp-auth-token>",
|
|
64
|
-
"VIRA_MCP_AUTHORITY_URL": "https://api.example.invalid/v1/mcp/authorize",
|
|
65
|
-
"VIRA_ORGANIZATION_ID": "<organization>",
|
|
66
|
-
"VIRA_PROJECT_ID": "<project>",
|
|
67
|
-
"VIRA_ENVIRONMENT_ID": "<environment>"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Never paste real credentials into a checked-in client configuration. For local-only effectful
|
|
75
|
-
testing, use the local stack and its documented development credentials; the production
|
|
76
|
-
authority path does not accept the local bypass.
|
|
77
|
-
|
|
78
|
-
See [`docs/MCP_GUIDE.md`](../../docs/MCP_GUIDE.md) for JSON-RPC discovery, tool examples and
|
|
79
|
-
authority/error behavior.
|
|
1
|
+
# @tryvira/mcp
|
|
2
|
+
|
|
3
|
+
MIT-licensed MCP client/server package. The Vira service, application, and
|
|
4
|
+
backend remain proprietary and are governed separately.
|
|
5
|
+
|
|
6
|
+
An npx-ready MCP server for Vira's existing scoped authority boundary.
|
|
7
|
+
|
|
8
|
+
## Run it
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx @tryvira/mcp
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The default transport is the official MCP transport. The legacy custom transport is an
|
|
15
|
+
explicit migration option only: `VIRA_MCP_PROTOCOL_MODE=legacy npx @tryvira/mcp`.
|
|
16
|
+
|
|
17
|
+
The launcher reads environment variables from its parent process. It does not automatically load a
|
|
18
|
+
`.env` file. For a local shell, export the variables first; for an MCP client, put them in the
|
|
19
|
+
client's `env` configuration:
|
|
20
|
+
|
|
21
|
+
```dotenv
|
|
22
|
+
VIRA_API_URL=http://127.0.0.1:4185
|
|
23
|
+
VIRA_API_KEY=vira_dev_local.local-development-only-32chars
|
|
24
|
+
VIRA_MCP_AUTH_TOKEN=replace-with-a-long-random-mcp-token
|
|
25
|
+
VIRA_ORGANIZATION_ID=local-org
|
|
26
|
+
VIRA_PROJECT_ID=local-project
|
|
27
|
+
VIRA_ENVIRONMENT_ID=local
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For example, an MCP client configuration uses the same names:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{"env":{"VIRA_API_URL":"https://api.example","VIRA_API_KEY":"<customer-api-key>","VIRA_MCP_AUTH_TOKEN":"<mcp-token>","VIRA_ORGANIZATION_ID":"<org>","VIRA_PROJECT_ID":"<project>","VIRA_ENVIRONMENT_ID":"<environment>"}}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The default launcher uses MCP stdio. To run the optional HTTP transport explicitly, use
|
|
37
|
+
`npx @tryvira/mcp --http`; it binds to `127.0.0.1` by default and requires `Authorization: Bearer
|
|
38
|
+
<VIRA_MCP_AUTH_TOKEN>`. Effectful MCP tools are denied by default. Local-only effectful
|
|
39
|
+
execution requires the explicit `VIRA_MCP_ALLOW_EFFECTFUL=true` opt-in; production never
|
|
40
|
+
accepts that shortcut. Set `VIRA_MCP_BIND_PUBLIC=true` only when an authenticated reverse
|
|
41
|
+
proxy or equivalent network boundary is present.
|
|
42
|
+
|
|
43
|
+
Effectful MCP tools remain authority-gated; the launcher does not create a second execution or telemetry path.
|
|
44
|
+
|
|
45
|
+
## What a client can discover
|
|
46
|
+
|
|
47
|
+
After `initialize`, call `tools/list`. Read-only tools such as `resolve_semantic` may return
|
|
48
|
+
semantic candidates. Effectful tools such as `resolve_runtime`, pack installation/release
|
|
49
|
+
and Strategy execution call the configured authority endpoint and can be denied by scope,
|
|
50
|
+
role, release state or policy.
|
|
51
|
+
|
|
52
|
+
## Minimal MCP client configuration
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"vira": {
|
|
58
|
+
"command": "npx",
|
|
59
|
+
"args": ["-y", "@tryvira/mcp"],
|
|
60
|
+
"env": {
|
|
61
|
+
"VIRA_API_URL": "https://api.example.invalid",
|
|
62
|
+
"VIRA_API_KEY": "<customer-api-key>",
|
|
63
|
+
"VIRA_MCP_AUTH_TOKEN": "<mcp-auth-token>",
|
|
64
|
+
"VIRA_MCP_AUTHORITY_URL": "https://api.example.invalid/v1/mcp/authorize",
|
|
65
|
+
"VIRA_ORGANIZATION_ID": "<organization>",
|
|
66
|
+
"VIRA_PROJECT_ID": "<project>",
|
|
67
|
+
"VIRA_ENVIRONMENT_ID": "<environment>"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Never paste real credentials into a checked-in client configuration. For local-only effectful
|
|
75
|
+
testing, use the local stack and its documented development credentials; the production
|
|
76
|
+
authority path does not accept the local bypass.
|
|
77
|
+
|
|
78
|
+
See [`docs/MCP_GUIDE.md`](../../docs/MCP_GUIDE.md) for JSON-RPC discovery, tool examples and
|
|
79
|
+
authority/error behavior.
|
package/dist/cli.js
CHANGED
|
@@ -826,7 +826,7 @@ function resolveViraMcpConfig(environment = process.env) {
|
|
|
826
826
|
if (!apiKey) throw new Error("VIRA_API_KEY_REQUIRED_IN_PRODUCTION");
|
|
827
827
|
const authorityUrl = environment.VIRA_MCP_AUTHORITY_URL;
|
|
828
828
|
return { baseUrl, apiKey, authorityUrl, serverName: environment.VIRA_MCP_SERVER_NAME ?? "vira-behavior-control", requestAuthToken: environment.VIRA_MCP_AUTH_TOKEN, ...authorityUrl ? { authorizeEffectful: async (input) => {
|
|
829
|
-
const response = await fetch(`${authorityUrl}`, { method: "POST", headers: { authorization: `Bearer ${apiKey}`, "content-type": "application/json" }, body: JSON.stringify(input) });
|
|
829
|
+
const response = await fetch(`${authorityUrl}`, { method: "POST", headers: { authorization: `Bearer ${apiKey}`, "x-vira-api-key": apiKey, "content-type": "application/json" }, body: JSON.stringify(input) });
|
|
830
830
|
const payload = await response.json().catch(() => null);
|
|
831
831
|
return { allowed: response.ok && payload?.allowed === true, decisionDigest: payload?.decisionDigest ?? "", ...payload?.reason ? { reason: payload.reason } : {} };
|
|
832
832
|
} } : {} };
|
|
@@ -841,7 +841,7 @@ function createViraMcpOptions(config) {
|
|
|
841
841
|
if (!config.baseUrl?.trim() || !config.apiKey?.trim()) throw new Error("VIRA_MCP_CONFIG_REQUIRED");
|
|
842
842
|
const fetcher = config.fetcher ?? fetch;
|
|
843
843
|
const api = async (path, body, requestId, method) => {
|
|
844
|
-
const response = await fetcher(`${config.baseUrl.replace(/\/$/, "")}${path}`, { method: method ?? (body ? "POST" : "GET"), headers: { authorization: `Bearer ${config.apiKey}`, "content-type": "application/json", "idempotency-key": requestId }, ...body ? { body: JSON.stringify(body) } : {} });
|
|
844
|
+
const response = await fetcher(`${config.baseUrl.replace(/\/$/, "")}${path}`, { method: method ?? (body ? "POST" : "GET"), headers: { authorization: `Bearer ${config.apiKey}`, "x-vira-api-key": config.apiKey, "content-type": "application/json", "idempotency-key": requestId }, ...body ? { body: JSON.stringify(body) } : {} });
|
|
845
845
|
const payload = await response.json().catch(() => null);
|
|
846
846
|
if (!response.ok) return { error: `VIRA_API_${response.status}`, result: payload };
|
|
847
847
|
return { result: payload };
|
|
@@ -1570,6 +1570,16 @@ async function openProductionSqlite({ databaseUrl = process.env.DATABASE_URL } =
|
|
|
1570
1570
|
} catch (error) {
|
|
1571
1571
|
if (!String(error).includes("duplicate column name")) throw error;
|
|
1572
1572
|
}
|
|
1573
|
+
database.run(`CREATE TABLE IF NOT EXISTS decision_authority_program_pointers (
|
|
1574
|
+
organization_id TEXT NOT NULL,
|
|
1575
|
+
project_id TEXT NOT NULL,
|
|
1576
|
+
environment_id TEXT NOT NULL,
|
|
1577
|
+
pointer_key TEXT NOT NULL,
|
|
1578
|
+
bundle_id TEXT NOT NULL,
|
|
1579
|
+
bundle_digest TEXT NOT NULL,
|
|
1580
|
+
version INTEGER NOT NULL,
|
|
1581
|
+
PRIMARY KEY (organization_id, project_id, environment_id, pointer_key)
|
|
1582
|
+
)`);
|
|
1573
1583
|
database.run("CREATE TABLE IF NOT EXISTS session_handoff_approvals (id TEXT PRIMARY KEY, source_session_id TEXT NOT NULL, target_session_id TEXT NOT NULL, organization_id TEXT NOT NULL, project_id TEXT NOT NULL, application_id TEXT, environment_id TEXT NOT NULL, status TEXT NOT NULL CHECK (status IN ('PENDING','APPROVED','REJECTED','CONSUMED')), requested_at TEXT NOT NULL, decided_at TEXT, expires_at TEXT NOT NULL, decision_digest TEXT NOT NULL UNIQUE)");
|
|
1574
1584
|
database.run(`CREATE TABLE IF NOT EXISTS release_manifests (
|
|
1575
1585
|
id TEXT PRIMARY KEY,
|