@variance-authority/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.
Files changed (92) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/LICENSE +21 -0
  3. package/README.md +407 -0
  4. package/dist/bin.d.ts +3 -0
  5. package/dist/bin.js +32 -0
  6. package/dist/bin.js.map +1 -0
  7. package/dist/index.d.ts +35 -0
  8. package/dist/index.js +31 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/observability-subject.d.ts +22 -0
  11. package/dist/observability-subject.js +2 -0
  12. package/dist/observability-subject.js.map +1 -0
  13. package/dist/presentation.d.ts +6 -0
  14. package/dist/presentation.js +64 -0
  15. package/dist/presentation.js.map +1 -0
  16. package/dist/protocol.d.ts +82 -0
  17. package/dist/protocol.js +186 -0
  18. package/dist/protocol.js.map +1 -0
  19. package/dist/server.d.ts +71 -0
  20. package/dist/server.js +103 -0
  21. package/dist/server.js.map +1 -0
  22. package/dist/tools/adjudicate.d.ts +25 -0
  23. package/dist/tools/adjudicate.js +122 -0
  24. package/dist/tools/adjudicate.js.map +1 -0
  25. package/dist/tools/attention.d.ts +13 -0
  26. package/dist/tools/attention.js +151 -0
  27. package/dist/tools/attention.js.map +1 -0
  28. package/dist/tools/changelog.d.ts +38 -0
  29. package/dist/tools/changelog.js +201 -0
  30. package/dist/tools/changelog.js.map +1 -0
  31. package/dist/tools/changes.d.ts +31 -0
  32. package/dist/tools/changes.js +120 -0
  33. package/dist/tools/changes.js.map +1 -0
  34. package/dist/tools/composition.d.ts +13 -0
  35. package/dist/tools/composition.js +366 -0
  36. package/dist/tools/composition.js.map +1 -0
  37. package/dist/tools/describe.d.ts +20 -0
  38. package/dist/tools/describe.js +279 -0
  39. package/dist/tools/describe.js.map +1 -0
  40. package/dist/tools/diff.d.ts +20 -0
  41. package/dist/tools/diff.js +85 -0
  42. package/dist/tools/diff.js.map +1 -0
  43. package/dist/tools/explain-verdict.d.ts +25 -0
  44. package/dist/tools/explain-verdict.js +92 -0
  45. package/dist/tools/explain-verdict.js.map +1 -0
  46. package/dist/tools/findings.d.ts +40 -0
  47. package/dist/tools/findings.js +130 -0
  48. package/dist/tools/findings.js.map +1 -0
  49. package/dist/tools/narrowing.d.ts +26 -0
  50. package/dist/tools/narrowing.js +38 -0
  51. package/dist/tools/narrowing.js.map +1 -0
  52. package/dist/tools/observability.d.ts +7 -0
  53. package/dist/tools/observability.js +199 -0
  54. package/dist/tools/observability.js.map +1 -0
  55. package/dist/tools/presentations.d.ts +6 -0
  56. package/dist/tools/presentations.js +74 -0
  57. package/dist/tools/presentations.js.map +1 -0
  58. package/dist/tools/run-signals.d.ts +12 -0
  59. package/dist/tools/run-signals.js +115 -0
  60. package/dist/tools/run-signals.js.map +1 -0
  61. package/dist/tools/scenarios.d.ts +6 -0
  62. package/dist/tools/scenarios.js +62 -0
  63. package/dist/tools/scenarios.js.map +1 -0
  64. package/dist/tools/source-tests.d.ts +5 -0
  65. package/dist/tools/source-tests.js +95 -0
  66. package/dist/tools/source-tests.js.map +1 -0
  67. package/dist/tools/subject.d.ts +45 -0
  68. package/dist/tools/subject.js +57 -0
  69. package/dist/tools/subject.js.map +1 -0
  70. package/dist/tools/summary.d.ts +31 -0
  71. package/dist/tools/summary.js +436 -0
  72. package/dist/tools/summary.js.map +1 -0
  73. package/dist/tools/test-signals.d.ts +16 -0
  74. package/dist/tools/test-signals.js +106 -0
  75. package/dist/tools/test-signals.js.map +1 -0
  76. package/dist/tools/tool.d.ts +64 -0
  77. package/dist/tools/tool.js +9 -0
  78. package/dist/tools/tool.js.map +1 -0
  79. package/dist/tools/trace-component.d.ts +17 -0
  80. package/dist/tools/trace-component.js +50 -0
  81. package/dist/tools/trace-component.js.map +1 -0
  82. package/dist/tools/vantage-lines.d.ts +44 -0
  83. package/dist/tools/vantage-lines.js +66 -0
  84. package/dist/tools/vantage-lines.js.map +1 -0
  85. package/dist/tools/variations.d.ts +27 -0
  86. package/dist/tools/variations.js +125 -0
  87. package/dist/tools/variations.js.map +1 -0
  88. package/dist/tools.d.ts +120 -0
  89. package/dist/tools.js +127 -0
  90. package/dist/tools.js.map +1 -0
  91. package/mark.svg +30 -0
  92. package/package.json +64 -0
