@shadsapp/mcp 0.1.4 → 1.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/README.md CHANGED
@@ -1,190 +1,45 @@
1
- # @shadsapp/mcp
1
+ # @shadsapp/mcp (Deprecated)
2
2
 
3
- MCP server for [shads.app](https://shads.app). It gives AI clients access to curated shadcn/ui themes, theme validation, registry URLs, theme skills, and installation plans.
3
+ > [!WARNING]
4
+ > **DEPRECATION NOTICE**: This npm package is deprecated in favor of the official zero-install remote HTTP MCP server at **`https://mcp.shads.app`**.
5
+ >
6
+ > You no longer need to install or run Node.js packages locally. Remove the `@shadsapp/mcp` entry from your MCP client config and connect directly to the HTTP endpoint. Each client uses a different config format, so follow the guide for yours: [shads.app/docs/mcp](https://shads.app/docs/mcp).
4
7
 
5
- The server uses the MCP **stdio transport**. It runs as a child process started by an MCP client such as Claude Desktop, Cursor, VS Code, or another MCP host.
8
+ ## Migration
6
9
 
7
- ## Requirements
10
+ If you previously configured the `@shadsapp/mcp` command in your MCP client settings (e.g. `npx -y @shadsapp/mcp`), delete it and add the remote server `https://mcp.shads.app` using the [client guide](https://shads.app/docs/mcp). For any client, `npx add-mcp https://mcp.shads.app` writes the config for you.
8
11
 
9
- - Node.js 18 or newer
10
- - Internet access for registry tools (`resolve_share`, `get_theme_package`, `get_skill`, and `install_plan`)
11
- - A project using the shadcn CLI for generated install commands
12
+ Executing `npx @shadsapp/mcp` will output this deprecation notice and exit.
12
13
 
13
- `list_themes`, `get_theme`, `validate_theme`, `theme_schema`, and `list_starters` work from the installed package without a network request.
14
+ ## Available tools on `https://mcp.shads.app`
14
15
 
15
- ## Installation
16
-
17
- ### Run directly with npx
18
-
19
- This is the simplest option. The MCP client downloads the package when it starts the server:
20
-
21
- ```bash
22
- npx -y @shadsapp/mcp
23
- ```
24
-
25
- Use the following configuration in an MCP client that supports JSON server configuration:
26
-
27
- ```json
28
- {
29
- "mcpServers": {
30
- "shads": {
31
- "command": "npx",
32
- "args": ["-y", "@shadsapp/mcp"]
33
- }
34
- }
35
- }
36
- ```
37
-
38
- ### Install globally
39
-
40
- ```bash
41
- npm install --global @shadsapp/mcp
42
- shads-mcp
43
- ```
44
-
45
- Then configure the client with:
46
-
47
- ```json
48
- {
49
- "mcpServers": {
50
- "shads": {
51
- "command": "shads-mcp"
52
- }
53
- }
54
- }
55
- ```
56
-
57
- ### Install locally in a project
58
-
59
- ```bash
60
- npm install --save-dev @shadsapp/mcp
61
- ```
62
-
63
- Use an absolute executable path when the MCP host does not inherit your project's `node_modules/.bin` path. For example:
64
-
65
- ```json
66
- {
67
- "mcpServers": {
68
- "shads": {
69
- "command": "/absolute/path/to/project/node_modules/.bin/shads-mcp"
70
- }
71
- }
72
- }
73
- ```
74
-
75
- On Windows, use the generated `shads-mcp.cmd` path or run through `npx.cmd`:
76
-
77
- ```json
78
- {
79
- "mcpServers": {
80
- "shads": {
81
- "command": "npx.cmd",
82
- "args": ["-y", "@shadsapp/mcp"]
83
- }
84
- }
85
- }
86
- ```
87
-
88
- ## Client setup
89
-
90
- Add the configuration to the MCP client's server settings, then restart the client. The server communicates over stdin/stdout, so do not add logging or other output to stdout in a wrapper script. Diagnostics belong on stderr.
91
-
92
- If the client supports an explicit working directory, set it to the project where shadcn commands should run. The MCP server itself does not modify that project; it returns install commands for the agent or user to review and run.
93
-
94
- ## Available tools
16
+ ### Public tools
95
17
 
96
18
  | Tool | Input | Purpose |
97
19
  | -------------------- | ------------------------------------------- | ---------------------------------------------------- |
98
- | `list_themes` | `{}` | List bundled starter theme metadata. |
99
- | `get_theme` | `{ "id": "workspace" }` | Return a bundled theme and CSS. |
20
+ | `list_themes` | `{}` | List curated public starter themes. |
21
+ | `get_theme` | `{ "id": "system-modern-default-theme" }` | Return a theme document and CSS. |
100
22
  | `validate_theme` | `{ "source": "..." }` | Validate raw or fenced `theme.json` text. |
101
23
  | `theme_schema` | `{}` | Return the active schema id. |
102
24
  | `list_starters` | `{}` | List starter registry and skill URLs. |
103
- | `get_install_prompt` | `{ "item": "workspace", "mode": "both" }` | Return a copyable install prompt. |
25
+ | `get_install_prompt` | `{ "item": "system-modern-default-theme", "mode": "both" }` | Return a copyable install prompt. |
104
26
  | `resolve_share` | `{ "item": "abc123" }` | Resolve a registry/share item and return its prompt. |
105
- | `get_theme_package` | `{ "id": "workspace" }` | Return theme, skill, dependencies, and install data. |
106
- | `get_skill` | `{ "id": "workspace" }` | Return the theme-specific skill markdown. |
107
- | `install_plan` | `{ "id": "workspace", "mode": "existing" }` | Return validated install commands and notes. |
108
-
109
- Starter names such as `workspace` are converted to registry item ids such as `workspace-theme`. You may also provide a theme item id, a share id, or a registry URL such as `https://shads.app/r/workspace-theme.json`.
110
-
111
- Registry item ids accept only letters, numbers, hyphens, and underscores. This keeps generated shell commands safe to review and execute.
112
-
113
- ## Typical workflows
114
-
115
- ### Install a starter into an existing app
116
-
117
- 1. Call `get_theme_package` with `{ "id": "workspace" }`.
118
- 2. Review the returned theme URL, skill markdown, dependencies, and prompt.
119
- 3. Call `install_plan` with mode `existing` if you only need the command.
120
- 4. Run the returned command from the target shadcn project.
121
-
122
- ### Create a new app from a starter
123
-
124
- Call `get_install_prompt` with mode `new`:
125
-
126
- ```json
127
- {
128
- "item": "workspace",
129
- "mode": "new"
130
- }
131
- ```
132
-
133
- The result contains the `shadcn create` command and the relevant theme skill instructions.
134
-
135
- ### Validate a theme document
136
-
137
- Pass the complete JSON text or a fenced JSON block:
138
-
139
- ````json
140
- {
141
- "source": "```json\n{\"$schema\":\"shads-theme/v1\",\"config\":{}}\n```"
142
- }
143
- ````
144
-
145
- The result has `ok: true` and a normalized document when valid, or `ok: false` with a list of validation errors.
146
-
147
- ## Troubleshooting
148
-
149
- ### The client cannot start the server
150
-
151
- Check that Node.js 18 or newer is available to the client process:
152
-
153
- ```bash
154
- node --version
155
- npx -y @shadsapp/mcp
156
- ```
157
-
158
- For GUI clients, use an absolute command path or configure the full path to `npx`/`npx.cmd`. GUI applications often have a smaller `PATH` than your shell.
159
-
160
- ### The server starts but registry tools fail
161
-
162
- The remote registry tools require network access to `https://shads.app`. Check that the client process can reach the registry and that the item exists. Remote requests fail with a bounded timeout rather than waiting indefinitely.
163
-
164
- ### Install commands do not affect the project
165
-
166
- The server only returns commands. Run them from the target shadcn project, or configure the MCP host's working directory when supported.
167
-
168
- ## Development
169
-
170
- From the repository root:
171
-
172
- ```bash
173
- npm install
174
- npm run test -w @shadsapp/mcp
175
- npm run typecheck -w @shadsapp/mcp
176
- npm run build -w @shadsapp/mcp
177
- npm pack -w @shadsapp/mcp --dry-run
178
- ```
179
-
180
- The published package contains `dist`, the executable entrypoint, and this README. The server uses stderr for fatal startup diagnostics and reserves stdout for MCP protocol messages.
181
-
182
- ## Related packages
183
-
184
- - [`@shadsapp/schema`](https://www.npmjs.com/package/@shadsapp/schema)
185
- - [`@shadsapp/themes`](https://www.npmjs.com/package/@shadsapp/themes)
186
- - [`@shadsapp/cli`](https://www.npmjs.com/package/@shadsapp/cli)
187
-
188
- ## License
189
-
190
- MIT
27
+ | `get_theme_package` | `{ "id": "system-modern-default-theme" }` | Return theme, skill, dependencies, and install data. |
28
+ | `get_skill` | `{ "id": "system-modern-default-theme" }` | Return the theme-specific skill markdown. |
29
+ | `install_plan` | `{ "id": "system-modern-default-theme", "mode": "existing" }` | Return validated install commands and notes. |
30
+ | `list_concepts` | `{}` | List visual-language concepts. |
31
+ | `get_concept` | `{ "slug": "terminal" }` | Return a concept document. |
32
+ | `connection_status` | `{}` | Verify the connection, plan, and API key status. |
33
+
34
+ ### Pro tools (require `Authorization: Bearer <key>`)
35
+
36
+ | Tool | Input | Purpose |
37
+ | -------------------- | ----------------------------------------------------- | ------------------------------------------------------- |
38
+ | `list_my_themes` | `{}` | List your saved cloud themes. |
39
+ | `get_my_theme` | `{ "id": "<theme id>" }` | Return one theme as `theme.json` + a single stylesheet. |
40
+ | `save_theme` | `{ "name": "...", "document": "..." }` | Save a theme document to your account. |
41
+ | `update_theme` | `{ "id": "...", "name?": "...", "document?": "..." }` | Rename and/or update a saved theme. |
42
+ | `generate_theme` | `{ "description": "..." }` | Hosted AI generation (uses your monthly quota). |
43
+ | `check_subscription` | `{}` | Show plan, MCP access, AI quota, and theme count. |
44
+
45
+ For more information, visit [shads.app/docs/mcp](https://shads.app/docs/mcp).
@@ -0,0 +1,65 @@
1
+ export declare const API_BASE: string;
2
+ export declare function readApiKey(): string | null;
3
+ export declare class ShadsApiError extends Error {
4
+ readonly status: number;
5
+ constructor(status: number, message: string);
6
+ }
7
+ export type ConceptSummary = {
8
+ id: string;
9
+ version: number;
10
+ trust: "system" | "user";
11
+ name: string;
12
+ family: string;
13
+ description: string;
14
+ swatch: string[];
15
+ baseThemes: Array<{
16
+ id: string;
17
+ label: string;
18
+ }>;
19
+ runtimes: Array<"base-ui" | "radix" | "react-aria">;
20
+ modes: Array<"light" | "dark">;
21
+ };
22
+ export declare function listConcepts(): Promise<{
23
+ items: ConceptSummary[];
24
+ }>;
25
+ export declare function getConcept(slug: string): Promise<Record<string, unknown>>;
26
+ export type CloudThemeSummary = {
27
+ id: string;
28
+ name: string;
29
+ updatedAt: string;
30
+ };
31
+ export type CloudThemeDetail = {
32
+ id: string;
33
+ name: string;
34
+ config: Record<string, unknown>;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ /** Full theme.json document (shads-theme/v1). */
38
+ themeDocumentJson: string;
39
+ /** Single stylesheet: tokens, adapters, and the @theme wiring. */
40
+ themeCss: string;
41
+ };
42
+ export type GenerateThemeResult = {
43
+ documents: Array<Record<string, unknown>>;
44
+ usage: number;
45
+ };
46
+ export type SubscriptionStatus = {
47
+ plan: string;
48
+ mcpAccess: boolean;
49
+ aiGenerations: {
50
+ used: number;
51
+ limit: number | null;
52
+ };
53
+ savedThemes: number;
54
+ entitlements: Record<string, unknown>;
55
+ };
56
+ export declare function listMyThemes(): Promise<CloudThemeSummary[]>;
57
+ export declare function getMyTheme(id: string): Promise<CloudThemeDetail>;
58
+ export declare function saveTheme(name: string, config: Record<string, unknown>): Promise<CloudThemeSummary>;
59
+ export declare function updateTheme(id: string, patch: {
60
+ name?: string;
61
+ config?: Record<string, unknown>;
62
+ }): Promise<CloudThemeDetail>;
63
+ export declare function generateTheme(description: string): Promise<GenerateThemeResult>;
64
+ export declare function checkSubscription(): Promise<SubscriptionStatus>;
65
+ //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,EAAE,MAEF,CAAA;AAKrB,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAG1C;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAEX,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AA0GD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,UAAU,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAChD,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC,CAAA;IACnD,KAAK,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAA;CAC/B,CAAA;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAAE,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CAEzE;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,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;AAED,wBAAsB,WAAW,CAC/B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACzD,OAAO,CAAC,gBAAgB,CAAC,CAM3B;AAED,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,mBAAmB,CAAC,CAM9B;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAErE"}
@@ -0,0 +1,125 @@
1
+ import { REGISTRY_HOMEPAGE } from "./install-prompt.js";
2
+ export const API_BASE = (process.env.SHADS_API_BASE ?? REGISTRY_HOMEPAGE).replace(/\/+$/, "");
3
+ const REQUEST_TIMEOUT_MS = 30_000;
4
+ const GENERATE_TIMEOUT_MS = 90_000;
5
+ export function readApiKey() {
6
+ const key = process.env.SHADS_API_KEY?.trim();
7
+ return key && key.startsWith("shads_live_") ? key : null;
8
+ }
9
+ export class ShadsApiError extends Error {
10
+ status;
11
+ constructor(status, message) {
12
+ super(message);
13
+ this.name = "ShadsApiError";
14
+ this.status = status;
15
+ }
16
+ }
17
+ function friendlyError(status, payloadError) {
18
+ if (status === 401) {
19
+ return (payloadError ??
20
+ "Your shads.app API key is invalid or revoked. Create a new one in Account settings > API keys (shads.app).");
21
+ }
22
+ if (status === 402) {
23
+ return (payloadError ??
24
+ "This feature requires a Pro plan. Upgrade: https://shads.app/pricing");
25
+ }
26
+ if (status === 429) {
27
+ return (payloadError ??
28
+ "Rate limited by shads.app (too many requests). Wait a moment and retry.");
29
+ }
30
+ return payloadError ?? `shads.app request failed (${status})`;
31
+ }
32
+ async function request(path, init = {}) {
33
+ const apiKey = readApiKey();
34
+ if (!apiKey) {
35
+ throw new ShadsApiError(401, "No shads.app API key configured. Set SHADS_API_KEY in your MCP server env (Pro feature: https://shads.app/pricing).");
36
+ }
37
+ let response;
38
+ try {
39
+ response = await fetch(`${API_BASE}${path}`, {
40
+ method: init.method ?? "GET",
41
+ headers: {
42
+ Accept: "application/json",
43
+ Authorization: `Bearer ${apiKey}`,
44
+ ...(init.body === undefined
45
+ ? {}
46
+ : { "Content-Type": "application/json" }),
47
+ },
48
+ body: init.body === undefined ? undefined : JSON.stringify(init.body),
49
+ signal: AbortSignal.timeout(init.timeoutMs ?? REQUEST_TIMEOUT_MS),
50
+ });
51
+ }
52
+ catch (cause) {
53
+ if (cause instanceof Error && cause.name === "TimeoutError") {
54
+ throw new ShadsApiError(504, "shads.app request timed out. Retry.");
55
+ }
56
+ throw new ShadsApiError(0, `Could not reach shads.app at ${API_BASE}. Check your network.`);
57
+ }
58
+ const payload = (await response
59
+ .json()
60
+ .catch(() => null));
61
+ if (!response.ok) {
62
+ const payloadError = payload && typeof payload.error === "string" ? payload.error : null;
63
+ throw new ShadsApiError(response.status, friendlyError(response.status, payloadError));
64
+ }
65
+ return payload;
66
+ }
67
+ async function requestPublic(path) {
68
+ let response;
69
+ try {
70
+ response = await fetch(`${API_BASE}${path}`, {
71
+ headers: { Accept: "application/json" },
72
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
73
+ });
74
+ }
75
+ catch (cause) {
76
+ if (cause instanceof Error && cause.name === "TimeoutError") {
77
+ throw new ShadsApiError(504, "shads.app request timed out. Retry.");
78
+ }
79
+ throw new ShadsApiError(0, `Could not reach shads.app at ${API_BASE}. Check your network.`);
80
+ }
81
+ const payload = (await response
82
+ .json()
83
+ .catch(() => null));
84
+ if (!response.ok) {
85
+ const payloadError = payload && typeof payload.error === "string" ? payload.error : null;
86
+ throw new ShadsApiError(response.status, payloadError ?? `shads.app request failed (${response.status})`);
87
+ }
88
+ return payload;
89
+ }
90
+ export async function listConcepts() {
91
+ return requestPublic("/api/concepts");
92
+ }
93
+ export async function getConcept(slug) {
94
+ return requestPublic(`/api/concepts/${encodeURIComponent(slug)}`);
95
+ }
96
+ export async function listMyThemes() {
97
+ const data = await request("/api/themes");
98
+ return data.items.map((item) => ({
99
+ id: item.id,
100
+ name: item.name,
101
+ updatedAt: item.updatedAt,
102
+ }));
103
+ }
104
+ export async function getMyTheme(id) {
105
+ return request(`/api/themes/${encodeURIComponent(id)}?format=bundle`);
106
+ }
107
+ export async function saveTheme(name, config) {
108
+ const created = await request("/api/themes", { method: "POST", body: { name, config } });
109
+ return { id: created.id, name: created.name, updatedAt: created.updatedAt };
110
+ }
111
+ export async function updateTheme(id, patch) {
112
+ const updated = await request(`/api/themes/${encodeURIComponent(id)}`, { method: "PATCH", body: patch });
113
+ return updated;
114
+ }
115
+ export async function generateTheme(description) {
116
+ return request("/api/ai/generate", {
117
+ method: "POST",
118
+ body: { description },
119
+ timeoutMs: GENERATE_TIMEOUT_MS,
120
+ });
121
+ }
122
+ export async function checkSubscription() {
123
+ return request("/api/mcp/status");
124
+ }
125
+ //# sourceMappingURL=api-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,CAAC,MAAM,QAAQ,GAAW,CAC9B,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,iBAAiB,CAChD,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAErB,MAAM,kBAAkB,GAAG,MAAM,CAAA;AACjC,MAAM,mBAAmB,GAAG,MAAM,CAAA;AAElC,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,CAAA;IAC7C,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;AAC1D,CAAC;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,MAAM,CAAQ;IAEvB,YAAY,MAAc,E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AC1B,CAAC,CAAC,CAAA;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAU;IACzC,OAAO,OAAO,CACZ,eAAe,kBAAkB,CAAC,EAAE,CAAC,gBAAgB,CACtD,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAY,EACZ,MAA+B;IAE/B,MAAM,OAAO,GAAG,MAAM,OAAO,CAI1B,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;IAC7D,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAA;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,EAAU,EACV,KAA0D;IAE1D,MAAM,OAAO,GAAG,MAAM,OAAO,CAC3B,eAAe,kBAAkB,CAAC,EAAE,CAAC,EAAE,EACvC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CACjC,CAAA;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAmB;IAEnB,OAAO,OAAO,CAAsB,kBAAkB,EAAE;QACtD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,WAAW,EAAE;QACrB,SAAS,EAAE,mBAAmB;KAC/B,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,OAAO,CAAqB,iBAAiB,CAAC,CAAA;AACvD,CAAC"}
package/dist/index.js CHANGED
@@ -1,419 +1,38 @@
1
1
  #!/usr/bin/env node
2
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
- import { parseThemeDocumentInput, THEME_SCHEMA } from "@shadsapp/schema";
6
- import { getTheme, listThemes } from "@shadsapp/themes";
7
- import { buildAgentInstallPrompt, buildInstallPlan, listStarterInstallEntries, REGISTRY_HOMEPAGE, resolveSafeItemId, systemSkillItemId, } from "./install-prompt.js";
8
- const server = new Server({
9
- name: "shads",
10
- version: "0.1.1",
11
- }, {
12
- capabilities: {
13
- tools: {},
14
- },
15
- });
16
- server.setRequestHandler(ListToolsRequestSchema, async () => ({
17
- tools: [
18
- {
19
- name: "list_themes",
20
- description: "List curated public shads starter themes",
21
- inputSchema: {
22
- type: "object",
23
- properties: {},
24
- additionalProperties: false,
25
- },
26
- },
27
- {
28
- name: "get_theme",
29
- description: "Get a public theme bundle (theme.json + theme.css)",
30
- inputSchema: {
31
- type: "object",
32
- properties: {
33
- id: {
34
- type: "string",
35
- description: "Theme id, e.g. workspace",
36
- },
37
- },
38
- required: ["id"],
39
- additionalProperties: false,
40
- },
41
- },
42
- {
43
- name: "validate_theme",
44
- description: "Validate a theme.json document string",
45
- inputSchema: {
46
- type: "object",
47
- properties: {
48
- source: {
49
- type: "string",
50
- description: "Raw theme.json text or fenced JSON",
51
- },
52
- },
53
- required: ["source"],
54
- additionalProperties: false,
55
- },
56
- },
57
- {
58
- name: "theme_schema",
59
- description: "Return the active shads theme document schema id",
60
- inputSchema: {
61
- type: "object",
62
- properties: {},
63
- additionalProperties: false,
64
- },
65
- },
66
- {
67
- name: "list_starters",
68
- description: "List all shads starter themes with registry install URLs for agents",
69
- inputSchema: {
70
- type: "object",
71
- properties: {},
72
- additionalProperties: false,
73
- },
74
- },
75
- {
76
- name: "get_install_prompt",
77
- description: "Return a copyable agent install prompt for a starter, share id, or registry URL",
78
- inputSchema: {
79
- type: "object",
80
- properties: {
81
- item: {
82
- type: "string",
83
- description: "Starter id (workspace), theme item id, share id, or full registry URL",
84
- },
85
- mode: {
86
- type: "string",
87
- enum: ["existing", "new", "both"],
88
- description: "Which install commands to include (default both)",
89
- },
90
- },
91
- required: ["item"],
92
- additionalProperties: false,
93
- },
94
- },
95
- {
96
- name: "resolve_share",
97
- description: "Resolve a share or registry item URL and return title plus install prompt",
98
- inputSchema: {
99
- type: "object",
100
- properties: {
101
- item: {
102
- type: "string",
103
- description: "Share id, theme item id, or registry URL",
104
- },
105
- },
106
- required: ["item"],
107
- additionalProperties: false,
108
- },
109
- },
110
- {
111
- name: "get_theme_package",
112
- description: "Fetch a full theme package: registry theme, theme skill markdown, and install URLs",
113
- inputSchema: {
114
- type: "object",
115
- properties: {
116
- id: {
117
- type: "string",
118
- description: "Starter id (workspace), theme item id, share id, or registry URL",
119
- },
120
- },
121
- required: ["id"],
122
- additionalProperties: false,
123
- },
124
- },
125
- {
126
- name: "get_skill",
127
- description: "Return the theme-specific skill markdown for a starter or share",
128
- inputSchema: {
129
- type: "object",
130
- properties: {
131
- id: {
132
- type: "string",
133
- description: "Starter id, theme item id, share id, or registry URL",
134
- },
135
- },
136
- required: ["id"],
137
- additionalProperties: false,
138
- },
139
- },
140
- {
141
- name: "install_plan",
142
- description: "Ordered shell commands to install a theme into a new or existing project",
143
- inputSchema: {
144
- type: "object",
145
- properties: {
146
- id: {
147
- type: "string",
148
- description: "Starter id, theme item id, share id, or registry URL",
149
- },
150
- mode: {
151
- type: "string",
152
- enum: ["new", "existing"],
153
- description: "Install target (default existing)",
154
- },
155
- },
156
- required: ["id"],
157
- additionalProperties: false,
158
- },
159
- },
160
- ],
161
- }));
162
- const REGISTRY_FETCH_TIMEOUT_MS = 10_000;
163
- async function fetchRegistryItem(itemId) {
164
- try {
165
- const response = await fetch(`${REGISTRY_HOMEPAGE}/r/${itemId}.json`, {
166
- headers: { Accept: "application/json" },
167
- signal: AbortSignal.timeout(REGISTRY_FETCH_TIMEOUT_MS),
168
- });
169
- if (!response.ok) {
170
- return null;
171
- }
172
- return (await response.json());
2
+ console.error(`
3
+ [@shadsapp/mcp] DEPRECATION NOTICE
4
+ ================================================================================
5
+ The @shadsapp/mcp npm package is deprecated in favor of our zero-install
6
+ remote HTTP MCP server at:
7
+
8
+ https://mcp.shads.app
9
+
10
+ Please update your MCP client configuration (Cursor, Claude Desktop, VS Code,
11
+ Windsurf, Zed, etc.) to connect directly to the HTTP endpoint:
12
+
13
+ {
14
+ "mcpServers": {
15
+ "shads": {
16
+ "url": "https://mcp.shads.app"
173
17
  }
174
- catch {
175
- return null;
176
- }
177
- }
178
- function skillMarkdownFromItem(item) {
179
- const skillFile = item.files?.find((file) => file.target?.endsWith("SKILL.md"));
180
- return skillFile?.content ?? null;
18
+ }
181
19
  }
182
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
183
- switch (request.params.name) {
184
- case "list_themes": {
185
- return {
186
- content: [
187
- {
188
- type: "text",
189
- text: JSON.stringify(listThemes(), null, 2),
190
- },
191
- ],
192
- };
193
- }
194
- case "get_theme": {
195
- const id = String(request.params.arguments?.id ?? "");
196
- const bundle = getTheme(id);
197
- return {
198
- content: [
199
- {
200
- type: "text",
201
- text: JSON.stringify({
202
- id: bundle.id,
203
- meta: bundle.meta,
204
- theme: bundle.theme,
205
- themeCss: bundle.themeCss,
206
- }, null, 2),
207
- },
208
- ],
209
- };
210
- }
211
- case "validate_theme": {
212
- const source = String(request.params.arguments?.source ?? "");
213
- const result = parseThemeDocumentInput(source);
214
- return {
215
- content: [
216
- {
217
- type: "text",
218
- text: JSON.stringify(result, null, 2),
219
- },
220
- ],
221
- };
222
- }
223
- case "theme_schema": {
224
- return {
225
- content: [
226
- {
227
- type: "text",
228
- text: THEME_SCHEMA,
229
- },
230
- ],
231
- };
232
- }
233
- case "list_starters": {
234
- return {
235
- content: [
236
- {
237
- type: "text",
238
- text: JSON.stringify(listStarterInstallEntries(), null, 2),
239
- },
240
- ],
241
- };
242
- }
243
- case "get_install_prompt": {
244
- const item = String(request.params.arguments?.item ?? "");
245
- const mode = request.params.arguments?.mode;
246
- const itemId = resolveSafeItemId(item);
247
- const prompt = buildAgentInstallPrompt({ itemId, mode });
248
- return {
249
- content: [
250
- {
251
- type: "text",
252
- text: prompt,
253
- },
254
- ],
255
- };
256
- }
257
- case "resolve_share": {
258
- const item = String(request.params.arguments?.item ?? "");
259
- const itemId = resolveSafeItemId(item);
260
- const registryItem = await fetchRegistryItem(itemId);
261
- if (!registryItem) {
262
- return {
263
- content: [
264
- {
265
- type: "text",
266
- text: JSON.stringify({
267
- error: "Registry item not found",
268
- itemId,
269
- }, null, 2),
270
- },
271
- ],
272
- isError: true,
273
- };
274
- }
275
- const prompt = buildAgentInstallPrompt({
276
- itemId,
277
- title: registryItem.title ?? registryItem.name,
278
- });
279
- return {
280
- content: [
281
- {
282
- type: "text",
283
- text: JSON.stringify({
284
- itemId,
285
- title: registryItem.title ?? registryItem.name ?? itemId,
286
- prompt,
287
- }, null, 2),
288
- },
289
- ],
290
- };
291
- }
292
- case "get_theme_package": {
293
- const id = String(request.params.arguments?.id ?? "");
294
- const itemId = resolveSafeItemId(id);
295
- const themeItem = await fetchRegistryItem(itemId);
296
- if (!themeItem) {
297
- return {
298
- content: [
299
- {
300
- type: "text",
301
- text: JSON.stringify({ error: "Registry item not found", itemId }, null, 2),
302
- },
303
- ],
304
- isError: true,
305
- };
306
- }
307
- const skillItemId = systemSkillItemId(itemId);
308
- const skillItem = await fetchRegistryItem(skillItemId);
309
- const skillMarkdown = skillItem
310
- ? skillMarkdownFromItem(skillItem)
311
- : null;
312
- return {
313
- content: [
314
- {
315
- type: "text",
316
- text: JSON.stringify({
317
- itemId,
318
- title: themeItem.title ?? themeItem.name ?? itemId,
319
- themeUrl: `${REGISTRY_HOMEPAGE}/r/${itemId}.json`,
320
- skillItemId,
321
- skillUrl: `${REGISTRY_HOMEPAGE}/r/${skillItemId}.json`,
322
- skillMarkdown,
323
- registryDependencies: themeItem.registryDependencies ?? [],
324
- installPrompt: buildAgentInstallPrompt({
325
- itemId,
326
- title: themeItem.title ?? themeItem.name,
327
- }),
328
- installPlan: buildInstallPlan({
329
- itemId,
330
- title: themeItem.title ?? themeItem.name,
331
- mode: "existing",
332
- }),
333
- }, null, 2),
334
- },
335
- ],
336
- };
337
- }
338
- case "get_skill": {
339
- const id = String(request.params.arguments?.id ?? "");
340
- const itemId = resolveSafeItemId(id);
341
- const skillItemId = itemId.endsWith("-skill")
342
- ? itemId
343
- : systemSkillItemId(itemId);
344
- const skillItem = await fetchRegistryItem(skillItemId);
345
- if (!skillItem) {
346
- return {
347
- content: [
348
- {
349
- type: "text",
350
- text: JSON.stringify({ error: "Theme skill not found", skillItemId }, null, 2),
351
- },
352
- ],
353
- isError: true,
354
- };
355
- }
356
- const markdown = skillMarkdownFromItem(skillItem);
357
- return {
358
- content: [
359
- {
360
- type: "text",
361
- text: markdown ??
362
- JSON.stringify({ error: "Skill markdown missing", skillItemId }, null, 2),
363
- },
364
- ],
365
- isError: !markdown,
366
- };
367
- }
368
- case "install_plan": {
369
- const id = String(request.params.arguments?.id ?? "");
370
- const mode = request.params.arguments?.mode === "new" ? "new" : "existing";
371
- const itemId = resolveSafeItemId(id);
372
- const registryItem = await fetchRegistryItem(itemId);
373
- if (!registryItem) {
374
- return {
375
- content: [
376
- {
377
- type: "text",
378
- text: JSON.stringify({ error: "Registry item not found", itemId }, null, 2),
379
- },
380
- ],
381
- isError: true,
382
- };
383
- }
384
- const plan = buildInstallPlan({
385
- itemId,
386
- mode,
387
- title: registryItem?.title ?? registryItem?.name,
388
- });
389
- return {
390
- content: [
391
- {
392
- type: "text",
393
- text: JSON.stringify({
394
- itemId,
395
- mode,
396
- ...plan,
397
- prompt: buildAgentInstallPrompt({
398
- itemId,
399
- mode: mode === "new" ? "new" : "existing",
400
- title: registryItem?.title ?? registryItem?.name,
401
- }),
402
- }, null, 2),
403
- },
404
- ],
405
- };
406
- }
407
- default:
408
- throw new Error(`Unknown tool: ${request.params.name}`);
20
+
21
+ For Pro accounts with an API key:
22
+ {
23
+ "mcpServers": {
24
+ "shads": {
25
+ "url": "https://mcp.shads.app",
26
+ "headers": {
27
+ "Authorization": "Bearer YOUR_API_KEY"
28
+ }
409
29
  }
410
- });
411
- async function main() {
412
- const transport = new StdioServerTransport();
413
- await server.connect(transport);
30
+ }
414
31
  }
415
- main().catch((error) => {
416
- console.error(error);
417
- process.exit(1);
418
- });
32
+
33
+ Setup guides & documentation: https://shads.app/docs/mcp
34
+ ================================================================================
35
+ `);
36
+ process.exit(1);
37
+ export {};
419
38
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE;KACV;CACF,CACF,CAAA;AAED,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IAC5D,KAAK,EAAE;QACL;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,0CAA0C;YACvD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,EAAE;gBACd,oBAAoB,EAAE,KAAK;aAC5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AAU;gCACzC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,YAAY,EAAE,IAAI;6BACjD,CAAC;yBACH,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAA;QACH,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IAC3D,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCb,CAAC,CAAA;AAEF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,43 @@
1
+ export declare const AUTH_SETUP_MESSAGE = "shads.app premium tools need a Pro API key. Create one at https://shads.app (Account settings > API keys), then add it to your MCP client config: env { \"SHADS_API_KEY\": \"shads_live_...\" } for the @shadsapp/mcp server. Docs: https://shads.app/docs/mcp";
2
+ /**
3
+ * Mirrors modules/config/src/ai/limits.ts. This package is published standalone
4
+ * and cannot depend on the private `@modules/*` workspace, so the bounds are
5
+ * repeated here rather than imported.
6
+ */
7
+ export declare const DESCRIPTION_MIN_LENGTH = 10;
8
+ export declare const DESCRIPTION_MAX_LENGTH = 400;
9
+ export type ToolDefinition = {
10
+ name: string;
11
+ description: string;
12
+ inputSchema: Record<string, unknown>;
13
+ };
14
+ export declare const PREMIUM_TOOL_DEFINITIONS: ToolDefinition[];
15
+ export declare const AUTHENTICATE_TOOL: ToolDefinition;
16
+ export declare function hasApiKeyConfigured(): boolean;
17
+ export type ToolResult = {
18
+ content: {
19
+ type: "text";
20
+ text: string;
21
+ }[];
22
+ isError?: boolean;
23
+ };
24
+ export declare function textResult(data: unknown, isError?: boolean): ToolResult;
25
+ /**
26
+ * Runs a premium API call and normalizes errors into MCP tool results so the
27
+ * agent sees actionable text (invalid key, upgrade prompt, rate limit) rather
28
+ * than a thrown error.
29
+ */
30
+ export declare function premiumCall(run: () => Promise<unknown>): Promise<ToolResult>;
31
+ /**
32
+ * Accepts either a full theme.json document (with `$schema`/`config`) or a
33
+ * bare config object, validates via @shadsapp/schema, and returns the config
34
+ * payload the API expects.
35
+ */
36
+ export declare function parseThemeConfigDocument(source: string): {
37
+ ok: true;
38
+ config: Record<string, unknown>;
39
+ } | {
40
+ ok: false;
41
+ errors: string[];
42
+ };
43
+ //# sourceMappingURL=premium-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"premium-tools.d.ts","sourceRoot":"","sources":["../src/premium-tools.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,kBAAkB,mQACmO,CAAA;AAElQ;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAA;AACxC,eAAO,MAAM,sBAAsB,MAAM,CAAA;AAEzC,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,cAAc,EA6FpD,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,cAS/B,CAAA;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACzC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,UAAQ,GAAG,UAAU,CAKrE;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAC1B,OAAO,CAAC,UAAU,CAAC,CAUrB;AAMD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,GAEZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAC7C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAoBlC"}
@@ -0,0 +1,161 @@
1
+ import { extractJsonFromText, parseThemeDocumentInput, } from "@shadsapp/schema";
2
+ import { ShadsApiError, readApiKey } from "./api-client.js";
3
+ export const AUTH_SETUP_MESSAGE = "shads.app premium tools need a Pro API key. Create one at https://shads.app (Account settings > API keys), then add it to your MCP client config: env { \"SHADS_API_KEY\": \"shads_live_...\" } for the @shadsapp/mcp server. Docs: https://shads.app/docs/mcp";
4
+ /**
5
+ * Mirrors modules/config/src/ai/limits.ts. This package is published standalone
6
+ * and cannot depend on the private `@modules/*` workspace, so the bounds are
7
+ * repeated here rather than imported.
8
+ */
9
+ export const DESCRIPTION_MIN_LENGTH = 10;
10
+ export const DESCRIPTION_MAX_LENGTH = 400;
11
+ export const PREMIUM_TOOL_DEFINITIONS = [
12
+ {
13
+ name: "list_my_themes",
14
+ description: "List the signed-in user's saved cloud themes from shads.app (Pro)",
15
+ inputSchema: {
16
+ type: "object",
17
+ properties: {},
18
+ additionalProperties: false,
19
+ },
20
+ },
21
+ {
22
+ name: "get_my_theme",
23
+ description: "Fetch one saved theme as a theme.json document plus a single standalone theme.css (Pro)",
24
+ inputSchema: {
25
+ type: "object",
26
+ properties: {
27
+ id: {
28
+ type: "string",
29
+ description: "Saved theme id (from list_my_themes)",
30
+ },
31
+ },
32
+ required: ["id"],
33
+ additionalProperties: false,
34
+ },
35
+ },
36
+ {
37
+ name: "save_theme",
38
+ description: "Save a validated theme document to the user's shads.app account (Pro)",
39
+ inputSchema: {
40
+ type: "object",
41
+ properties: {
42
+ name: {
43
+ type: "string",
44
+ description: "Theme display name",
45
+ },
46
+ document: {
47
+ type: "string",
48
+ description: "theme.json text (with $schema shads-theme/v1) or raw config object as JSON",
49
+ },
50
+ },
51
+ required: ["name", "document"],
52
+ additionalProperties: false,
53
+ },
54
+ },
55
+ {
56
+ name: "update_theme",
57
+ description: "Update the name and/or config of a saved theme (Pro). Snapshots history on Pro accounts.",
58
+ inputSchema: {
59
+ type: "object",
60
+ properties: {
61
+ id: { type: "string", description: "Saved theme id" },
62
+ name: { type: "string", description: "New display name (optional)" },
63
+ document: {
64
+ type: "string",
65
+ description: "New theme.json text or raw config JSON (optional; omit to rename only)",
66
+ },
67
+ },
68
+ required: ["id"],
69
+ additionalProperties: false,
70
+ },
71
+ },
72
+ {
73
+ name: "generate_theme",
74
+ description: "Generate theme variations from a text description using shads.app hosted AI (Pro, counts against monthly AI quota)",
75
+ inputSchema: {
76
+ type: "object",
77
+ properties: {
78
+ description: {
79
+ type: "string",
80
+ description: `Visual brief, ${DESCRIPTION_MIN_LENGTH}-${DESCRIPTION_MAX_LENGTH} chars, e.g. 'calm journaling app, sage green, serif headings'`,
81
+ },
82
+ },
83
+ required: ["description"],
84
+ additionalProperties: false,
85
+ },
86
+ },
87
+ {
88
+ name: "check_subscription",
89
+ description: "Check the connected shads.app plan, MCP access, AI quota usage, and saved theme count",
90
+ inputSchema: {
91
+ type: "object",
92
+ properties: {},
93
+ additionalProperties: false,
94
+ },
95
+ },
96
+ ];
97
+ export const AUTHENTICATE_TOOL = {
98
+ name: "authenticate",
99
+ description: "Returns setup guidance for connecting a shads.app Pro API key to unlock saved-theme access and AI generation",
100
+ inputSchema: {
101
+ type: "object",
102
+ properties: {},
103
+ additionalProperties: false,
104
+ },
105
+ };
106
+ export function hasApiKeyConfigured() {
107
+ return readApiKey() !== null;
108
+ }
109
+ export function textResult(data, isError = false) {
110
+ return {
111
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
112
+ isError,
113
+ };
114
+ }
115
+ /**
116
+ * Runs a premium API call and normalizes errors into MCP tool results so the
117
+ * agent sees actionable text (invalid key, upgrade prompt, rate limit) rather
118
+ * than a thrown error.
119
+ */
120
+ export async function premiumCall(run) {
121
+ try {
122
+ return textResult(await run());
123
+ }
124
+ catch (cause) {
125
+ if (cause instanceof ShadsApiError) {
126
+ return textResult({ error: cause.message, status: cause.status }, true);
127
+ }
128
+ const message = cause instanceof Error ? cause.message : String(cause);
129
+ return textResult({ error: message }, true);
130
+ }
131
+ }
132
+ function extractJsonObject(source) {
133
+ return extractJsonFromText(source.trim());
134
+ }
135
+ /**
136
+ * Accepts either a full theme.json document (with `$schema`/`config`) or a
137
+ * bare config object, validates via @shadsapp/schema, and returns the config
138
+ * payload the API expects.
139
+ */
140
+ export function parseThemeConfigDocument(source) {
141
+ const result = parseThemeDocumentInput(source);
142
+ if (result.ok) {
143
+ return { ok: true, config: result.document.config };
144
+ }
145
+ // A bare config object (no $schema/config wrapper) fails document
146
+ // validation; retry treating the whole payload as config.
147
+ const jsonText = extractJsonObject(source);
148
+ if (jsonText) {
149
+ try {
150
+ const raw = JSON.parse(jsonText);
151
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
152
+ return { ok: true, config: raw };
153
+ }
154
+ }
155
+ catch {
156
+ // fall through to the original errors
157
+ }
158
+ }
159
+ return { ok: false, errors: result.errors };
160
+ }
161
+ //# sourceMappingURL=premium-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"premium-tools.js","sourceRoot":"","sources":["../src/premium-tools.ts"],"names":[],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Q,CAAY,CAAA;YAC3C,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAA8B,EAAE,CAAA;YAC7D,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,sCAAsC;QACxC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;AAC7C,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@shadsapp/mcp",
3
- "version": "0.1.4",
3
+ "version": "1.0.0",
4
4
  "description": "MCP server that lets AI agents list, fetch, and validate shads.app shadcn/ui themes",
5
+ "deprecated": "The @shadsapp/mcp package is deprecated. Please migrate to the remote HTTP MCP server at https://mcp.shads.app. Docs: https://shads.app/docs/mcp",
5
6
  "type": "module",
6
7
  "license": "MIT",
7
8
  "bin": {
@@ -22,11 +23,6 @@
22
23
  "typecheck": "tsc -p tsconfig.json --noEmit",
23
24
  "test": "vitest run"
24
25
  },
25
- "dependencies": {
26
- "@modelcontextprotocol/sdk": "^1.17.5",
27
- "@shadsapp/schema": "0.1.2",
28
- "@shadsapp/themes": "0.1.3"
29
- },
30
26
  "devDependencies": {
31
27
  "vitest": "^5.0.0"
32
28
  },