@contractspec/bundle.library 3.8.2 → 3.8.5
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/.turbo/turbo-build.log +130 -116
- package/CHANGELOG.md +80 -0
- package/dist/application/index.js +806 -131
- package/dist/application/mcp/cliMcp.js +21 -2
- package/dist/application/mcp/common.js +21 -2
- package/dist/application/mcp/common.test.d.ts +1 -0
- package/dist/application/mcp/contractsMcp.js +21 -2
- package/dist/application/mcp/docsMcp.catalog.d.ts +2 -0
- package/dist/application/mcp/docsMcp.catalog.js +382 -0
- package/dist/application/mcp/docsMcp.d.ts +5 -1
- package/dist/application/mcp/docsMcp.data.d.ts +85 -0
- package/dist/application/mcp/docsMcp.data.js +148 -0
- package/dist/application/mcp/docsMcp.js +776 -101
- package/dist/application/mcp/docsMcp.prompts.d.ts +3 -0
- package/dist/application/mcp/docsMcp.prompts.js +522 -0
- package/dist/application/mcp/docsMcp.reference.d.ts +24 -0
- package/dist/application/mcp/docsMcp.reference.js +236 -0
- package/dist/application/mcp/docsMcp.resources.d.ts +3 -0
- package/dist/application/mcp/docsMcp.resources.js +520 -0
- package/dist/application/mcp/docsMcp.test.d.ts +1 -0
- package/dist/application/mcp/docsMcp.tools.d.ts +3 -0
- package/dist/application/mcp/docsMcp.tools.js +519 -0
- package/dist/application/mcp/index.js +806 -131
- package/dist/application/mcp/internalMcp.js +21 -2
- package/dist/application/mcp/normalizeMcpRequest.d.ts +1 -0
- package/dist/application/mcp/normalizeMcpRequest.js +22 -0
- package/dist/application/mcp/providerRankingMcp.js +21 -2
- package/dist/components/docs/generated/docs-index.generated.d.ts +6 -6
- package/dist/components/docs/index.js +23 -24
- package/dist/components/docs/libraries/LibrariesAiAgentPage.js +22 -22
- package/dist/components/docs/libraries/LibrariesSupportBotPage.js +1 -2
- package/dist/components/docs/libraries/index.js +23 -24
- package/dist/components/templates/engine/index.d.ts +1 -1
- package/dist/components/templates/engine/index.js +1 -1
- package/dist/features/index.js +15 -15
- package/dist/index.js +194 -195
- package/dist/node/application/index.js +806 -131
- package/dist/node/application/mcp/cliMcp.js +21 -2
- package/dist/node/application/mcp/common.js +21 -2
- package/dist/node/application/mcp/contractsMcp.js +21 -2
- package/dist/node/application/mcp/docsMcp.catalog.js +381 -0
- package/dist/node/application/mcp/docsMcp.data.js +147 -0
- package/dist/node/application/mcp/docsMcp.js +776 -101
- package/dist/node/application/mcp/docsMcp.prompts.js +521 -0
- package/dist/node/application/mcp/docsMcp.reference.js +235 -0
- package/dist/node/application/mcp/docsMcp.resources.js +519 -0
- package/dist/node/application/mcp/docsMcp.tools.js +518 -0
- package/dist/node/application/mcp/index.js +806 -131
- package/dist/node/application/mcp/internalMcp.js +21 -2
- package/dist/node/application/mcp/normalizeMcpRequest.js +21 -0
- package/dist/node/application/mcp/providerRankingMcp.js +21 -2
- package/dist/node/components/docs/index.js +23 -24
- package/dist/node/components/docs/libraries/LibrariesAiAgentPage.js +22 -22
- package/dist/node/components/docs/libraries/LibrariesSupportBotPage.js +1 -2
- package/dist/node/components/docs/libraries/index.js +23 -24
- package/dist/node/components/templates/engine/index.js +1 -1
- package/dist/node/features/index.js +15 -15
- package/dist/node/index.js +194 -195
- package/dist/node/presentation/features/hooks/index.js +12 -12
- package/dist/node/presentation/features/hooks/useContractsRegistry.js +12 -12
- package/dist/node/presentation/features/index.js +12 -12
- package/dist/node/presentation/features/organisms/FeatureDataViewsList.js +12 -12
- package/dist/node/presentation/features/organisms/FeatureEventsList.js +12 -12
- package/dist/node/presentation/features/organisms/FeatureFormsList.js +12 -12
- package/dist/node/presentation/features/organisms/FeaturePresentationsList.js +12 -12
- package/dist/node/presentation/features/organisms/index.js +12 -12
- package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/index.js +12 -12
- package/dist/node/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeatureEventsTemplate/index.js +12 -12
- package/dist/node/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeatureFormsTemplate/index.js +12 -12
- package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +12 -12
- package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/index.js +12 -12
- package/dist/presentation/features/hooks/index.js +12 -12
- package/dist/presentation/features/hooks/useContractsRegistry.js +12 -12
- package/dist/presentation/features/index.js +12 -12
- package/dist/presentation/features/organisms/FeatureDataViewsList.js +12 -12
- package/dist/presentation/features/organisms/FeatureEventsList.js +12 -12
- package/dist/presentation/features/organisms/FeatureFormsList.js +12 -12
- package/dist/presentation/features/organisms/FeaturePresentationsList.js +12 -12
- package/dist/presentation/features/organisms/index.js +12 -12
- package/dist/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeatureDataViewsTemplate/index.js +12 -12
- package/dist/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeatureEventsTemplate/index.js +12 -12
- package/dist/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeatureFormsTemplate/index.js +12 -12
- package/dist/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +12 -12
- package/dist/presentation/features/templates/FeaturePresentationsTemplate/index.js +12 -12
- package/package.json +108 -23
- package/src/application/mcp/common.test.ts +64 -0
- package/src/application/mcp/common.ts +5 -2
- package/src/application/mcp/docsMcp.catalog.ts +2 -0
- package/src/application/mcp/docsMcp.data.ts +196 -0
- package/src/application/mcp/docsMcp.prompts.ts +165 -0
- package/src/application/mcp/docsMcp.reference.ts +152 -0
- package/src/application/mcp/docsMcp.resources.ts +194 -0
- package/src/application/mcp/docsMcp.test.ts +148 -0
- package/src/application/mcp/docsMcp.tools.ts +183 -0
- package/src/application/mcp/docsMcp.ts +13 -177
- package/src/application/mcp/normalizeMcpRequest.ts +30 -0
- package/src/components/docs/generated/docs-index._common.json +1 -1
- package/src/components/docs/generated/docs-index.ai-chat-assistant.json +8 -0
- package/src/components/docs/generated/docs-index.artisan-knowledge-product.json +18 -0
- package/src/components/docs/generated/docs-index.artisan-payments-stripe.json +34 -0
- package/src/components/docs/generated/docs-index.data-grid-showcase.json +18 -0
- package/src/components/docs/generated/docs-index.generated.ts +6 -6
- package/src/components/docs/generated/docs-index.harness-lab.json +10 -0
- package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +8 -0
- package/src/components/docs/generated/docs-index.manifest.json +50 -5
- package/src/components/docs/generated/docs-index.messaging-agent-actions.json +18 -0
- package/src/components/docs/generated/docs-index.mobile-demo-tasks.json +34 -0
- package/src/components/docs/generated/docs-index.opencode-cli.json +2 -2
- package/src/components/docs/generated/docs-index.platform-control-plane.json +250 -0
- package/src/components/docs/generated/docs-index.platform-harness.json +178 -0
- package/src/components/docs/generated/docs-index.platform-integrations.json +22 -14
- package/src/components/docs/generated/docs-index.visualization-showcase.json +18 -0
- package/src/components/docs/libraries/LibrariesAiAgentPage.tsx +20 -17
- package/src/components/docs/libraries/LibrariesSupportBotPage.tsx +1 -2
- package/src/components/templates/engine/index.ts +2 -2
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/features/docs/docs.contracts.ts
|
|
3
|
-
import {
|
|
4
|
-
ContractReferenceQuery,
|
|
5
|
-
DocSummaryModel,
|
|
6
|
-
DocsIndexInput,
|
|
7
|
-
DocsIndexOutput,
|
|
8
|
-
DocsIndexQuery,
|
|
9
|
-
DocsIndexQuery as DocsIndexQuery2
|
|
10
|
-
} from "@contractspec/lib.contracts-spec/docs";
|
|
11
2
|
// src/features/contracts-registry.ts
|
|
12
3
|
import {
|
|
13
4
|
EventRegistry,
|
|
@@ -18,11 +9,11 @@ import {
|
|
|
18
9
|
} from "@contractspec/lib.contracts-spec/data-views";
|
|
19
10
|
import {
|
|
20
11
|
ContractReferenceDataView,
|
|
21
|
-
ContractReferenceQuery
|
|
12
|
+
ContractReferenceQuery,
|
|
22
13
|
DocsGenerateCommand,
|
|
23
14
|
DocsGeneratedEvent,
|
|
24
15
|
DocsIndexDataView,
|
|
25
|
-
DocsIndexQuery
|
|
16
|
+
DocsIndexQuery,
|
|
26
17
|
DocsLayoutPresentation,
|
|
27
18
|
DocsPublishCommand,
|
|
28
19
|
DocsPublishedEvent,
|
|
@@ -44,7 +35,7 @@ import {
|
|
|
44
35
|
var operationRegistry = null;
|
|
45
36
|
function createContractSpecOperationRegistry() {
|
|
46
37
|
const registry = new OperationSpecRegistry;
|
|
47
|
-
registry.register(
|
|
38
|
+
registry.register(DocsIndexQuery).register(ContractReferenceQuery).register(DocsGenerateCommand).register(DocsPublishCommand);
|
|
48
39
|
return registry;
|
|
49
40
|
}
|
|
50
41
|
function getContractSpecOperationRegistry() {
|
|
@@ -190,6 +181,15 @@ var DocsFeature = {
|
|
|
190
181
|
}
|
|
191
182
|
};
|
|
192
183
|
|
|
184
|
+
// src/features/docs/docs.contracts.ts
|
|
185
|
+
import {
|
|
186
|
+
ContractReferenceQuery as ContractReferenceQuery2,
|
|
187
|
+
DocSummaryModel,
|
|
188
|
+
DocsIndexInput,
|
|
189
|
+
DocsIndexOutput,
|
|
190
|
+
DocsIndexQuery as DocsIndexQuery2,
|
|
191
|
+
DocsIndexQuery as DocsIndexQuery3
|
|
192
|
+
} from "@contractspec/lib.contracts-spec/docs";
|
|
193
193
|
// src/features/mcp.feature.ts
|
|
194
194
|
var MCPFeature = {
|
|
195
195
|
meta: {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/features/docs/docs.contracts.ts
|
|
3
|
-
import {
|
|
4
|
-
ContractReferenceQuery,
|
|
5
|
-
DocSummaryModel,
|
|
6
|
-
DocsIndexInput,
|
|
7
|
-
DocsIndexOutput,
|
|
8
|
-
DocsIndexQuery,
|
|
9
|
-
DocsIndexQuery as DocsIndexQuery2
|
|
10
|
-
} from "@contractspec/lib.contracts-spec/docs";
|
|
11
2
|
// src/features/contracts-registry.ts
|
|
12
3
|
import {
|
|
13
4
|
EventRegistry,
|
|
@@ -18,11 +9,11 @@ import {
|
|
|
18
9
|
} from "@contractspec/lib.contracts-spec/data-views";
|
|
19
10
|
import {
|
|
20
11
|
ContractReferenceDataView,
|
|
21
|
-
ContractReferenceQuery
|
|
12
|
+
ContractReferenceQuery,
|
|
22
13
|
DocsGenerateCommand,
|
|
23
14
|
DocsGeneratedEvent,
|
|
24
15
|
DocsIndexDataView,
|
|
25
|
-
DocsIndexQuery
|
|
16
|
+
DocsIndexQuery,
|
|
26
17
|
DocsLayoutPresentation,
|
|
27
18
|
DocsPublishCommand,
|
|
28
19
|
DocsPublishedEvent,
|
|
@@ -44,7 +35,7 @@ import {
|
|
|
44
35
|
var operationRegistry = null;
|
|
45
36
|
function createContractSpecOperationRegistry() {
|
|
46
37
|
const registry = new OperationSpecRegistry;
|
|
47
|
-
registry.register(
|
|
38
|
+
registry.register(DocsIndexQuery).register(ContractReferenceQuery).register(DocsGenerateCommand).register(DocsPublishCommand);
|
|
48
39
|
return registry;
|
|
49
40
|
}
|
|
50
41
|
function getContractSpecOperationRegistry() {
|
|
@@ -190,6 +181,15 @@ var DocsFeature = {
|
|
|
190
181
|
}
|
|
191
182
|
};
|
|
192
183
|
|
|
184
|
+
// src/features/docs/docs.contracts.ts
|
|
185
|
+
import {
|
|
186
|
+
ContractReferenceQuery as ContractReferenceQuery2,
|
|
187
|
+
DocSummaryModel,
|
|
188
|
+
DocsIndexInput,
|
|
189
|
+
DocsIndexOutput,
|
|
190
|
+
DocsIndexQuery as DocsIndexQuery2,
|
|
191
|
+
DocsIndexQuery as DocsIndexQuery3
|
|
192
|
+
} from "@contractspec/lib.contracts-spec/docs";
|
|
193
193
|
// src/features/mcp.feature.ts
|
|
194
194
|
var MCPFeature = {
|
|
195
195
|
meta: {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/features/docs/docs.contracts.ts
|
|
3
|
-
import {
|
|
4
|
-
ContractReferenceQuery,
|
|
5
|
-
DocSummaryModel,
|
|
6
|
-
DocsIndexInput,
|
|
7
|
-
DocsIndexOutput,
|
|
8
|
-
DocsIndexQuery,
|
|
9
|
-
DocsIndexQuery as DocsIndexQuery2
|
|
10
|
-
} from "@contractspec/lib.contracts-spec/docs";
|
|
11
2
|
// src/features/contracts-registry.ts
|
|
12
3
|
import {
|
|
13
4
|
EventRegistry,
|
|
@@ -18,11 +9,11 @@ import {
|
|
|
18
9
|
} from "@contractspec/lib.contracts-spec/data-views";
|
|
19
10
|
import {
|
|
20
11
|
ContractReferenceDataView,
|
|
21
|
-
ContractReferenceQuery
|
|
12
|
+
ContractReferenceQuery,
|
|
22
13
|
DocsGenerateCommand,
|
|
23
14
|
DocsGeneratedEvent,
|
|
24
15
|
DocsIndexDataView,
|
|
25
|
-
DocsIndexQuery
|
|
16
|
+
DocsIndexQuery,
|
|
26
17
|
DocsLayoutPresentation,
|
|
27
18
|
DocsPublishCommand,
|
|
28
19
|
DocsPublishedEvent,
|
|
@@ -44,7 +35,7 @@ import {
|
|
|
44
35
|
var operationRegistry = null;
|
|
45
36
|
function createContractSpecOperationRegistry() {
|
|
46
37
|
const registry = new OperationSpecRegistry;
|
|
47
|
-
registry.register(
|
|
38
|
+
registry.register(DocsIndexQuery).register(ContractReferenceQuery).register(DocsGenerateCommand).register(DocsPublishCommand);
|
|
48
39
|
return registry;
|
|
49
40
|
}
|
|
50
41
|
function getContractSpecOperationRegistry() {
|
|
@@ -190,6 +181,15 @@ var DocsFeature = {
|
|
|
190
181
|
}
|
|
191
182
|
};
|
|
192
183
|
|
|
184
|
+
// src/features/docs/docs.contracts.ts
|
|
185
|
+
import {
|
|
186
|
+
ContractReferenceQuery as ContractReferenceQuery2,
|
|
187
|
+
DocSummaryModel,
|
|
188
|
+
DocsIndexInput,
|
|
189
|
+
DocsIndexOutput,
|
|
190
|
+
DocsIndexQuery as DocsIndexQuery2,
|
|
191
|
+
DocsIndexQuery as DocsIndexQuery3
|
|
192
|
+
} from "@contractspec/lib.contracts-spec/docs";
|
|
193
193
|
// src/features/mcp.feature.ts
|
|
194
194
|
var MCPFeature = {
|
|
195
195
|
meta: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/bundle.library",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -rf dist",
|
|
@@ -84,12 +84,54 @@
|
|
|
84
84
|
"node": "./dist/node/application/mcp/docsMcp.js",
|
|
85
85
|
"default": "./dist/application/mcp/docsMcp.js"
|
|
86
86
|
},
|
|
87
|
+
"./application/mcp/docsMcp.catalog": {
|
|
88
|
+
"types": "./dist/application/mcp/docsMcp.catalog.d.ts",
|
|
89
|
+
"bun": "./dist/application/mcp/docsMcp.catalog.js",
|
|
90
|
+
"node": "./dist/node/application/mcp/docsMcp.catalog.js",
|
|
91
|
+
"default": "./dist/application/mcp/docsMcp.catalog.js"
|
|
92
|
+
},
|
|
93
|
+
"./application/mcp/docsMcp.data": {
|
|
94
|
+
"types": "./dist/application/mcp/docsMcp.data.d.ts",
|
|
95
|
+
"bun": "./dist/application/mcp/docsMcp.data.js",
|
|
96
|
+
"node": "./dist/node/application/mcp/docsMcp.data.js",
|
|
97
|
+
"default": "./dist/application/mcp/docsMcp.data.js"
|
|
98
|
+
},
|
|
99
|
+
"./application/mcp/docsMcp.prompts": {
|
|
100
|
+
"types": "./dist/application/mcp/docsMcp.prompts.d.ts",
|
|
101
|
+
"bun": "./dist/application/mcp/docsMcp.prompts.js",
|
|
102
|
+
"node": "./dist/node/application/mcp/docsMcp.prompts.js",
|
|
103
|
+
"default": "./dist/application/mcp/docsMcp.prompts.js"
|
|
104
|
+
},
|
|
105
|
+
"./application/mcp/docsMcp.reference": {
|
|
106
|
+
"types": "./dist/application/mcp/docsMcp.reference.d.ts",
|
|
107
|
+
"bun": "./dist/application/mcp/docsMcp.reference.js",
|
|
108
|
+
"node": "./dist/node/application/mcp/docsMcp.reference.js",
|
|
109
|
+
"default": "./dist/application/mcp/docsMcp.reference.js"
|
|
110
|
+
},
|
|
111
|
+
"./application/mcp/docsMcp.resources": {
|
|
112
|
+
"types": "./dist/application/mcp/docsMcp.resources.d.ts",
|
|
113
|
+
"bun": "./dist/application/mcp/docsMcp.resources.js",
|
|
114
|
+
"node": "./dist/node/application/mcp/docsMcp.resources.js",
|
|
115
|
+
"default": "./dist/application/mcp/docsMcp.resources.js"
|
|
116
|
+
},
|
|
117
|
+
"./application/mcp/docsMcp.tools": {
|
|
118
|
+
"types": "./dist/application/mcp/docsMcp.tools.d.ts",
|
|
119
|
+
"bun": "./dist/application/mcp/docsMcp.tools.js",
|
|
120
|
+
"node": "./dist/node/application/mcp/docsMcp.tools.js",
|
|
121
|
+
"default": "./dist/application/mcp/docsMcp.tools.js"
|
|
122
|
+
},
|
|
87
123
|
"./application/mcp/internalMcp": {
|
|
88
124
|
"types": "./dist/application/mcp/internalMcp.d.ts",
|
|
89
125
|
"bun": "./dist/application/mcp/internalMcp.js",
|
|
90
126
|
"node": "./dist/node/application/mcp/internalMcp.js",
|
|
91
127
|
"default": "./dist/application/mcp/internalMcp.js"
|
|
92
128
|
},
|
|
129
|
+
"./application/mcp/normalizeMcpRequest": {
|
|
130
|
+
"types": "./dist/application/mcp/normalizeMcpRequest.d.ts",
|
|
131
|
+
"bun": "./dist/application/mcp/normalizeMcpRequest.js",
|
|
132
|
+
"node": "./dist/node/application/mcp/normalizeMcpRequest.js",
|
|
133
|
+
"default": "./dist/application/mcp/normalizeMcpRequest.js"
|
|
134
|
+
},
|
|
93
135
|
"./application/mcp/providerRankingMcp": {
|
|
94
136
|
"types": "./dist/application/mcp/providerRankingMcp.d.ts",
|
|
95
137
|
"bun": "./dist/application/mcp/providerRankingMcp.js",
|
|
@@ -1826,23 +1868,23 @@
|
|
|
1826
1868
|
"dependencies": {
|
|
1827
1869
|
"@apollo/client": "^4.1.6",
|
|
1828
1870
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
1829
|
-
"@contractspec/lib.ai-providers": "3.7.
|
|
1830
|
-
"@contractspec/lib.contracts-spec": "
|
|
1831
|
-
"@contractspec/lib.contracts-library": "3.7.
|
|
1832
|
-
"@contractspec/lib.content-gen": "3.7.
|
|
1833
|
-
"@contractspec/lib.contracts-runtime-server-mcp": "3.7.
|
|
1834
|
-
"@contractspec/lib.design-system": "3.8.
|
|
1835
|
-
"@contractspec/lib.surface-runtime": "0.5.
|
|
1836
|
-
"@contractspec/lib.provider-ranking": "0.7.
|
|
1837
|
-
"@contractspec/lib.example-shared-ui": "6.0.
|
|
1838
|
-
"@contractspec/lib.knowledge": "3.7.
|
|
1839
|
-
"@contractspec/lib.logger": "3.7.
|
|
1840
|
-
"@contractspec/lib.runtime-sandbox": "2.7.
|
|
1841
|
-
"@contractspec/lib.schema": "3.7.
|
|
1842
|
-
"@contractspec/lib.ui-kit-web": "3.9.
|
|
1843
|
-
"@contractspec/lib.ui-link": "3.7.
|
|
1844
|
-
"@contractspec/module.context-storage": "0.7.
|
|
1845
|
-
"@contractspec/module.examples": "3.8.
|
|
1871
|
+
"@contractspec/lib.ai-providers": "3.7.9",
|
|
1872
|
+
"@contractspec/lib.contracts-spec": "5.0.0",
|
|
1873
|
+
"@contractspec/lib.contracts-library": "3.7.12",
|
|
1874
|
+
"@contractspec/lib.content-gen": "3.7.12",
|
|
1875
|
+
"@contractspec/lib.contracts-runtime-server-mcp": "3.7.12",
|
|
1876
|
+
"@contractspec/lib.design-system": "3.8.5",
|
|
1877
|
+
"@contractspec/lib.surface-runtime": "0.5.12",
|
|
1878
|
+
"@contractspec/lib.provider-ranking": "0.7.9",
|
|
1879
|
+
"@contractspec/lib.example-shared-ui": "6.0.12",
|
|
1880
|
+
"@contractspec/lib.knowledge": "3.7.12",
|
|
1881
|
+
"@contractspec/lib.logger": "3.7.9",
|
|
1882
|
+
"@contractspec/lib.runtime-sandbox": "2.7.10",
|
|
1883
|
+
"@contractspec/lib.schema": "3.7.10",
|
|
1884
|
+
"@contractspec/lib.ui-kit-web": "3.9.4",
|
|
1885
|
+
"@contractspec/lib.ui-link": "3.7.9",
|
|
1886
|
+
"@contractspec/module.context-storage": "0.7.12",
|
|
1887
|
+
"@contractspec/module.examples": "3.8.4",
|
|
1846
1888
|
"@dnd-kit/core": "^6.1.0",
|
|
1847
1889
|
"@dnd-kit/sortable": "^10.0.0",
|
|
1848
1890
|
"@dnd-kit/utilities": "^3.2.2",
|
|
@@ -1858,16 +1900,17 @@
|
|
|
1858
1900
|
"posthog-react-native": "^4.37.4",
|
|
1859
1901
|
"react-hook-form": "^7.71.2",
|
|
1860
1902
|
"zod": "^4.3.5",
|
|
1861
|
-
"@contractspec/lib.contracts-integrations": "3.8.
|
|
1862
|
-
"@contractspec/lib.contracts-runtime-server-rest": "3.7.
|
|
1863
|
-
"@contractspec/lib.contracts-runtime-server-graphql": "3.7.
|
|
1903
|
+
"@contractspec/lib.contracts-integrations": "3.8.4",
|
|
1904
|
+
"@contractspec/lib.contracts-runtime-server-rest": "3.7.12",
|
|
1905
|
+
"@contractspec/lib.contracts-runtime-server-graphql": "3.7.12",
|
|
1906
|
+
"@contractspec/lib.contracts-runtime-client-react": "3.8.0"
|
|
1864
1907
|
},
|
|
1865
1908
|
"devDependencies": {
|
|
1866
1909
|
"@types/react": "~19.2.14",
|
|
1867
|
-
"@contractspec/tool.typescript": "3.7.
|
|
1910
|
+
"@contractspec/tool.typescript": "3.7.9",
|
|
1868
1911
|
"typescript": "^5.9.3",
|
|
1869
1912
|
"@types/bun": "~1.3.11",
|
|
1870
|
-
"@contractspec/tool.bun": "3.7.
|
|
1913
|
+
"@contractspec/tool.bun": "3.7.9"
|
|
1871
1914
|
},
|
|
1872
1915
|
"repository": {
|
|
1873
1916
|
"type": "git",
|
|
@@ -1944,12 +1987,54 @@
|
|
|
1944
1987
|
"node": "./dist/node/application/mcp/docsMcp.js",
|
|
1945
1988
|
"default": "./dist/application/mcp/docsMcp.js"
|
|
1946
1989
|
},
|
|
1990
|
+
"./application/mcp/docsMcp.catalog": {
|
|
1991
|
+
"types": "./dist/application/mcp/docsMcp.catalog.d.ts",
|
|
1992
|
+
"bun": "./dist/application/mcp/docsMcp.catalog.js",
|
|
1993
|
+
"node": "./dist/node/application/mcp/docsMcp.catalog.js",
|
|
1994
|
+
"default": "./dist/application/mcp/docsMcp.catalog.js"
|
|
1995
|
+
},
|
|
1996
|
+
"./application/mcp/docsMcp.data": {
|
|
1997
|
+
"types": "./dist/application/mcp/docsMcp.data.d.ts",
|
|
1998
|
+
"bun": "./dist/application/mcp/docsMcp.data.js",
|
|
1999
|
+
"node": "./dist/node/application/mcp/docsMcp.data.js",
|
|
2000
|
+
"default": "./dist/application/mcp/docsMcp.data.js"
|
|
2001
|
+
},
|
|
2002
|
+
"./application/mcp/docsMcp.prompts": {
|
|
2003
|
+
"types": "./dist/application/mcp/docsMcp.prompts.d.ts",
|
|
2004
|
+
"bun": "./dist/application/mcp/docsMcp.prompts.js",
|
|
2005
|
+
"node": "./dist/node/application/mcp/docsMcp.prompts.js",
|
|
2006
|
+
"default": "./dist/application/mcp/docsMcp.prompts.js"
|
|
2007
|
+
},
|
|
2008
|
+
"./application/mcp/docsMcp.reference": {
|
|
2009
|
+
"types": "./dist/application/mcp/docsMcp.reference.d.ts",
|
|
2010
|
+
"bun": "./dist/application/mcp/docsMcp.reference.js",
|
|
2011
|
+
"node": "./dist/node/application/mcp/docsMcp.reference.js",
|
|
2012
|
+
"default": "./dist/application/mcp/docsMcp.reference.js"
|
|
2013
|
+
},
|
|
2014
|
+
"./application/mcp/docsMcp.resources": {
|
|
2015
|
+
"types": "./dist/application/mcp/docsMcp.resources.d.ts",
|
|
2016
|
+
"bun": "./dist/application/mcp/docsMcp.resources.js",
|
|
2017
|
+
"node": "./dist/node/application/mcp/docsMcp.resources.js",
|
|
2018
|
+
"default": "./dist/application/mcp/docsMcp.resources.js"
|
|
2019
|
+
},
|
|
2020
|
+
"./application/mcp/docsMcp.tools": {
|
|
2021
|
+
"types": "./dist/application/mcp/docsMcp.tools.d.ts",
|
|
2022
|
+
"bun": "./dist/application/mcp/docsMcp.tools.js",
|
|
2023
|
+
"node": "./dist/node/application/mcp/docsMcp.tools.js",
|
|
2024
|
+
"default": "./dist/application/mcp/docsMcp.tools.js"
|
|
2025
|
+
},
|
|
1947
2026
|
"./application/mcp/internalMcp": {
|
|
1948
2027
|
"types": "./dist/application/mcp/internalMcp.d.ts",
|
|
1949
2028
|
"bun": "./dist/application/mcp/internalMcp.js",
|
|
1950
2029
|
"node": "./dist/node/application/mcp/internalMcp.js",
|
|
1951
2030
|
"default": "./dist/application/mcp/internalMcp.js"
|
|
1952
2031
|
},
|
|
2032
|
+
"./application/mcp/normalizeMcpRequest": {
|
|
2033
|
+
"types": "./dist/application/mcp/normalizeMcpRequest.d.ts",
|
|
2034
|
+
"bun": "./dist/application/mcp/normalizeMcpRequest.js",
|
|
2035
|
+
"node": "./dist/node/application/mcp/normalizeMcpRequest.js",
|
|
2036
|
+
"default": "./dist/application/mcp/normalizeMcpRequest.js"
|
|
2037
|
+
},
|
|
1953
2038
|
"./application/mcp/providerRankingMcp": {
|
|
1954
2039
|
"types": "./dist/application/mcp/providerRankingMcp.d.ts",
|
|
1955
2040
|
"bun": "./dist/application/mcp/providerRankingMcp.js",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import {
|
|
3
|
+
OperationSpecRegistry,
|
|
4
|
+
PromptRegistry,
|
|
5
|
+
ResourceRegistry,
|
|
6
|
+
} from '@contractspec/lib.contracts-spec';
|
|
7
|
+
import { Elysia } from 'elysia';
|
|
8
|
+
import { appLogger } from '../../infrastructure/elysia/logger';
|
|
9
|
+
import { createMcpElysiaHandler } from './common';
|
|
10
|
+
|
|
11
|
+
function createTestApp() {
|
|
12
|
+
return new Elysia().use(
|
|
13
|
+
createMcpElysiaHandler({
|
|
14
|
+
logger: appLogger,
|
|
15
|
+
path: '/mcp/test',
|
|
16
|
+
serverName: 'test-mcp',
|
|
17
|
+
ops: new OperationSpecRegistry(),
|
|
18
|
+
resources: new ResourceRegistry(),
|
|
19
|
+
prompts: new PromptRegistry(),
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function createInitializeRequest(accept: string) {
|
|
25
|
+
return new Request('http://localhost/mcp/test', {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: {
|
|
28
|
+
accept,
|
|
29
|
+
'content-type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
body: JSON.stringify({
|
|
32
|
+
jsonrpc: '2.0',
|
|
33
|
+
id: 1,
|
|
34
|
+
method: 'initialize',
|
|
35
|
+
params: {
|
|
36
|
+
protocolVersion: '2024-11-05',
|
|
37
|
+
capabilities: {},
|
|
38
|
+
clientInfo: { name: 'test-client', version: '1.0.0' },
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe('createMcpElysiaHandler', () => {
|
|
45
|
+
it('accepts JSON-only clients for POST MCP requests', async () => {
|
|
46
|
+
const response = await createTestApp().handle(
|
|
47
|
+
createInitializeRequest('application/json')
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
expect(response.status).toBe(200);
|
|
51
|
+
const body = await response.json();
|
|
52
|
+
expect(body.result.serverInfo.name).toBe('test-mcp');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('keeps rejecting incompatible Accept headers', async () => {
|
|
56
|
+
const response = await createTestApp().handle(
|
|
57
|
+
createInitializeRequest('text/html')
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect(response.status).toBe(406);
|
|
61
|
+
const body = await response.json();
|
|
62
|
+
expect(body.error.message).toContain('Not Acceptable');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -12,6 +12,7 @@ import { Logger } from '@contractspec/lib.logger';
|
|
|
12
12
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
13
13
|
import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
|
14
14
|
import { Elysia } from 'elysia';
|
|
15
|
+
import { normalizeMcpRequest } from './normalizeMcpRequest';
|
|
15
16
|
|
|
16
17
|
export interface McpAuthValidationResult {
|
|
17
18
|
valid: boolean;
|
|
@@ -150,7 +151,7 @@ export function createMcpElysiaHandler({
|
|
|
150
151
|
});
|
|
151
152
|
|
|
152
153
|
try {
|
|
153
|
-
return await state.transport.handleRequest(request);
|
|
154
|
+
return await state.transport.handleRequest(normalizeMcpRequest(request));
|
|
154
155
|
} finally {
|
|
155
156
|
await closeSessionState(state);
|
|
156
157
|
}
|
|
@@ -189,7 +190,9 @@ export function createMcpElysiaHandler({
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
try {
|
|
192
|
-
const response = await state.transport.handleRequest(
|
|
193
|
+
const response = await state.transport.handleRequest(
|
|
194
|
+
normalizeMcpRequest(request)
|
|
195
|
+
);
|
|
193
196
|
const activeSessionId = state.transport.sessionId;
|
|
194
197
|
|
|
195
198
|
if (activeSessionId && !sessions.has(activeSessionId)) {
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { DocPresentationRoute } from '@contractspec/lib.contracts-spec/docs';
|
|
2
|
+
import { defaultDocRegistry } from '@contractspec/lib.contracts-spec/docs';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_LIMIT = 20;
|
|
5
|
+
const MAX_LIMIT = 100;
|
|
6
|
+
|
|
7
|
+
type DocsSearchArgs = {
|
|
8
|
+
query?: string;
|
|
9
|
+
tag?: string | string[];
|
|
10
|
+
visibility?: string;
|
|
11
|
+
kind?: string;
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function normalizeText(value: string | undefined | null) {
|
|
17
|
+
return value?.trim().toLowerCase() ?? '';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function normalizeRoute(route: string) {
|
|
21
|
+
const decoded = decodeURIComponent(route).trim();
|
|
22
|
+
if (!decoded) return '/';
|
|
23
|
+
return decoded.startsWith('/') ? decoded : `/${decoded}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function normalizeTags(value: string | string[] | undefined) {
|
|
27
|
+
const tags = Array.isArray(value) ? value : value ? [value] : [];
|
|
28
|
+
return tags.map((tag) => normalizeText(tag)).filter(Boolean);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function clampLimit(limit: number | undefined) {
|
|
32
|
+
if (!limit || Number.isNaN(limit)) return DEFAULT_LIMIT;
|
|
33
|
+
return Math.min(Math.max(limit, 1), MAX_LIMIT);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function clampOffset(offset: number | undefined) {
|
|
37
|
+
if (!offset || Number.isNaN(offset)) return 0;
|
|
38
|
+
return Math.max(offset, 0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function toDocSummary({ block, route }: DocPresentationRoute) {
|
|
42
|
+
return {
|
|
43
|
+
id: block.id,
|
|
44
|
+
title: block.title,
|
|
45
|
+
summary: block.summary ?? '',
|
|
46
|
+
route,
|
|
47
|
+
visibility: block.visibility ?? 'public',
|
|
48
|
+
kind: block.kind ?? 'reference',
|
|
49
|
+
version: block.version ?? '1.0.0',
|
|
50
|
+
tags: block.tags ?? [],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function scoreDoc(route: DocPresentationRoute, query: string) {
|
|
55
|
+
if (!query) return 1;
|
|
56
|
+
|
|
57
|
+
const tokens = query.split(/\s+/).filter(Boolean);
|
|
58
|
+
const title = normalizeText(route.block.title);
|
|
59
|
+
const id = normalizeText(route.block.id);
|
|
60
|
+
const summary = normalizeText(route.block.summary);
|
|
61
|
+
const body = normalizeText(route.block.body);
|
|
62
|
+
const path = normalizeText(route.route);
|
|
63
|
+
const tags = (route.block.tags ?? []).map((tag) => normalizeText(tag));
|
|
64
|
+
const haystack = [title, id, summary, body, path, ...tags].join(' ');
|
|
65
|
+
|
|
66
|
+
if (tokens.some((token) => !haystack.includes(token))) return 0;
|
|
67
|
+
|
|
68
|
+
let score = 0;
|
|
69
|
+
for (const token of tokens) {
|
|
70
|
+
if (id.includes(token)) score += 8;
|
|
71
|
+
if (title.includes(token)) score += 7;
|
|
72
|
+
if (tags.some((tag) => tag.includes(token))) score += 5;
|
|
73
|
+
if (summary.includes(token)) score += 4;
|
|
74
|
+
if (path.includes(token)) score += 3;
|
|
75
|
+
if (body.includes(token)) score += 2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return score;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function searchDocs(
|
|
82
|
+
routes: DocPresentationRoute[],
|
|
83
|
+
args: DocsSearchArgs
|
|
84
|
+
) {
|
|
85
|
+
const query = normalizeText(
|
|
86
|
+
typeof args.query === 'string' ? args.query : undefined
|
|
87
|
+
);
|
|
88
|
+
const tags = normalizeTags(args.tag as string | string[] | undefined);
|
|
89
|
+
const visibility = normalizeText(
|
|
90
|
+
typeof args.visibility === 'string' ? args.visibility : undefined
|
|
91
|
+
);
|
|
92
|
+
const kind = normalizeText(
|
|
93
|
+
typeof args.kind === 'string' ? args.kind : undefined
|
|
94
|
+
);
|
|
95
|
+
const limit = clampLimit(
|
|
96
|
+
typeof args.limit === 'number' ? args.limit : undefined
|
|
97
|
+
);
|
|
98
|
+
const offset = clampOffset(
|
|
99
|
+
typeof args.offset === 'number' ? args.offset : undefined
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const ranked = routes
|
|
103
|
+
.map((route) => ({
|
|
104
|
+
doc: toDocSummary(route),
|
|
105
|
+
score: scoreDoc(route, query),
|
|
106
|
+
}))
|
|
107
|
+
.filter(({ doc, score }) => {
|
|
108
|
+
const matchesQuery = query ? score > 0 : true;
|
|
109
|
+
const matchesTags = tags.length
|
|
110
|
+
? tags.every((tag) =>
|
|
111
|
+
doc.tags.some((docTag) => normalizeText(docTag).includes(tag))
|
|
112
|
+
)
|
|
113
|
+
: true;
|
|
114
|
+
const matchesVisibility = visibility
|
|
115
|
+
? normalizeText(doc.visibility) === visibility
|
|
116
|
+
: true;
|
|
117
|
+
const matchesKind = kind ? normalizeText(doc.kind) === kind : true;
|
|
118
|
+
return matchesQuery && matchesTags && matchesVisibility && matchesKind;
|
|
119
|
+
})
|
|
120
|
+
.sort((left, right) => {
|
|
121
|
+
if (right.score !== left.score) return right.score - left.score;
|
|
122
|
+
return left.doc.title.localeCompare(right.doc.title);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const docs = ranked.slice(offset, offset + limit).map(({ doc }) => doc);
|
|
126
|
+
const nextOffset =
|
|
127
|
+
offset + docs.length < ranked.length ? offset + docs.length : undefined;
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
docs,
|
|
131
|
+
items: docs,
|
|
132
|
+
total: ranked.length,
|
|
133
|
+
...(nextOffset != null ? { nextOffset } : {}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function getDocById(id: string) {
|
|
138
|
+
const normalizedId = decodeURIComponent(id);
|
|
139
|
+
const found = defaultDocRegistry.get(normalizedId);
|
|
140
|
+
if (!found) return undefined;
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
doc: toDocSummary(found),
|
|
144
|
+
content: String(found.block.body ?? ''),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function getDocByRoute(
|
|
149
|
+
routes: DocPresentationRoute[],
|
|
150
|
+
routePath: string
|
|
151
|
+
) {
|
|
152
|
+
const normalizedPath = normalizeRoute(routePath);
|
|
153
|
+
const found = routes.find(
|
|
154
|
+
(route) => normalizeRoute(route.route) === normalizedPath
|
|
155
|
+
);
|
|
156
|
+
if (!found) return undefined;
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
doc: toDocSummary(found),
|
|
160
|
+
content: String(found.block.body ?? ''),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function listDocFacets(routes: DocPresentationRoute[]) {
|
|
165
|
+
const tags = new Map<string, number>();
|
|
166
|
+
const kinds = new Map<string, number>();
|
|
167
|
+
const visibilities = new Map<string, number>();
|
|
168
|
+
|
|
169
|
+
for (const route of routes) {
|
|
170
|
+
const kind = route.block.kind ?? 'reference';
|
|
171
|
+
const visibility = route.block.visibility ?? 'public';
|
|
172
|
+
kinds.set(kind, (kinds.get(kind) ?? 0) + 1);
|
|
173
|
+
visibilities.set(visibility, (visibilities.get(visibility) ?? 0) + 1);
|
|
174
|
+
|
|
175
|
+
for (const tag of route.block.tags ?? []) {
|
|
176
|
+
tags.set(tag, (tags.get(tag) ?? 0) + 1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const toEntries = (
|
|
181
|
+
values: Map<string, number>,
|
|
182
|
+
key: 'tag' | 'kind' | 'visibility'
|
|
183
|
+
) =>
|
|
184
|
+
[...values.entries()]
|
|
185
|
+
.sort(
|
|
186
|
+
(left, right) => right[1] - left[1] || left[0].localeCompare(right[0])
|
|
187
|
+
)
|
|
188
|
+
.map(([value, count]) => ({ [key]: value, count }));
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
totalDocs: routes.length,
|
|
192
|
+
tags: toEntries(tags, 'tag'),
|
|
193
|
+
kinds: toEntries(kinds, 'kind'),
|
|
194
|
+
visibilities: toEntries(visibilities, 'visibility'),
|
|
195
|
+
};
|
|
196
|
+
}
|