package/dist/tools.js ADDED
@@ -0,0 +1,127 @@
1
+ import { adjudicate } from './tools/adjudicate.js';
2
+ import { changelog } from './tools/changelog.js';
3
+ import { changes } from './tools/changes.js';
4
+ import { composition } from './tools/composition.js';
5
+ import { describe } from './tools/describe.js';
6
+ import { diff, diffState } from './tools/diff.js';
7
+ import { explain } from './tools/explain-verdict.js';
8
+ import { findings } from './tools/findings.js';
9
+ import { summarize } from './tools/summary.js';
10
+ import { attention } from './tools/attention.js';
11
+ import { observability, testingSurface } from './tools/observability.js';
12
+ import { presentations } from './tools/presentations.js';
13
+ import { scenarios } from './tools/scenarios.js';
14
+ import { sourceTests } from './tools/source-tests.js';
15
+ import { runSignals } from './tools/run-signals.js';
16
+ import { testSignals } from './tools/test-signals.js';
17
+ import { NO_ARGS, stringArg } from './tools/tool.js';
18
+ import { trace } from './tools/trace-component.js';
19
+ import { variations } from './tools/variations.js';
20
+ // The tool-authoring contract, not an implementation detail of this set. A
21
+ // server over another subject writes tools against the same interface, and the
22
+ // first thing any tool does with a model's argument is refuse it or narrow it.
23
+ export { NO_ARGS, stringArg };
24
+ export { notObservedSentence } from './tools/subject.js';
25
+ export { diffState };
26
+ /** The source-to-named-test tool set for an MCP server over an execution index. */
27
+ export const SOURCE_TEST_TOOLS = [sourceTests, diff];
28
+ /** Look up one source-test tool without widening it to the visual-report subject. */
29
+ export function sourceTestToolByName(name) {
30
+ return SOURCE_TEST_TOOLS.find((tool) => tool.name === name);
31
+ }
32
+ /**
33
+ * The tool set for a watcher attached to a suite that is still running.
34
+ *
35
+ * A third subject, and the first one that is not a thing somebody produced. The
36
+ * report tools answer about a run that finished and the source-test tools answer
37
+ * about an index that was written; these answer about a run *in flight*, held in
38
+ * the memory of the process answering, and gone when it exits.
39
+ *
40
+ * The listing comes first for the same reason `variance_summary` does: the other
41
+ * two take an argument it printed. `variance_diff` is last here rather than
42
+ * second, because on a live subject it is not the session question but the
43
+ * *progress* question — what the suite did between two asks — and that is only
44
+ * worth asking once a reader knows what they are watching.
45
+ */
46
+ export const VANTAGE_TOOLS = [
47
+ runSignals,
48
+ testSignals,
49
+ diff,
50
+ ];
51
+ /** Look up one live-run tool without widening it to the visual-report subject. */
52
+ export function vantageToolByName(name) {
53
+ return VANTAGE_TOOLS.find((tool) => tool.name === name);
54
+ }
55
+ export const TOOLS = [
56
+ summarize,
57
+ diff,
58
+ changes,
59
+ adjudicate,
60
+ composition,
61
+ variations,
62
+ changelog,
63
+ describe,
64
+ findings,
65
+ trace,
66
+ explain,
67
+ ];
68
+ export function toolByName(name) {
69
+ return TOOLS.find((tool) => tool.name === name);
70
+ }
71
+ /** Full presentation graphs supplied by the caller, independent of report projections. */
72
+ export const PRESENTATION_TOOLS = [
73
+ presentations,
74
+ diff,
75
+ ];
76
+ export function presentationToolByName(name) {
77
+ return PRESENTATION_TOOLS.find((tool) => tool.name === name);
78
+ }
79
+ /** Test attention captured synchronously while DOM nodes still have attribution. */
80
+ export const EYES_TOOLS = [attention, diff];
81
+ export function eyesToolByName(name) {
82
+ return EYES_TOOLS.find((tool) => tool.name === name);
83
+ }
84
+ /** Retained scenario executions, including witnessed Arrange state and Act outcomes. */
85
+ export const SCENARIO_TOOLS = [scenarios, diff];
86
+ export function scenarioToolByName(name) {
87
+ return SCENARIO_TOOLS.find((tool) => tool.name === name);
88
+ }
89
+ /**
90
+ * Every independently supplied observability domain behind one MCP connection.
91
+ *
92
+ * Native tools are lifted without changing their answers. A missing field is a
93
+ * tool error, not an empty subject, and previous invocation state is projected
94
+ * through the same field before a native diff sees it.
95
+ */
96
+ export const OBSERVABILITY_TOOLS = [
97
+ observability,
98
+ ...TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) => lift(tool, 'visual/report', (subject) => subject.report)),
99
+ ...PRESENTATION_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) => lift(tool, 'presentation readings', (subject) => subject.presentations)),
100
+ ...SOURCE_TEST_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) => lift(tool, 'runtime journey', (subject) => subject.execution)),
101
+ ...VANTAGE_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) => lift(tool, 'live journey/events', (subject) => subject.vantage)),
102
+ ...EYES_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) => lift(tool, 'Eyes attention', (subject) => subject.eyes)),
103
+ testingSurface,
104
+ ...SCENARIO_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) => lift(tool, 'scenario AAA', (subject) => subject.scenarios)),
105
+ diff,
106
+ ];
107
+ export function observabilityToolByName(name) {
108
+ return OBSERVABILITY_TOOLS.find((tool) => tool.name === name);
109
+ }
110
+ function lift(tool, domain, read) {
111
+ return {
112
+ name: tool.name,
113
+ description: tool.description,
114
+ inputSchema: tool.inputSchema,
115
+ run(subject, input, invocation) {
116
+ const evidence = read(subject);
117
+ if (evidence === undefined) {
118
+ throw new Error(`${domain} evidence is unavailable to this MCP connection`);
119
+ }
120
+ const previous = invocation?.previous === undefined
121
+ ? undefined
122
+ : read(invocation.previous);
123
+ return tool.run(evidence, input, previous === undefined ? undefined : { previous });
124
+ },
125
+ };
126
+ }
127
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,IAAI,E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S,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { EyesArchive } from '@variance-authority/eyes';\nimport type { PresentationReport } from '@variance-authority/presentation';\nimport type { ExecutionIndex } from '@variance-authority/sense/test-selection';\nimport type { VantageState } from '@variance-authority/vantage';\nimport type { ObservabilitySubject } from './observability-subject.js';\nimport { adjudicate } from './tools/adjudicate.js';\nimport { changelog } from './tools/changelog.js';\nimport { changes } from './tools/changes.js';\nimport { composition } from './tools/composition.js';\nimport { describe } from './tools/describe.js';\nimport { diff, diffState, type StateDifference } from './tools/diff.js';\nimport { explain } from './tools/explain-verdict.js';\nimport { findings } from './tools/findings.js';\nimport { summarize } from './tools/summary.js';\nimport { attention } from './tools/attention.js';\nimport { observability, testingSurface } from './tools/observability.js';\nimport { presentations, type PresentationEvidence } from './tools/presentations.js';\nimport { scenarios, type ScenarioEvidence } from './tools/scenarios.js';\nimport { sourceTests } from './tools/source-tests.js';\nimport { runSignals } from './tools/run-signals.js';\nimport { testSignals } from './tools/test-signals.js';\nimport { NO_ARGS, stringArg, type Tool } from './tools/tool.js';\nimport { trace } from './tools/trace-component.js';\nimport { variations } from './tools/variations.js';\n\n/**\n * The tools, as pure functions over a run report.\n *\n * Separated from the transport deliberately. A tool implementation tangled into\n * a JSON-RPC handler can only be exercised by speaking JSON-RPC at it, and the\n * interesting question — *does this answer help an agent fix the thing?* — then\n * becomes the hardest thing in the package to ask.\n *\n * Every answer is text, and the shape of that text is the product. An agent does\n * not benefit from a JSON blob it has to interpret; it benefits from the same\n * sentence a person would want, with a file path on the end. So these read like\n * the report does: cause first, collateral counted, and a path an editor opens.\n *\n * `variance_adjudicate` is the one tool that takes evidence *in*. It follows\n * `summary` and `changes` because it needs nothing they printed and everything\n * they cannot supply: an agent's own account of what it was doing. The other report tools\n * answer *what changed*; this one answers *what changed against what you claimed*, and\n * its third arm — declared, and did not happen — is the only thing here that can\n * catch an edit which never landed. An agent that has just edited something\n * should call it before `describe`, and an agent reviewing somebody else's run\n * has nothing to declare and should skip it.\n *\n * One tool per module under `./tools/`, and this file is the list. Each answer is\n * a paragraph somebody argued about, and the arguments do not compose — the\n * reason the summary refuses to say \"nothing to review\" has nothing to do with\n * the reason findings are grouped by rule — so they are read, and edited, one at\n * a time. What stays here is the only thing that is genuinely about the set:\n * the order, which is the order `tools/list` announces them in and therefore the\n * order an agent meets them in. `variance_summary` is first because every report\n * tool takes an argument it printed. `variance_diff` sits beside it as the session\n * question, and `variance_changes` follows because it\n * is the one that decides how many of the rest get called: an agent that walks\n * forty changed subjects one at a time spends forty calls learning what one call\n * says, which is *three things happened and one of them explains thirty-one*.\n *\n * `variance_composition` follows `adjudicate`, and the boundary it sits on is\n * the one worth seeing: the first seven answer about the *suite* and the last four narrow to a\n * subject. It goes after `changes` rather than before because the two reshape\n * the same run along different axes and only one of them is about this run's\n * diff — `changes` says which decisions there are, and this says which component\n * and which caller is behind one, including when the answer is *nothing in this\n * run*.\n *\n * `variance_variations` follows it, on the same axis and one step further out. Both\n * compare this run to itself; `composition` compares subjects that were never\n * meant to differ, and this compares the ones that were. It is the only tool here\n * whose answer is not, in any reading, a finding — which is why it is neither\n * earlier (an agent triaging a visual diff would spend a call learning that a dark story\n * is dark) nor omitted (when a change *is* to a flagged component, what the flag\n * does is the first thing the reviewer does not know).\n *\n * `variance_changelog` closes the suite-level group because it is the only tool\n * here that is not about the run. The other report tools describe what a run observed;\n * this one describes what *accepting* it would write down, and that answer is\n * the last thing an agent needs before it proposes a command. Its position is\n * also a claim about when it stops being useful: after acceptance there is\n * nothing to preview, because the record exists and `git log` has it.\n *\n * It is the second tool whose answer changes with the agent's own input, and\n * unlike `adjudicate` the input is not evidence — it is the selection, the same\n * one `accept` takes. That is why it must not be earlier: an agent that has not\n * yet read `changes` has no shape to ask about, and would be told what `--all`\n * records before knowing whether `--all` is what it wants.\n */\n\nexport type { Served, Tool, ToolInvocation } from './tools/tool.js';\nexport type { StateDifference };\n\n// The tool-authoring contract, not an implementation detail of this set. A\n// server over another subject writes tools against the same interface, and the\n// first thing any tool does with a model's argument is refuse it or narrow it.\nexport { NO_ARGS, stringArg };\nexport { notObservedSentence } from './tools/subject.js';\nexport { diffState };\n\n/** The source-to-named-test tool set for an MCP server over an execution index. */\nexport const SOURCE_TEST_TOOLS = [sourceTests, diff as Tool<ExecutionIndex>] as const;\n\n/** Look up one source-test tool without widening it to the visual-report subject. */\nexport function sourceTestToolByName(name: string): Tool<ExecutionIndex> | undefined {\n return SOURCE_TEST_TOOLS.find((tool) => tool.name === name);\n}\n\n/**\n * The tool set for a watcher attached to a suite that is still running.\n *\n * A third subject, and the first one that is not a thing somebody produced. The\n * report tools answer about a run that finished and the source-test tools answer\n * about an index that was written; these answer about a run *in flight*, held in\n * the memory of the process answering, and gone when it exits.\n *\n * The listing comes first for the same reason `variance_summary` does: the other\n * two take an argument it printed. `variance_diff` is last here rather than\n * second, because on a live subject it is not the session question but the\n * *progress* question — what the suite did between two asks — and that is only\n * worth asking once a reader knows what they are watching.\n */\nexport const VANTAGE_TOOLS = [\n runSignals,\n testSignals,\n diff as Tool<VantageState>,\n] as const;\n\n/** Look up one live-run tool without widening it to the visual-report subject. */\nexport function vantageToolByName(name: string): Tool<VantageState> | undefined {\n return VANTAGE_TOOLS.find((tool) => tool.name === name);\n}\n\nexport const TOOLS: readonly Tool[] = [\n summarize,\n diff,\n changes,\n adjudicate,\n composition,\n variations,\n changelog,\n describe,\n findings,\n trace,\n explain,\n];\n\nexport function toolByName(name: string): Tool | undefined {\n return TOOLS.find((tool) => tool.name === name);\n}\n\n/** Full presentation graphs supplied by the caller, independent of report projections. */\nexport const PRESENTATION_TOOLS = [\n presentations,\n diff as Tool<PresentationEvidence>,\n] as const;\n\nexport function presentationToolByName(name: string): Tool<readonly PresentationReport[]> | undefined {\n return PRESENTATION_TOOLS.find((tool) => tool.name === name);\n}\n\n/** Test attention captured synchronously while DOM nodes still have attribution. */\nexport const EYES_TOOLS = [attention, diff as Tool<EyesArchive>] as const;\n\nexport function eyesToolByName(name: string): Tool<EyesArchive> | undefined {\n return EYES_TOOLS.find((tool) => tool.name === name);\n}\n\n/** Retained scenario executions, including witnessed Arrange state and Act outcomes. */\nexport const SCENARIO_TOOLS = [scenarios, diff as Tool<ScenarioEvidence>] as const;\n\nexport function scenarioToolByName(name: string): Tool<ScenarioEvidence> | undefined {\n return SCENARIO_TOOLS.find((tool) => tool.name === name);\n}\n\n/**\n * Every independently supplied observability domain behind one MCP connection.\n *\n * Native tools are lifted without changing their answers. A missing field is a\n * tool error, not an empty subject, and previous invocation state is projected\n * through the same field before a native diff sees it.\n */\nexport const OBSERVABILITY_TOOLS: readonly Tool<ObservabilitySubject>[] = [\n observability,\n ...TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) =>\n lift(tool, 'visual/report', (subject) => subject.report)),\n ...PRESENTATION_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) =>\n lift(tool, 'presentation readings', (subject) => subject.presentations)),\n ...SOURCE_TEST_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) =>\n lift(tool, 'runtime journey', (subject) => subject.execution)),\n ...VANTAGE_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) =>\n lift(tool, 'live journey/events', (subject) => subject.vantage)),\n ...EYES_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) =>\n lift(tool, 'Eyes attention', (subject) => subject.eyes)),\n testingSurface,\n ...SCENARIO_TOOLS.filter((tool) => tool.name !== 'variance_diff').map((tool) =>\n lift(tool, 'scenario AAA', (subject) => subject.scenarios)),\n diff as Tool<ObservabilitySubject>,\n];\n\nexport function observabilityToolByName(name: string): Tool<ObservabilitySubject> | undefined {\n return OBSERVABILITY_TOOLS.find((tool) => tool.name === name);\n}\n\nfunction lift<Subject>(\n tool: Tool<Subject>,\n domain: string,\n read: (subject: ObservabilitySubject) => Subject | undefined,\n): Tool<ObservabilitySubject> {\n return {\n name: tool.name,\n description: tool.description,\n inputSchema: tool.inputSchema,\n run(subject, input, invocation) {\n const evidence = read(subject);\n if (evidence === undefined) {\n throw new Error(`${domain} evidence is unavailable to this MCP connection`);\n }\n const previous = invocation?.previous === undefined\n ? undefined\n : read(invocation.previous);\n return tool.run(evidence, input, previous === undefined ? undefined : { previous });\n },\n };\n}\n"]}
package/mark.svg ADDED
@@ -0,0 +1,30 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 320" role="img" aria-labelledby="title desc">
2
+ <title id="title">Variance Authority mark</title>
3
+ <desc id="desc">Folded ribbon VA mark in charcoal and orange.</desc>
4
+
5
+ <defs>
6
+ <style>
7
+ .ribbon-dark {
8
+ fill: #24282A;
9
+ }
10
+
11
+ @media (prefers-color-scheme: dark) {
12
+ .ribbon-dark {
13
+ fill: #F3F4F6;
14
+ }
15
+ }
16
+ </style>
17
+ </defs>
18
+
19
+ <!-- Left descending ribbon -->
20
+ <path class="ribbon-dark" d="M64 54H159L256 266H160Z"/>
21
+
22
+ <!-- Right descending ribbon -->
23
+ <path class="ribbon-dark" d="M331 28H419L494 266H397Z"/>
24
+
25
+ <!-- Chosen / variant ribbon -->
26
+ <path d="M256 266L202 152L283 28H376L301 165Z" fill="#FF4A19"/>
27
+
28
+ <!-- Fold shadow -->
29
+ <path d="M202 152L256 266L301 165L264 103Z" fill="#D83A13" opacity="0.72"/>
30
+ </svg>
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@variance-authority/mcp",
3
+ "version": "0.1.0",
4
+ "description": "Expose independently supplied observability evidence to an MCP client.",
5
+ "keywords": [
6
+ "variance-authority",
7
+ "visual-regression",
8
+ "mcp",
9
+ "model-context-protocol",
10
+ "agent",
11
+ "ai"
12
+ ],
13
+ "license": "MIT",
14
+ "author": "Machine Garden",
15
+ "homepage": "https://variance-authority.dev#packages",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/Variance-Authority/variance-authority.git",
19
+ "directory": "packages/mcp"
20
+ },
21
+ "bugs": "https://github.com/Variance-Authority/variance-authority/issues",
22
+ "engines": {
23
+ "node": ">=22"
24
+ },
25
+ "type": "module",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./tools": {
32
+ "types": "./dist/tools.d.ts",
33
+ "default": "./dist/tools.js"
34
+ },
35
+ "./protocol": {
36
+ "types": "./dist/protocol.d.ts",
37
+ "default": "./dist/protocol.js"
38
+ }
39
+ },
40
+ "main": "./dist/index.js",
41
+ "types": "./dist/index.d.ts",
42
+ "bin": {
43
+ "variance-authority-mcp": "./dist/bin.js"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "!dist/**/*.d.ts.map",
48
+ "mark.svg"
49
+ ],
50
+ "scripts": {
51
+ "build": "tsc --build"
52
+ },
53
+ "dependencies": {
54
+ "@variance-authority/eyes": "^0.1.0",
55
+ "@variance-authority/presentation": "^0.1.0",
56
+ "@variance-authority/report": "^0.1.0",
57
+ "@variance-authority/scenario": "^0.1.0",
58
+ "@variance-authority/sense": "^0.1.0",
59
+ "@variance-authority/vantage": "^0.1.0"
60
+ },
61
+ "devDependencies": {
62
+ "@variance-authority/core": "^0.1.0"
63
+ }
64
+ }