@agent-teams/docs-protocol-mcp 0.0.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/CHANGELOG.md +6 -0
- package/LICENSE +201 -0
- package/README.md +40 -0
- package/dist/cli-input.d.ts +6 -0
- package/dist/cli-input.d.ts.map +1 -0
- package/dist/cli-input.js +98 -0
- package/dist/cli-input.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +36 -0
- package/dist/cli.js.map +1 -0
- package/dist/contracts.d.ts +34 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +2 -0
- package/dist/contracts.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/node-docs-reader.d.ts +77 -0
- package/dist/node-docs-reader.d.ts.map +1 -0
- package/dist/node-docs-reader.js +13 -0
- package/dist/node-docs-reader.js.map +1 -0
- package/dist/schema.d.ts +19 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +26 -0
- package/dist/schema.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +29 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +48 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +601 -0
- package/dist/tools.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +11 -0
- package/dist/version.js.map +1 -0
- package/package.json +53 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# `@agent-teams/docs-protocol-mcp`
|
|
2
|
+
|
|
3
|
+
Open-source optional read-only MCP stdio adapter for documentation governed by
|
|
4
|
+
`@agent-teams/docs-protocol` in any repository.
|
|
5
|
+
|
|
6
|
+
Prove and install the exact compatible pair only through the
|
|
7
|
+
[canonical MCP workflow](https://github.com/agent-teams-ai/engineering-foundation/blob/main/docs/reference/open-source-docs-protocol.md#optional-mcp-transport),
|
|
8
|
+
which owns versions, registry pinning, and atomic installation.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
docs-protocol-mcp --consumer-root /absolute/repository/path
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The consumer root is fixed when the process starts. The profile is selected by
|
|
15
|
+
an optional `--profile` argument or deterministic discovery of
|
|
16
|
+
`docs.config.yaml` and the legacy
|
|
17
|
+
`architecture/foundation/docs-protocol.yaml` path. Discovery fails closed when
|
|
18
|
+
both or neither exist. MCP tool arguments cannot replace either value.
|
|
19
|
+
|
|
20
|
+
The read-only adapter is qualified on POSIX and Windows. A Windows repository
|
|
21
|
+
must already contain portable authority initialized and committed from a
|
|
22
|
+
supported POSIX host; the adapter never performs bootstrap mutation or
|
|
23
|
+
recovery.
|
|
24
|
+
|
|
25
|
+
The V1 surface contains only `docs_info`, `docs_find`, and `docs_context`.
|
|
26
|
+
`docs_context` returns bounded `llms.txt` context with optional filters and
|
|
27
|
+
advisory fuzzy ranking. There is no authoring, recovery, upgrade, network,
|
|
28
|
+
shell, or process-execution capability.
|
|
29
|
+
|
|
30
|
+
Results are bounded, request cancellation is propagated through an
|
|
31
|
+
`AbortSignal`, and unexpected failures are returned without host paths or raw
|
|
32
|
+
error details.
|
|
33
|
+
|
|
34
|
+
Successful tool calls use the closed Agent Teams MCP projection schema version
|
|
35
|
+
`1`, return the same projection as text and `structuredContent`, and advertise
|
|
36
|
+
their exported `DOCS_*_OUTPUT_SCHEMA_V1` schema through MCP `outputSchema`.
|
|
37
|
+
Projection list caps and truncation evidence are part of those schemas. MCP
|
|
38
|
+
Server 2.0 supports one success `outputSchema` per tool; `isError` responses do
|
|
39
|
+
not carry `structuredContent`, so their separately exported closed
|
|
40
|
+
`DOCS_ERROR_OUTPUT_SCHEMA_V1` cannot be registered as an alternate output.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DocsBinding } from "./contracts.js";
|
|
2
|
+
export declare class CliInputError extends Error {
|
|
3
|
+
readonly name = "CliInputError";
|
|
4
|
+
}
|
|
5
|
+
export declare function parseStartupArguments(arguments_: readonly string[], cwd: string): Promise<DocsBinding>;
|
|
6
|
+
//# sourceMappingURL=cli-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-input.d.ts","sourceRoot":"","sources":["../src/cli-input.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAkB,IAAI,mBAAmB;CAC1C;AAiDD,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAmC5G"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { lstat, realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { docsProfilePath, validatePortableRepositoryPath } from "@agent-teams/docs-protocol";
|
|
4
|
+
export class CliInputError extends Error {
|
|
5
|
+
name = "CliInputError";
|
|
6
|
+
}
|
|
7
|
+
function optionValue(arguments_, index, name) {
|
|
8
|
+
const argument = arguments_[index];
|
|
9
|
+
if (argument === name) {
|
|
10
|
+
const value = arguments_[index + 1];
|
|
11
|
+
if (value === undefined || value.startsWith("--")) {
|
|
12
|
+
throw new CliInputError(`${name} requires a value.`);
|
|
13
|
+
}
|
|
14
|
+
return Object.freeze({ consumed: 2, value });
|
|
15
|
+
}
|
|
16
|
+
const prefix = `${name}=`;
|
|
17
|
+
return argument?.startsWith(prefix) === true
|
|
18
|
+
? Object.freeze({ consumed: 1, value: argument.slice(prefix.length) })
|
|
19
|
+
: undefined;
|
|
20
|
+
}
|
|
21
|
+
function contained(root, candidate) {
|
|
22
|
+
const path = relative(root, candidate);
|
|
23
|
+
return path === "" || (path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path));
|
|
24
|
+
}
|
|
25
|
+
function parseOptions(arguments_) {
|
|
26
|
+
let consumerRoot;
|
|
27
|
+
let profilePath;
|
|
28
|
+
for (let index = 0; index < arguments_.length;) {
|
|
29
|
+
const root = optionValue(arguments_, index, "--consumer-root");
|
|
30
|
+
const profile = optionValue(arguments_, index, "--profile");
|
|
31
|
+
if (root !== undefined) {
|
|
32
|
+
if (consumerRoot !== undefined) {
|
|
33
|
+
throw new CliInputError("--consumer-root may be specified only once.");
|
|
34
|
+
}
|
|
35
|
+
consumerRoot = root.value;
|
|
36
|
+
index += root.consumed;
|
|
37
|
+
}
|
|
38
|
+
else if (profile !== undefined) {
|
|
39
|
+
if (profilePath !== undefined) {
|
|
40
|
+
throw new CliInputError("--profile may be specified only once.");
|
|
41
|
+
}
|
|
42
|
+
profilePath = profile.value;
|
|
43
|
+
index += profile.consumed;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new CliInputError("Unknown startup argument.");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (consumerRoot === undefined || consumerRoot.length === 0) {
|
|
50
|
+
throw new CliInputError("--consumer-root is required.");
|
|
51
|
+
}
|
|
52
|
+
if (profilePath !== undefined) {
|
|
53
|
+
try {
|
|
54
|
+
validatePortableRepositoryPath(profilePath, "--profile");
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new CliInputError("--profile must be a portable repository-relative path.");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return Object.freeze({ consumerRoot, ...(profilePath === undefined ? {} : { profilePath }) });
|
|
61
|
+
}
|
|
62
|
+
export async function parseStartupArguments(arguments_, cwd) {
|
|
63
|
+
const options = parseOptions(arguments_);
|
|
64
|
+
const canonicalRoot = await realpath(resolve(cwd, options.consumerRoot)).catch(() => {
|
|
65
|
+
throw new CliInputError("--consumer-root must identify an existing directory.");
|
|
66
|
+
});
|
|
67
|
+
const rootState = await stat(canonicalRoot).catch(() => null);
|
|
68
|
+
if (rootState?.isDirectory() !== true) {
|
|
69
|
+
throw new CliInputError("--consumer-root must identify an existing directory.");
|
|
70
|
+
}
|
|
71
|
+
if (options.profilePath !== undefined && !contained(canonicalRoot, resolve(canonicalRoot, options.profilePath))) {
|
|
72
|
+
throw new CliInputError("--profile must stay within the consumer root.");
|
|
73
|
+
}
|
|
74
|
+
let profilePath;
|
|
75
|
+
try {
|
|
76
|
+
profilePath = await docsProfilePath({
|
|
77
|
+
consumerRoot: canonicalRoot,
|
|
78
|
+
...(options.profilePath === undefined
|
|
79
|
+
? {}
|
|
80
|
+
: { explicitProfilePath: options.profilePath })
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
throw new CliInputError("Documentation profile discovery is ambiguous; pass --profile explicitly.");
|
|
85
|
+
}
|
|
86
|
+
const profile = resolve(canonicalRoot, profilePath);
|
|
87
|
+
const profileState = await lstat(profile).catch(() => null);
|
|
88
|
+
const canonicalProfile = await realpath(profile).catch(() => null);
|
|
89
|
+
if (profileState?.isFile() !== true || profileState.isSymbolicLink() ||
|
|
90
|
+
canonicalProfile === null || !contained(canonicalRoot, canonicalProfile)) {
|
|
91
|
+
if (options.profilePath === undefined && profileState === null) {
|
|
92
|
+
throw new CliInputError("No documentation profile was discovered; pass --profile explicitly.");
|
|
93
|
+
}
|
|
94
|
+
throw new CliInputError("The selected documentation profile must be one real contained file.");
|
|
95
|
+
}
|
|
96
|
+
return Object.freeze({ consumerRoot: canonicalRoot, profilePath });
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=cli-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-input.js","sourceRoot":"","sources":["../src/cli-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAI7F,MAAM,OAAO,aAAc,SAAQ,KAAK;IACpB,IAAI,GAAG,eAAe,CAAC;CAC1C;AAED,SAAS,WAAW,CAAC,UAA6B,EAAE,KAAa,EAAE,IAAY;IAC7E,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAAA,MAAM,IAAI,aAAa,CAAC,GAAG,IAAI,oBAAoB,CAAC,CAAC;QAAA,CAAC;QAC1G,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IAC1B,OAAO,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,IAAI;QAC1C,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,E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ACrE,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
3
|
+
import { CliInputError, parseStartupArguments } from "./cli-input.js";
|
|
4
|
+
import { NodeDocsReader } from "./node-docs-reader.js";
|
|
5
|
+
import { createDocsProtocolMcpServer } from "./server.js";
|
|
6
|
+
const USAGE = "usage: docs-protocol-mcp --consumer-root PATH [--profile REPOSITORY_RELATIVE_PATH]";
|
|
7
|
+
async function main() {
|
|
8
|
+
const cliArguments = process.argv.slice(2);
|
|
9
|
+
if (cliArguments.length === 1 && cliArguments[0] === "--help") {
|
|
10
|
+
process.stdout.write(`${USAGE}\n`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let binding;
|
|
14
|
+
try {
|
|
15
|
+
binding = await parseStartupArguments(cliArguments, process.cwd());
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
const message = error instanceof CliInputError ? error.message : "Startup validation failed.";
|
|
19
|
+
process.stderr.write(`docs-protocol-mcp: ${message}\n`);
|
|
20
|
+
process.stderr.write(`${USAGE}\n`);
|
|
21
|
+
process.exitCode = 2;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const lifetime = new AbortController();
|
|
25
|
+
const handle = serveStdio(() => createDocsProtocolMcpServer(new NodeDocsReader(), binding, lifetime.signal), { onerror: () => process.stderr.write("docs-protocol-mcp: MCP transport failed.\n") });
|
|
26
|
+
const shutdown = () => {
|
|
27
|
+
lifetime.abort();
|
|
28
|
+
void handle.close().catch(() => {
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
process.once("SIGINT", shutdown);
|
|
33
|
+
process.once("SIGTERM", shutdown);
|
|
34
|
+
}
|
|
35
|
+
void main();
|
|
36
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,KAAK,GAAG,oFAAoF,CAAC;AAEnG,KAAK,UAAU,IAAI;IACjB,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3C,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC;IACZ,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,qBAAqB,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,KAAK,YAAY,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;QAC9F,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,OAAO,IAAI,CAAC,CAAC;QACxD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;QACnC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;IACvC,MAAM,MAAM,GAAG,UAAU,CACvB,GAAG,EAAE,CAAC,2BAA2B,CAAC,IAAI,cAAc,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,EACjF,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,EAAE,CACtF,CAAC;IACF,MAAM,QAAQ,GAAG,GAAS,EAAE;QAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjB,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YAC7B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC;AAED,KAAK,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DocsFindQueryV3 } from "@agent-teams/docs-protocol";
|
|
2
|
+
export interface DocsBinding {
|
|
3
|
+
readonly consumerRoot: string;
|
|
4
|
+
readonly profilePath: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DocsReadExecution {
|
|
7
|
+
readonly envelope: {
|
|
8
|
+
readonly schemaVersion: number;
|
|
9
|
+
readonly protocol: Readonly<Record<string, unknown>>;
|
|
10
|
+
readonly command: string;
|
|
11
|
+
readonly outcome: string;
|
|
12
|
+
readonly diagnostics: readonly unknown[];
|
|
13
|
+
readonly result: unknown;
|
|
14
|
+
};
|
|
15
|
+
readonly exitCode: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DocsReader {
|
|
18
|
+
info(input: DocsBinding & {
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
}): Promise<DocsReadExecution>;
|
|
21
|
+
find(input: DocsBinding & {
|
|
22
|
+
readonly query: DocsFindQueryV3;
|
|
23
|
+
readonly signal?: AbortSignal;
|
|
24
|
+
}): Promise<DocsReadExecution>;
|
|
25
|
+
context(input: DocsBinding & {
|
|
26
|
+
readonly query: DocsFindQueryV3;
|
|
27
|
+
readonly limits: {
|
|
28
|
+
readonly maxBytes: number;
|
|
29
|
+
readonly maxDocuments: number;
|
|
30
|
+
};
|
|
31
|
+
readonly signal?: AbortSignal;
|
|
32
|
+
}): Promise<DocsReadExecution>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,WAAW,EAAE,SAAS,OAAO,EAAE,CAAC;QACzC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzF,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG;QACxB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC/B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/B,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG;QAC3B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;QAChC,QAAQ,CAAC,MAAM,EAAE;YACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;SAC/B,CAAC;QACF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC/B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CliInputError, parseStartupArguments } from "./cli-input.js";
|
|
2
|
+
export type { DocsBinding, DocsReadExecution, DocsReader } from "./contracts.js";
|
|
3
|
+
export { NodeDocsReader } from "./node-docs-reader.js";
|
|
4
|
+
export { createDocsProtocolMcpServer } from "./server.js";
|
|
5
|
+
export { createDocsTools, DOCS_CONTEXT_OUTPUT_SCHEMA_V1, DOCS_ERROR_OUTPUT_SCHEMA_V1, DOCS_FIND_OUTPUT_SCHEMA_V1, DOCS_INFO_OUTPUT_SCHEMA_V1 } from "./tools.js";
|
|
6
|
+
export type { DocsContextArguments, DocsFindArguments, DocsTool } from "./tools.js";
|
|
7
|
+
export { DOCS_PROTOCOL_MCP_PACKAGE_VERSION, DOCS_PROTOCOL_MCP_PROJECTION_VERSION } from "./version.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACtE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EACL,iCAAiC,EACjC,oCAAoC,EACrC,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CliInputError, parseStartupArguments } from "./cli-input.js";
|
|
2
|
+
export { NodeDocsReader } from "./node-docs-reader.js";
|
|
3
|
+
export { createDocsProtocolMcpServer } from "./server.js";
|
|
4
|
+
export { createDocsTools, DOCS_CONTEXT_OUTPUT_SCHEMA_V1, DOCS_ERROR_OUTPUT_SCHEMA_V1, DOCS_FIND_OUTPUT_SCHEMA_V1, DOCS_INFO_OUTPUT_SCHEMA_V1 } from "./tools.js";
|
|
5
|
+
export { DOCS_PROTOCOL_MCP_PACKAGE_VERSION, DOCS_PROTOCOL_MCP_PROJECTION_VERSION } from "./version.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,iCAAiC,EACjC,oCAAoC,EACrC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { DocsReader } from "./contracts.js";
|
|
2
|
+
export declare class NodeDocsReader implements DocsReader {
|
|
3
|
+
info(input: Parameters<DocsReader["info"]>[0]): Promise<import("@agent-teams/docs-protocol").DocsExecutionV2<Readonly<{
|
|
4
|
+
kind: "info";
|
|
5
|
+
projectId: string;
|
|
6
|
+
protocol: {
|
|
7
|
+
readonly id: typeof import("@agent-teams/docs-protocol").DOCS_PROTOCOL_ID;
|
|
8
|
+
readonly version: typeof import("@agent-teams/docs-protocol").DOCS_PROTOCOL_VERSION;
|
|
9
|
+
} | {
|
|
10
|
+
readonly id: typeof import("@agent-teams/docs-protocol").DOCS_PROTOCOL_ID;
|
|
11
|
+
readonly version: typeof import("@agent-teams/docs-protocol").DOCS_PROTOCOL_VERSION;
|
|
12
|
+
};
|
|
13
|
+
foundationProfile: {
|
|
14
|
+
readonly metadataSidecarPolicy: "foundation-profile-v2-strict-merge";
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly schemaVersion: 2;
|
|
17
|
+
} | {
|
|
18
|
+
readonly metadataSidecarPolicy: "foundation-profile-v3-strict-merge";
|
|
19
|
+
readonly path: string;
|
|
20
|
+
readonly schemaVersion: 3;
|
|
21
|
+
};
|
|
22
|
+
agentWorkflow: {
|
|
23
|
+
readonly skillPath: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly skillPath: string;
|
|
26
|
+
};
|
|
27
|
+
authority: {
|
|
28
|
+
readonly metadataSchema: {
|
|
29
|
+
readonly digest: string;
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly size: number;
|
|
32
|
+
};
|
|
33
|
+
readonly metadataSidecar?: {
|
|
34
|
+
readonly digest: string;
|
|
35
|
+
readonly path: string;
|
|
36
|
+
readonly size: number;
|
|
37
|
+
};
|
|
38
|
+
readonly ownerCatalog: {
|
|
39
|
+
readonly digest: string;
|
|
40
|
+
readonly path: string;
|
|
41
|
+
readonly size: number;
|
|
42
|
+
};
|
|
43
|
+
readonly profile: {
|
|
44
|
+
readonly digest: string;
|
|
45
|
+
readonly path: string;
|
|
46
|
+
readonly size: number;
|
|
47
|
+
};
|
|
48
|
+
readonly templates: readonly {
|
|
49
|
+
readonly evidence: {
|
|
50
|
+
readonly digest: string;
|
|
51
|
+
readonly path: string;
|
|
52
|
+
readonly size: number;
|
|
53
|
+
};
|
|
54
|
+
readonly type: string;
|
|
55
|
+
}[];
|
|
56
|
+
};
|
|
57
|
+
authorityPaths: readonly string[];
|
|
58
|
+
catalog: {
|
|
59
|
+
readonly collections: readonly unknown[];
|
|
60
|
+
readonly excludedPrefixes: readonly string[];
|
|
61
|
+
};
|
|
62
|
+
semanticDigest: string;
|
|
63
|
+
metadataSchemaPath: string;
|
|
64
|
+
metadataSidecar: {
|
|
65
|
+
readonly kind: "none";
|
|
66
|
+
} | {
|
|
67
|
+
readonly kind: "path-metadata-map";
|
|
68
|
+
readonly path: string;
|
|
69
|
+
};
|
|
70
|
+
ownerIds: readonly string[];
|
|
71
|
+
types: readonly import("@agent-teams/docs-protocol").DocsTypeProfile[];
|
|
72
|
+
semanticValidatorIds: readonly string[];
|
|
73
|
+
}>>>;
|
|
74
|
+
find(input: Parameters<DocsReader["find"]>[0]): Promise<import("@agent-teams/docs-protocol").DocsExecutionV3<import("@agent-teams/docs-protocol").DocsFindResultV3>>;
|
|
75
|
+
context(input: Parameters<DocsReader["context"]>[0]): Promise<import("@agent-teams/docs-protocol").DocsExecutionV3<import("@agent-teams/docs-protocol").DocsContextResultV1>>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=node-docs-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-docs-reader.d.ts","sourceRoot":"","sources":["../src/node-docs-reader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,qBAAa,cAAe,YAAW,UAAU;IAC/C,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAE5C;IAED,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,wHAE5C;IAED,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,2HAElD;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { docsContextV1, docsFindV3, docsInfoV2 } from "@agent-teams/docs-protocol";
|
|
2
|
+
export class NodeDocsReader {
|
|
3
|
+
info(input) {
|
|
4
|
+
return docsInfoV2(input);
|
|
5
|
+
}
|
|
6
|
+
find(input) {
|
|
7
|
+
return docsFindV3(input);
|
|
8
|
+
}
|
|
9
|
+
context(input) {
|
|
10
|
+
return docsContextV1(input);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=node-docs-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-docs-reader.js","sourceRoot":"","sources":["../src/node-docs-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAInF,MAAM,OAAO,cAAc;IACzB,IAAI,CAAC,KAAwC;QAC3C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC,KAAwC;QAC3C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,CAAC,KAA2C;QACjD,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StandardSchemaWithJSON } from "@modelcontextprotocol/server";
|
|
2
|
+
interface ValidationIssue {
|
|
3
|
+
readonly message: string;
|
|
4
|
+
readonly path?: readonly PropertyKey[];
|
|
5
|
+
}
|
|
6
|
+
type Validator<Output> = (value: unknown) => Readonly<{
|
|
7
|
+
readonly value: Output;
|
|
8
|
+
}> | Readonly<{
|
|
9
|
+
readonly issues: readonly ValidationIssue[];
|
|
10
|
+
}>;
|
|
11
|
+
export declare function standardJsonSchema<Output>(jsonSchema: Readonly<Record<string, unknown>>, validate: Validator<Output>): StandardSchemaWithJSON<unknown, Output>;
|
|
12
|
+
export declare function recordOrIssue(value: unknown): Readonly<{
|
|
13
|
+
readonly record: Readonly<Record<string, unknown>>;
|
|
14
|
+
}> | Readonly<{
|
|
15
|
+
readonly issues: readonly ValidationIssue[];
|
|
16
|
+
}>;
|
|
17
|
+
export declare function unknownKeys(record: Readonly<Record<string, unknown>>, allowed: ReadonlySet<string>): readonly ValidationIssue[];
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,UAAU,eAAe;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CACxC;AAED,KAAK,SAAS,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,OAAO,KACpC,QAAQ,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GACpC,QAAQ,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,CAAC,CAAC;AAE9D,wBAAgB,kBAAkB,CAAC,MAAM,EACvC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC7C,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,GAC1B,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAYzC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GACxC,QAAQ,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC,GAChE,QAAQ,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,CAAC,CAK5D;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,SAAS,eAAe,EAAE,CAK5B"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function standardJsonSchema(jsonSchema, validate) {
|
|
2
|
+
return Object.freeze({
|
|
3
|
+
"~standard": Object.freeze({
|
|
4
|
+
version: 1,
|
|
5
|
+
vendor: "agent-teams.docs-protocol-mcp",
|
|
6
|
+
validate,
|
|
7
|
+
jsonSchema: Object.freeze({
|
|
8
|
+
input: () => jsonSchema,
|
|
9
|
+
output: () => jsonSchema
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function recordOrIssue(value) {
|
|
15
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
16
|
+
return Object.freeze({ issues: Object.freeze([{ message: "Expected an object." }]) });
|
|
17
|
+
}
|
|
18
|
+
return Object.freeze({ record: value });
|
|
19
|
+
}
|
|
20
|
+
export function unknownKeys(record, allowed) {
|
|
21
|
+
return Object.freeze(Object.keys(record)
|
|
22
|
+
.filter((key) => !allowed.has(key))
|
|
23
|
+
.toSorted()
|
|
24
|
+
.map((key) => Object.freeze({ message: "Unknown property.", path: Object.freeze([key]) })));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=schema.js.map
|