@mosvera/mcp 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +165 -0
- package/dist/context.d.ts +18 -0
- package/dist/context.js +179 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +19 -0
- package/dist/examples/README.md +16 -0
- package/dist/examples/cinematic-editorial/README.md +22 -0
- package/dist/examples/cinematic-editorial/composition.json +14 -0
- package/dist/examples/cinematic-editorial/manifests/illustrative-image.manifest.json +16 -0
- package/dist/examples/cinematic-editorial/merge-strategies.json +3 -0
- package/dist/examples/cinematic-editorial/modifier.golden-hour.json +10 -0
- package/dist/examples/cinematic-editorial/modifier.high-contrast.json +5 -0
- package/dist/examples/cinematic-editorial/palette.editorial-warm.json +10 -0
- package/dist/examples/cinematic-editorial/template.base.json +11 -0
- package/dist/examples/cinematic-editorial/template.noir.json +7 -0
- package/dist/examples/demo-aesthetics/README.md +11 -0
- package/dist/examples/demo-aesthetics/composition.cinematic-lab.json +5 -0
- package/dist/examples/demo-aesthetics/composition.claymation-playful-builder.json +5 -0
- package/dist/examples/demo-aesthetics/composition.quiet-editorial.json +5 -0
- package/dist/examples/demo-aesthetics/composition.technical-manual.json +5 -0
- package/dist/examples/demo-aesthetics/template.cinematic-lab-base.json +45 -0
- package/dist/examples/demo-aesthetics/template.claymation-playful-builder-base.json +45 -0
- package/dist/examples/demo-aesthetics/template.quiet-editorial-base.json +45 -0
- package/dist/examples/demo-aesthetics/template.technical-manual-base.json +45 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -0
- package/dist/mcp-result.d.ts +10 -0
- package/dist/mcp-result.js +26 -0
- package/dist/project-writes.d.ts +8 -0
- package/dist/project-writes.js +70 -0
- package/dist/registry/loader.d.ts +4 -0
- package/dist/registry/loader.js +85 -0
- package/dist/registry/preflight.d.ts +3 -0
- package/dist/registry/preflight.js +28 -0
- package/dist/registry/strategies.d.ts +9 -0
- package/dist/registry/strategies.js +30 -0
- package/dist/server.d.ts +6 -0
- package/dist/server.js +172 -0
- package/dist/tools/aesthetic.d.ts +57 -0
- package/dist/tools/aesthetic.js +331 -0
- package/dist/tools/compile-generation.d.ts +12 -0
- package/dist/tools/compile-generation.js +67 -0
- package/dist/tools/get-palette.d.ts +11 -0
- package/dist/tools/get-palette.js +23 -0
- package/dist/tools/list-templates.d.ts +6 -0
- package/dist/tools/list-templates.js +15 -0
- package/dist/tools/resolve-composition.d.ts +8 -0
- package/dist/tools/resolve-composition.js +38 -0
- package/dist/tools/validate-schema.d.ts +6 -0
- package/dist/tools/validate-schema.js +17 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.js +7 -0
- package/examples/README.md +16 -0
- package/examples/cinematic-editorial/README.md +22 -0
- package/examples/cinematic-editorial/composition.json +14 -0
- package/examples/cinematic-editorial/manifests/illustrative-image.manifest.json +16 -0
- package/examples/cinematic-editorial/merge-strategies.json +3 -0
- package/examples/cinematic-editorial/modifier.golden-hour.json +10 -0
- package/examples/cinematic-editorial/modifier.high-contrast.json +5 -0
- package/examples/cinematic-editorial/palette.editorial-warm.json +10 -0
- package/examples/cinematic-editorial/template.base.json +11 -0
- package/examples/cinematic-editorial/template.noir.json +7 -0
- package/examples/demo-aesthetics/README.md +11 -0
- package/examples/demo-aesthetics/composition.cinematic-lab.json +5 -0
- package/examples/demo-aesthetics/composition.claymation-playful-builder.json +5 -0
- package/examples/demo-aesthetics/composition.quiet-editorial.json +5 -0
- package/examples/demo-aesthetics/composition.technical-manual.json +5 -0
- package/examples/demo-aesthetics/template.cinematic-lab-base.json +45 -0
- package/examples/demo-aesthetics/template.claymation-playful-builder-base.json +45 -0
- package/examples/demo-aesthetics/template.quiet-editorial-base.json +45 -0
- package/examples/demo-aesthetics/template.technical-manual-base.json +45 -0
- package/mcpb/icon.png +0 -0
- package/mcpb/manifest.json +73 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-License-Identifier: CC-BY-4.0
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
# `@mosvera/mcp`
|
|
6
|
+
|
|
7
|
+
Mosvera for agents and desktop assistants. This package runs a local Model
|
|
8
|
+
Context Protocol server that lets Claude Desktop, editors, and automation
|
|
9
|
+
tools inspect, resolve, compile, draft, save, and delete Mosvera aesthetics in
|
|
10
|
+
a local registry.
|
|
11
|
+
|
|
12
|
+
The server never calls image providers, never sends provider HTTP requests,
|
|
13
|
+
and does not store API keys or secrets. It turns aesthetic documents into
|
|
14
|
+
canonical Mosvera models, portable design tokens, CSS variables, and
|
|
15
|
+
deterministic provider payloads that other tools can consume.
|
|
16
|
+
|
|
17
|
+
## Install In Claude Desktop
|
|
18
|
+
|
|
19
|
+
The easiest path for non-command-line users is the Mosvera MCP Bundle:
|
|
20
|
+
|
|
21
|
+
1. Download `mosvera-mcp-0.1.1.mcpb` from the latest
|
|
22
|
+
[GitHub release](https://github.com/mosvera/mcp/releases).
|
|
23
|
+
2. Double-click the file, drag it into Claude Desktop, or install it from
|
|
24
|
+
Claude Desktop Settings → Extensions → Advanced settings → Install
|
|
25
|
+
Extension.
|
|
26
|
+
3. Leave the registry directory blank to use the platform default, or choose a
|
|
27
|
+
folder where your aesthetic registry should live.
|
|
28
|
+
|
|
29
|
+
Default registry locations:
|
|
30
|
+
|
|
31
|
+
| Platform | Default registry |
|
|
32
|
+
|----------|------------------|
|
|
33
|
+
| macOS | `~/Library/Application Support/Mosvera/registry` |
|
|
34
|
+
| Windows | `%APPDATA%/Mosvera/registry` |
|
|
35
|
+
| Linux/dev | `~/.config/mosvera/registry` |
|
|
36
|
+
|
|
37
|
+
On first run, Mosvera seeds four public demo aesthetics into the registry:
|
|
38
|
+
`quiet-editorial`, `technical-manual`, `cinematic-lab`, and
|
|
39
|
+
`claymation-playful-builder`.
|
|
40
|
+
|
|
41
|
+
## Install With npm
|
|
42
|
+
|
|
43
|
+
Use npm when you are wiring Mosvera into another MCP host or a developer
|
|
44
|
+
workflow:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @mosvera/mcp
|
|
48
|
+
mosvera-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Run with a custom registry:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mosvera-mcp --registry ./my-aesthetic-registry
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Run read-only:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mosvera-mcp --read-only
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Environment overrides:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
MOSVERA_REGISTRY_DIR=./my-aesthetic-registry mosvera-mcp
|
|
67
|
+
MOSVERA_MCP_READ_ONLY=1 mosvera-mcp
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## What To Ask Claude
|
|
71
|
+
|
|
72
|
+
Try these after installing the bundle:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
List my Mosvera aesthetics.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
Resolve the claymation-playful-builder aesthetic and show me the canonical model.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
Compile quiet-editorial into CSS variables.
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Save a new aesthetic called executive-editorial based on quiet-editorial-base with a more compact, board-ready voice.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The saved documents are deterministic JSON in your local registry directory.
|
|
91
|
+
|
|
92
|
+
## Tools
|
|
93
|
+
|
|
94
|
+
Every tool returns `structuredContent` plus a short text summary. Tools are
|
|
95
|
+
annotated with MCP read/write hints so clients can present normal approval
|
|
96
|
+
flows.
|
|
97
|
+
|
|
98
|
+
| Tool | Mode | Purpose |
|
|
99
|
+
|------|------|---------|
|
|
100
|
+
| `server_status` | Read | Registry path, write mode, versions, counts, diagnostics. |
|
|
101
|
+
| `list_aesthetics` | Read | List named composition aesthetics in the active registry. |
|
|
102
|
+
| `get_registry_document` | Read | Fetch a template, modifier, palette, composition, or capability manifest. |
|
|
103
|
+
| `validate_document` | Read | Validate one document against a Mosvera schema kind. |
|
|
104
|
+
| `validate_registry` | Read | Validate the active registry and return diagnostics. |
|
|
105
|
+
| `resolve_aesthetic` | Read | Resolve a named or inline aesthetic into canonical Mosvera JSON. |
|
|
106
|
+
| `compile_design_tokens` | Read | Compile canonical output into portable design tokens and CSS variables. |
|
|
107
|
+
| `compile_provider_payload` | Read | Advanced deterministic provider payload compilation; no provider HTTP call. |
|
|
108
|
+
| `draft_aesthetic` | Read | Draft a composition document without saving it. |
|
|
109
|
+
| `save_aesthetic` | Write | Create or update a named composition aesthetic. |
|
|
110
|
+
| `save_registry_document` | Write | Advanced create/update for registry documents and manifests. |
|
|
111
|
+
| `delete_registry_document` | Destructive write | Delete a registry document. |
|
|
112
|
+
| `write_merge_strategies` | Write | Replace `merge-strategies.json` with deterministic JSON. |
|
|
113
|
+
|
|
114
|
+
When the server starts with `--read-only`, write tools are not registered.
|
|
115
|
+
|
|
116
|
+
## Registry Files
|
|
117
|
+
|
|
118
|
+
Mosvera reads JSON and YAML, but writes deterministic JSON only:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
template.<id>.json
|
|
122
|
+
modifier.<id>.json
|
|
123
|
+
palette.<id>.json
|
|
124
|
+
composition.<id>.json
|
|
125
|
+
manifests/<provider>.manifest.json
|
|
126
|
+
merge-strategies.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
IDs must be safe Mosvera references: lowercase letters, numbers, `_`, and `-`,
|
|
130
|
+
starting with a letter. Absolute paths, dotfiles, path traversal, unknown
|
|
131
|
+
kinds, and unsafe filenames are rejected.
|
|
132
|
+
|
|
133
|
+
## Developer Verification
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npm install
|
|
137
|
+
npm run ci
|
|
138
|
+
npm audit --audit-level=moderate
|
|
139
|
+
npm pack --dry-run
|
|
140
|
+
npm run mcpb:pack
|
|
141
|
+
npm run mcpb:inspect
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The MCPB pack step creates:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
build/mosvera/mosvera-mcp-0.1.1.mcpb
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Package Boundaries
|
|
151
|
+
|
|
152
|
+
Use `@mosvera/runtime` when your application wants to call the TypeScript
|
|
153
|
+
runtime directly.
|
|
154
|
+
|
|
155
|
+
Use the Python package `mosvera` when you want the peer Python runtime.
|
|
156
|
+
|
|
157
|
+
Use `@mosvera/provider-*` packages when you want direct provider payload
|
|
158
|
+
compilation without MCP.
|
|
159
|
+
|
|
160
|
+
Use `@mosvera/mcp` when an agent, editor, or automation system should call
|
|
161
|
+
Mosvera through MCP tools.
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
Code is Apache-2.0. Documentation is CC-BY-4.0.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type LoadedProject, type RegistryDiagnostic, type Validator } from "@mosvera/runtime";
|
|
2
|
+
import type { ToolContext } from "./types.ts";
|
|
3
|
+
export declare const SERVER_VERSION = "0.1.1";
|
|
4
|
+
export interface CliOptions {
|
|
5
|
+
registryDir?: string;
|
|
6
|
+
readOnlyMode: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface BuildContextOptions {
|
|
9
|
+
registryDir?: string;
|
|
10
|
+
readOnlyMode?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseCliOptions(argv: string[]): CliOptions;
|
|
13
|
+
export declare function defaultRegistryDir(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): string;
|
|
14
|
+
export declare function packagedRegistryDir(): string;
|
|
15
|
+
export declare function registryDiagnostics(project: LoadedProject, validator: Validator): RegistryDiagnostic[];
|
|
16
|
+
export declare function reloadContext(ctx: ToolContext): void;
|
|
17
|
+
export declare function buildContext(input?: string | BuildContextOptions): ToolContext;
|
|
18
|
+
export declare function bundleRoot(): string;
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
//
|
|
3
|
+
// Server context loading: choose a user-owned registry directory, seed public
|
|
4
|
+
// examples on first run, and fall back to packaged examples when local writes
|
|
5
|
+
// are unavailable.
|
|
6
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, statSync, } from "node:fs";
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
import { dirname, join, resolve } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { composeStrategies, createValidator, deriveStrategies, validateRegistry, } from "@mosvera/runtime";
|
|
11
|
+
import { loadProject, RegistryProjectError } from "@mosvera/runtime/node";
|
|
12
|
+
import { fluxAdapter } from "@mosvera/provider-flux";
|
|
13
|
+
import { openaiAdapter } from "@mosvera/provider-openai";
|
|
14
|
+
import { sdxlAdapter } from "@mosvera/provider-sdxl";
|
|
15
|
+
export const SERVER_VERSION = "0.1.1";
|
|
16
|
+
function flagValue(argv, name) {
|
|
17
|
+
const direct = argv.find((arg) => arg.startsWith(`${name}=`));
|
|
18
|
+
if (direct !== undefined)
|
|
19
|
+
return direct.slice(name.length + 1);
|
|
20
|
+
const i = argv.indexOf(name);
|
|
21
|
+
if (i !== -1)
|
|
22
|
+
return argv[i + 1];
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
function booleanFlag(argv, name) {
|
|
26
|
+
const direct = argv.find((arg) => arg.startsWith(`${name}=`));
|
|
27
|
+
if (direct !== undefined)
|
|
28
|
+
return !["", "0", "false", "no"].includes(direct.slice(name.length + 1).toLowerCase());
|
|
29
|
+
return argv.includes(name);
|
|
30
|
+
}
|
|
31
|
+
export function parseCliOptions(argv) {
|
|
32
|
+
const registryArg = flagValue(argv, "--registry");
|
|
33
|
+
const envRegistry = process.env.MOSVERA_REGISTRY_DIR;
|
|
34
|
+
const envReadOnly = process.env.MOSVERA_MCP_READ_ONLY ?? process.env.MOSVERA_READ_ONLY;
|
|
35
|
+
const parsed = {
|
|
36
|
+
readOnlyMode: booleanFlag(argv, "--read-only") ||
|
|
37
|
+
booleanFlag(argv, "--readonly") ||
|
|
38
|
+
(envReadOnly !== undefined && !["", "0", "false", "no"].includes(envReadOnly.toLowerCase())),
|
|
39
|
+
};
|
|
40
|
+
const registryDir = registryArg !== undefined && registryArg.length > 0 ? registryArg : envRegistry;
|
|
41
|
+
if (registryDir !== undefined)
|
|
42
|
+
parsed.registryDir = registryDir;
|
|
43
|
+
return parsed;
|
|
44
|
+
}
|
|
45
|
+
export function defaultRegistryDir(platform = process.platform, env = process.env) {
|
|
46
|
+
if (platform === "darwin")
|
|
47
|
+
return join(homedir(), "Library", "Application Support", "Mosvera", "registry");
|
|
48
|
+
if (platform === "win32")
|
|
49
|
+
return join(env.APPDATA ?? join(homedir(), "AppData", "Roaming"), "Mosvera", "registry");
|
|
50
|
+
return join(env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "mosvera", "registry");
|
|
51
|
+
}
|
|
52
|
+
export function packagedRegistryDir() {
|
|
53
|
+
const distPath = fileURLToPath(new URL("./examples/demo-aesthetics", import.meta.url));
|
|
54
|
+
if (existsSync(distPath))
|
|
55
|
+
return distPath;
|
|
56
|
+
return fileURLToPath(new URL("../examples/demo-aesthetics", import.meta.url));
|
|
57
|
+
}
|
|
58
|
+
function hasRegistryDocuments(directory) {
|
|
59
|
+
if (!existsSync(directory))
|
|
60
|
+
return false;
|
|
61
|
+
return readdirSync(directory).some((name) => /^(template|modifier|palette|composition)\.[a-z0-9_-]+\.json$/i.test(name));
|
|
62
|
+
}
|
|
63
|
+
function seedRegistryIfEmpty(directory) {
|
|
64
|
+
if (hasRegistryDocuments(directory))
|
|
65
|
+
return;
|
|
66
|
+
cpSync(packagedRegistryDir(), directory, {
|
|
67
|
+
recursive: true,
|
|
68
|
+
force: false,
|
|
69
|
+
errorOnExist: false,
|
|
70
|
+
filter(source) {
|
|
71
|
+
return !source.endsWith("README.md");
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function manifestDiagnostics(project, validator) {
|
|
76
|
+
const diagnostics = [];
|
|
77
|
+
for (const [provider, manifest] of Object.entries(project.manifests)) {
|
|
78
|
+
const result = validator.validate(manifest, "capability-manifest");
|
|
79
|
+
if (!result.valid) {
|
|
80
|
+
diagnostics.push({
|
|
81
|
+
code: "schema_failure",
|
|
82
|
+
kind: "capability-manifest",
|
|
83
|
+
id: provider,
|
|
84
|
+
message: `capability manifest "${provider}" failed schema validation`,
|
|
85
|
+
errors: result.errors.map((e) => ({ path: e.path, message: e.message })),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return diagnostics;
|
|
90
|
+
}
|
|
91
|
+
export function registryDiagnostics(project, validator) {
|
|
92
|
+
return [
|
|
93
|
+
...validateRegistry(project.registry, { validator }),
|
|
94
|
+
...manifestDiagnostics(project, validator),
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
function emptyProject() {
|
|
98
|
+
return {
|
|
99
|
+
registry: { templates: {}, modifiers: {}, palettes: {}, compositions: {} },
|
|
100
|
+
manifests: {},
|
|
101
|
+
strategies: {},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function loadProjectOrEmpty(directory, validator) {
|
|
105
|
+
if (!existsSync(directory))
|
|
106
|
+
return emptyProject();
|
|
107
|
+
if (!statSync(directory).isDirectory()) {
|
|
108
|
+
throw new Error(`registry path is not a directory: ${directory}`);
|
|
109
|
+
}
|
|
110
|
+
return loadProject(directory, { validator });
|
|
111
|
+
}
|
|
112
|
+
function makeContext(registryDir, project, validator, options) {
|
|
113
|
+
const ctx = {
|
|
114
|
+
registryDir,
|
|
115
|
+
registryWritable: options.registryWritable,
|
|
116
|
+
readOnlyMode: options.readOnlyMode,
|
|
117
|
+
fallbackRegistry: options.fallbackRegistry,
|
|
118
|
+
loadDiagnostics: options.loadDiagnostics ?? [],
|
|
119
|
+
project,
|
|
120
|
+
validator,
|
|
121
|
+
baseStrategies: composeStrategies(deriveStrategies(), project.strategies),
|
|
122
|
+
adapters: {
|
|
123
|
+
[openaiAdapter.id]: openaiAdapter,
|
|
124
|
+
[fluxAdapter.id]: fluxAdapter,
|
|
125
|
+
[sdxlAdapter.id]: sdxlAdapter,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
if (options.fallbackReason !== undefined)
|
|
129
|
+
ctx.fallbackReason = options.fallbackReason;
|
|
130
|
+
return ctx;
|
|
131
|
+
}
|
|
132
|
+
export function reloadContext(ctx) {
|
|
133
|
+
const project = loadProject(ctx.registryDir, { validator: ctx.validator });
|
|
134
|
+
ctx.project = project;
|
|
135
|
+
ctx.baseStrategies = composeStrategies(deriveStrategies(), project.strategies);
|
|
136
|
+
ctx.loadDiagnostics = [];
|
|
137
|
+
}
|
|
138
|
+
export function buildContext(input = {}) {
|
|
139
|
+
const options = typeof input === "string" ? { registryDir: input } : input;
|
|
140
|
+
const validator = createValidator();
|
|
141
|
+
const requestedRegistry = options.registryDir;
|
|
142
|
+
const registryDir = resolve(requestedRegistry ?? defaultRegistryDir());
|
|
143
|
+
const readOnlyMode = options.readOnlyMode ?? false;
|
|
144
|
+
if (readOnlyMode) {
|
|
145
|
+
const readOnlyDir = resolve(requestedRegistry ?? packagedRegistryDir());
|
|
146
|
+
const project = loadProjectOrEmpty(readOnlyDir, validator);
|
|
147
|
+
return makeContext(readOnlyDir, project, validator, {
|
|
148
|
+
registryWritable: false,
|
|
149
|
+
readOnlyMode: true,
|
|
150
|
+
fallbackRegistry: false,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
mkdirSync(registryDir, { recursive: true });
|
|
155
|
+
seedRegistryIfEmpty(registryDir);
|
|
156
|
+
const project = loadProject(registryDir, { validator });
|
|
157
|
+
return makeContext(registryDir, project, validator, {
|
|
158
|
+
registryWritable: true,
|
|
159
|
+
readOnlyMode: false,
|
|
160
|
+
fallbackRegistry: false,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
const fallbackDir = packagedRegistryDir();
|
|
165
|
+
const project = loadProject(fallbackDir, { validator });
|
|
166
|
+
const diagnostics = e instanceof RegistryProjectError ? e.diagnostics :
|
|
167
|
+
[{ code: "unsafe_filename", message: e instanceof Error ? e.message : String(e) }];
|
|
168
|
+
return makeContext(fallbackDir, project, validator, {
|
|
169
|
+
registryWritable: false,
|
|
170
|
+
readOnlyMode: true,
|
|
171
|
+
fallbackRegistry: true,
|
|
172
|
+
fallbackReason: e instanceof Error ? e.message : String(e),
|
|
173
|
+
loadDiagnostics: diagnostics,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export function bundleRoot() {
|
|
178
|
+
return dirname(dirname(packagedRegistryDir()));
|
|
179
|
+
}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResolutionError } from "@mosvera/runtime";
|
|
2
|
+
import type { JsonObject, ValidationIssue } from "@mosvera/runtime";
|
|
3
|
+
import type { ToolError, ToolErrorCode } from "./types.ts";
|
|
4
|
+
export declare function toolError(error: ToolErrorCode, detail?: JsonObject | string): ToolError;
|
|
5
|
+
export declare function invalidDocument(errors: ValidationIssue[]): ToolError;
|
|
6
|
+
/** Map a runtime ResolutionError.kind straight onto the taxonomy. */
|
|
7
|
+
export declare function mapResolutionError(e: ResolutionError): ToolError;
|
|
8
|
+
export declare function isResolutionError(e: unknown): e is ResolutionError;
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
//
|
|
3
|
+
// Closed MCP error taxonomy and runtime-error mapping (design spec D2/§7).
|
|
4
|
+
// Tool handlers return these as data; nothing is thrown across the MCP
|
|
5
|
+
// boundary.
|
|
6
|
+
import { ResolutionError } from "@mosvera/runtime";
|
|
7
|
+
export function toolError(error, detail) {
|
|
8
|
+
return detail === undefined ? { error } : { error, detail };
|
|
9
|
+
}
|
|
10
|
+
export function invalidDocument(errors) {
|
|
11
|
+
return { error: "invalid_document", detail: { errors } };
|
|
12
|
+
}
|
|
13
|
+
/** Map a runtime ResolutionError.kind straight onto the taxonomy. */
|
|
14
|
+
export function mapResolutionError(e) {
|
|
15
|
+
return { error: e.kind };
|
|
16
|
+
}
|
|
17
|
+
export function isResolutionError(e) {
|
|
18
|
+
return e instanceof ResolutionError;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-License-Identifier: CC-BY-4.0
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
# MCP Examples
|
|
6
|
+
|
|
7
|
+
`demo-aesthetics/` is the default registry seed used by `@mosvera/mcp`.
|
|
8
|
+
On first run, the server copies those public-safe aesthetics into the user's
|
|
9
|
+
local registry directory.
|
|
10
|
+
|
|
11
|
+
`cinematic-editorial/` is retained as a compact provider-compilation fixture
|
|
12
|
+
for tests and advanced examples.
|
|
13
|
+
|
|
14
|
+
The public MCP surface is documented in the repository README. Use
|
|
15
|
+
`server_status` first when debugging an install; it reports the active registry
|
|
16
|
+
path, write mode, versions, document counts, and diagnostics.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-License-Identifier: CC-BY-4.0
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
# Example: Cinematic Editorial
|
|
6
|
+
|
|
7
|
+
A worked Mosvera aesthetic system expressed entirely in schema-valid documents.
|
|
8
|
+
It demonstrates single inheritance (`noir` extends `cinematic-editorial-base`),
|
|
9
|
+
modifier composition (`golden-hour`, `high-contrast`), an inline override, and a
|
|
10
|
+
project-level `merge-strategies.json` declaring that the open aesthetic field
|
|
11
|
+
`lights` merges by the `name` key (MEP-0001 `merge_by`). The composition also
|
|
12
|
+
includes the Phase 4 image-generation fields (`subject`, `aspect_ratio`,
|
|
13
|
+
`quality`, `safety`, and `palette.accent`) used by the provider adapters.
|
|
14
|
+
|
|
15
|
+
`manifests/illustrative-image.manifest.json` is an **illustrative** capability
|
|
16
|
+
manifest used only to exercise the MEP-0003 compilation contract end-to-end. It
|
|
17
|
+
is NOT a real provider adapter. The real reference adapters live in
|
|
18
|
+
[`mosvera/providers`](https://github.com/mosvera/providers).
|
|
19
|
+
|
|
20
|
+
This directory is retained as a compact provider-compilation fixture. The
|
|
21
|
+
default first-run registry seed for the public MCP server is
|
|
22
|
+
[`../demo-aesthetics/`](../demo-aesthetics/).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://mosvera.io/schema/0.1/composition",
|
|
3
|
+
"id": "editorial-noir-golden",
|
|
4
|
+
"base": "noir",
|
|
5
|
+
"modifiers": ["golden-hour", "high-contrast"],
|
|
6
|
+
"overrides": {
|
|
7
|
+
"subject": "a lighthouse on a basalt cliff at dusk",
|
|
8
|
+
"medium": "cinematic",
|
|
9
|
+
"palette": { "accent": "#c8943f" },
|
|
10
|
+
"aspect_ratio": "3:2",
|
|
11
|
+
"quality": "high",
|
|
12
|
+
"safety": "standard"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://mosvera.io/schema/0.1/capability-manifest",
|
|
3
|
+
"provider": "illustrative-image",
|
|
4
|
+
"adapter_version": "0.0.0-illustrative",
|
|
5
|
+
"constructs": {
|
|
6
|
+
"subject": { "lowering_action": "native" },
|
|
7
|
+
"medium": { "lowering_action": "native" },
|
|
8
|
+
"aspect_ratio": { "lowering_action": "native" },
|
|
9
|
+
"quality": { "lowering_action": "native" },
|
|
10
|
+
"safety": { "lowering_action": "unsupported", "note": "ILLUSTRATIVE ONLY — no tunable moderation control." },
|
|
11
|
+
"lighting": { "lowering_action": "approximate", "note": "ILLUSTRATIVE ONLY — not a real provider. lighting scheme/mood folded into a prompt phrase." },
|
|
12
|
+
"color_grade": { "lowering_action": "approximate", "note": "ILLUSTRATIVE ONLY — contrast/saturation folded into prompt adjectives." },
|
|
13
|
+
"palette": { "lowering_action": "approximate", "note": "ILLUSTRATIVE ONLY — accent color folded into prompt phrase." },
|
|
14
|
+
"lights": { "lowering_action": "emulate", "note": "ILLUSTRATIVE ONLY — named lights emulated via descriptive prompt clauses." }
|
|
15
|
+
}
|
|
16
|
+
}
|