@patine-ui/mcp 0.0.0-stage → 0.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eliyahu Kriel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,42 @@
1
- # Temporary Holding Version
1
+ # @patine-ui/mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An [MCP](https://modelcontextprotocol.io) server that gives coding agents the [Patine UI](https://github.com/patine-ui/patine)
4
+ docs: list the components, read a component's page, search them, and find icons by meaning. It reads `llms-full.txt` from the `patine-ui` installed in
5
+ your project, so answers match your version and work offline. Zero dependencies.
6
+
7
+ ## Add it
8
+
9
+ Claude Code:
10
+
11
+ ```sh
12
+ claude mcp add patine -- npx -y @patine-ui/mcp
13
+ ```
14
+
15
+ Cursor, Windsurf, VS Code and others (`mcp.json`):
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "patine": { "command": "npx", "args": ["-y", "@patine-ui/mcp"] }
21
+ }
22
+ }
23
+ ```
24
+
25
+ ## Tools
26
+
27
+ | Tool | Does |
28
+ |---|---|
29
+ | `list_components` | Every docs page with a one-line summary |
30
+ | `get_component_docs` | One page as Markdown, e.g. `{ "name": "DatePicker" }` |
31
+ | `search_docs` | The best pages for a query, with a snippet; then matching Patine Pro charts, blocks and app templates |
32
+ | `search_icons` | Icons in the free set ([`@patine-ui/icons`](../icons)) by name or meaning, e.g. `{ "query": "notification" }`; then matching Pro icons and brand logos |
33
+
34
+ Set `PATINE_DOCS=/path/to/llms-full.txt` to read another copy. Without `patine-ui` installed it fetches the docs site's copy.
35
+
36
+ Free results always come first. Anything only in [Patine Pro](https://patine.dev/pricing) comes after them under
37
+ "Patine Pro", each tagged `[Pro]` with a one-line description, its docs link and how to get it.
38
+
39
+ ## Maintainers
40
+
41
+ `src/pro.json`, the list of what only Pro has, is generated: run `pnpm --filter @patine-ui/mcp pro` on a machine with the
42
+ private repo after Pro's pages, icons or brand logos change. Don't edit it by hand.
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "@patine-ui/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "MCP server for Patine UI: lets Claude Code, Cursor, Windsurf and other coding agents list, read and search the patine-ui docs and find icons, matched to the version installed in your project. Zero dependencies.",
5
+ "license": "MIT",
6
+ "author": "Patine <support@patine.dev>",
7
+ "homepage": "https://patine.dev/docs/resources/mcp",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/patine-ui/patine.git",
11
+ "directory": "packages/mcp"
12
+ },
13
+ "keywords": [
14
+ "mcp",
15
+ "model context protocol",
16
+ "react native",
17
+ "patine",
18
+ "ai agents",
19
+ "claude code",
20
+ "cursor",
21
+ "windsurf",
22
+ "react-native-mcp",
23
+ "expo",
24
+ "icons"
25
+ ],
26
+ "bin": {
27
+ "patine-mcp": "src/index.js"
28
+ },
29
+ "main": "src/docs.js",
30
+ "scripts": {
31
+ "pro": "node scripts/pro.js"
32
+ },
33
+ "files": [
34
+ "src",
35
+ "!src/**/*.test.js",
36
+ "README.md",
37
+ "LICENSE"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "engines": {
43
+ "node": ">=18"
44
+ }
45
+ }
package/src/docs.js ADDED
@@ -0,0 +1,108 @@
1
+ // Pure helpers over llms-full.txt: split it into pages, find one by name, and search them. No I/O here, so it's testable.
2
+
3
+ /** Lines of context kept around a search hit. */
4
+ const SNIPPET_CHARS = 280;
5
+
6
+ /** A heading match counts this many times more than a match in the text. */
7
+ const HEADING_WEIGHT = 5;
8
+
9
+ /**
10
+ * llms-full.txt joins every docs page under its SEO title as a `## ` heading, followed by the page's own title, also `## `,
11
+ * with nothing between them. That empty section marks where a page starts; any other `## ` heading is part of the page.
12
+ */
13
+ const parsePages = (text) => {
14
+ const pages = [];
15
+ let pendingTitle = null;
16
+ let current = null;
17
+ let heading = null;
18
+ let lines = [];
19
+ const flush = () => {
20
+ if (heading === null) return;
21
+ const body = lines.join('\n').trim();
22
+ if (!body) pendingTitle = heading;
23
+ else if (current && pendingTitle === null) current.body += `\n\n## ${heading}\n\n${body}`;
24
+ else {
25
+ current = {
26
+ title: pendingTitle ?? heading,
27
+ name: heading,
28
+ body,
29
+ };
30
+ pages.push(current);
31
+ pendingTitle = null;
32
+ }
33
+ };
34
+ for (const line of text.split('\n')) {
35
+ if (line.startsWith('## ')) {
36
+ flush();
37
+ heading = line.slice(3).trim();
38
+ lines = [];
39
+ } else if (heading !== null) lines.push(line);
40
+ }
41
+ flush();
42
+ return pages;
43
+ };
44
+
45
+ const normalize = (s) =>
46
+ s
47
+ .toLowerCase()
48
+ .replace(/[^a-z0-9]+/g, ' ')
49
+ .trim();
50
+
51
+ /** The page for a component or topic: an exact name, then a name or title that contains it. */
52
+ const findPage = (pages, query) => {
53
+ const q = normalize(query);
54
+ if (!q) return null;
55
+ return (
56
+ pages.find((p) => normalize(p.name) === q) ??
57
+ pages.find((p) => normalize(p.title) === q || normalize(p.title) === `react native ${q}`) ??
58
+ pages.find((p) => normalize(p.name).includes(q) || normalize(p.title).includes(q)) ??
59
+ // A page without an SEO title of its own is folded into the one before it, under its `## ` heading.
60
+ pages.find((p) => p.body.split('\n').some((line) => line.startsWith('## ') && normalize(line.slice(3)) === q)) ??
61
+ null
62
+ );
63
+ };
64
+
65
+ /** Whole-word matches, so "min" finds "min" and not "minutes". */
66
+ const countOf = (haystack, word) => haystack.match(new RegExp(`\\b${word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`, 'g'))?.length ?? 0;
67
+
68
+ /** Pages ranked by how often the query's words appear, headings counting more, each with a snippet around the first hit. */
69
+ const searchPages = (pages, query, limit = 5) => {
70
+ const terms = normalize(query).split(' ').filter(Boolean);
71
+ if (terms.length === 0) return [];
72
+ const texts = pages.map((page) => ({
73
+ heading: normalize(`${page.title} ${page.name}`),
74
+ body: page.body.toLowerCase(),
75
+ }));
76
+ // Rare words count more than common ones (inverse document frequency), so "nights" outweighs "min".
77
+ const weight = Object.fromEntries(
78
+ terms.map((t) => [t, Math.log((pages.length + 1) / (1 + texts.filter((x) => countOf(x.body, t) > 0).length)) + 1])
79
+ );
80
+ return pages
81
+ .map((page, i) => {
82
+ const { heading, body } = texts[i];
83
+ const score = terms.reduce((sum, t) => sum + (countOf(heading, t) * HEADING_WEIGHT + countOf(body, t)) * weight[t], 0);
84
+ const hit = Math.max(0, body.search(new RegExp(`\\b${terms[0]}\\b`)));
85
+ return {
86
+ page,
87
+ score,
88
+ snippet: page.body.slice(Math.max(0, hit - SNIPPET_CHARS / 2), hit + SNIPPET_CHARS / 2).trim(),
89
+ };
90
+ })
91
+ .filter((r) => r.score > 0)
92
+ .sort((a, b) => b.score - a.score)
93
+ .slice(0, limit);
94
+ };
95
+
96
+ /** The first sentence of a page, for a one-line summary. */
97
+ const summarize = (page) => {
98
+ const prose = page.body.split('\n').find((line) => line.trim() && !line.startsWith('```') && !line.startsWith('#')) ?? '';
99
+ const end = prose.search(/[.!?](\s|$)/);
100
+ return end === -1 ? prose.trim() : prose.slice(0, end + 1).trim();
101
+ };
102
+
103
+ module.exports = {
104
+ findPage,
105
+ parsePages,
106
+ searchPages,
107
+ summarize,
108
+ };
package/src/icons.js ADDED
@@ -0,0 +1,39 @@
1
+ // Search over the free icon set (`@patine-ui/icons`). icons.json is written by packages/icons/scripts/icons.js, so the
2
+ // names here are the names that exist. Pure, so it's testable.
3
+ const ICONS = require('./icons.json');
4
+
5
+ const words = (s) =>
6
+ s
7
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
8
+ .toLowerCase()
9
+ .split(/[^a-z0-9]+/)
10
+ .filter(Boolean);
11
+
12
+ /** How well one icon matches the query's words: its name counts most, then its category, then its search tags. */
13
+ const score = (icon, terms) => {
14
+ const name = words(icon.name);
15
+ const tags = words(icon.tags);
16
+ return terms.reduce((sum, t) => {
17
+ if (name.includes(t)) return sum + 3;
18
+ if (name.some((w) => w.startsWith(t))) return sum + 2;
19
+ if (icon.category === t || tags.includes(t)) return sum + 1;
20
+ return sum;
21
+ }, 0);
22
+ };
23
+
24
+ /** The icons that best match a query such as "notification" or "arrow left", best first. */
25
+ const searchIcons = (query, limit = 20, icons = ICONS) => {
26
+ const terms = words(query);
27
+ if (terms.length === 0) return [];
28
+ return icons
29
+ .map((icon) => ({
30
+ icon,
31
+ score: score(icon, terms),
32
+ }))
33
+ .filter((r) => r.score > 0)
34
+ .sort((a, b) => b.score - a.score || a.icon.name.localeCompare(b.icon.name))
35
+ .slice(0, limit)
36
+ .map((r) => r.icon);
37
+ };
38
+
39
+ module.exports = { ICONS, searchIcons };
package/src/icons.json ADDED
@@ -0,0 +1,229 @@
1
+ [
2
+ { "name": "accessibility", "category": "accessibility", "tags": "a11y person universal access" },
3
+ { "name": "activity", "category": "charts", "tags": "pulse health monitor heartbeat" },
4
+ { "name": "alarm", "category": "time", "tags": "wake clock reminder" },
5
+ { "name": "alert", "category": "status", "tags": "warning caution triangle danger" },
6
+ { "name": "alertCircle", "category": "status", "tags": "error warning attention" },
7
+ { "name": "alertOctagon", "category": "status", "tags": "error stop danger critical" },
8
+ { "name": "archive", "category": "files", "tags": "box storage store" },
9
+ { "name": "arrowDown", "category": "navigation", "tags": "south bottom decrease" },
10
+ { "name": "arrowLeft", "category": "navigation", "tags": "back previous west" },
11
+ { "name": "arrowLeftRight", "category": "navigation", "tags": "swap exchange transfer" },
12
+ { "name": "arrowRight", "category": "navigation", "tags": "next forward east" },
13
+ { "name": "arrowUp", "category": "navigation", "tags": "north top increase" },
14
+ { "name": "arrowUpDown", "category": "navigation", "tags": "sort swap vertical" },
15
+ { "name": "arrowUpRight", "category": "navigation", "tags": "diagonal growth" },
16
+ { "name": "at", "category": "communication", "tags": "email mention handle" },
17
+ { "name": "award", "category": "social", "tags": "badge achievement medal prize" },
18
+ { "name": "bag", "category": "commerce", "tags": "shopping purchase store" },
19
+ { "name": "ban", "category": "status", "tags": "block forbidden prohibited" },
20
+ { "name": "banknote", "category": "commerce", "tags": "cash money bill payment" },
21
+ { "name": "barChart", "category": "charts", "tags": "analytics stats graph columns" },
22
+ { "name": "battery", "category": "devices", "tags": "charge power full" },
23
+ { "name": "bell", "category": "communication", "tags": "notification alert alarm reminder" },
24
+ { "name": "bellOff", "category": "communication", "tags": "mute notifications silent" },
25
+ { "name": "bellRing", "category": "communication", "tags": "notification alarm ringing alert" },
26
+ { "name": "bluetooth", "category": "devices", "tags": "wireless connect pair" },
27
+ { "name": "bold", "category": "text", "tags": "strong text format weight" },
28
+ { "name": "book", "category": "files", "tags": "read library guide" },
29
+ { "name": "bookOpen", "category": "files", "tags": "read docs reading" },
30
+ { "name": "bookmark", "category": "actions", "tags": "save favorite later" },
31
+ { "name": "briefcase", "category": "maps", "tags": "work job business portfolio" },
32
+ { "name": "building", "category": "maps", "tags": "office company business city" },
33
+ { "name": "calendar", "category": "time", "tags": "date schedule month event" },
34
+ { "name": "calendarCheck", "category": "time", "tags": "date booked confirmed" },
35
+ { "name": "calendarDays", "category": "time", "tags": "date schedule month" },
36
+ { "name": "calendarPlus", "category": "time", "tags": "add event date" },
37
+ { "name": "camera", "category": "media", "tags": "photo picture snapshot" },
38
+ { "name": "car", "category": "maps", "tags": "vehicle drive ride auto" },
39
+ { "name": "card", "category": "commerce", "tags": "credit debit payment" },
40
+ { "name": "cart", "category": "commerce", "tags": "shopping basket buy checkout" },
41
+ { "name": "check", "category": "actions", "tags": "done confirm tick yes" },
42
+ { "name": "checkCheck", "category": "actions", "tags": "read delivered double tick" },
43
+ { "name": "checkCircle", "category": "status", "tags": "success done complete verified" },
44
+ { "name": "checkSquare", "category": "status", "tags": "done complete checkbox task approved" },
45
+ { "name": "chevronDown", "category": "navigation", "tags": "expand caret dropdown" },
46
+ { "name": "chevronLeft", "category": "navigation", "tags": "back previous caret" },
47
+ { "name": "chevronRight", "category": "navigation", "tags": "next forward caret disclosure" },
48
+ { "name": "chevronUp", "category": "navigation", "tags": "collapse caret" },
49
+ { "name": "chevronsLeft", "category": "navigation", "tags": "first rewind" },
50
+ { "name": "chevronsRight", "category": "navigation", "tags": "last fast forward" },
51
+ { "name": "chevronsUpDown", "category": "navigation", "tags": "select sort expand" },
52
+ { "name": "clipboard", "category": "files", "tags": "paste board tasks" },
53
+ { "name": "clipboardCheck", "category": "files", "tags": "task done copied verified" },
54
+ { "name": "clock", "category": "time", "tags": "time hour watch" },
55
+ { "name": "cloud", "category": "weather", "tags": "cloudy storage" },
56
+ { "name": "cloudDownload", "category": "files", "tags": "sync download" },
57
+ { "name": "cloudUpload", "category": "files", "tags": "backup sync upload" },
58
+ { "name": "code", "category": "files", "tags": "developer brackets html" },
59
+ { "name": "coffee", "category": "health", "tags": "cup drink cafe break" },
60
+ { "name": "command", "category": "navigation", "tags": "keyboard shortcut cmd mac" },
61
+ { "name": "compass", "category": "maps", "tags": "explore direction north" },
62
+ { "name": "contact", "category": "users", "tags": "address book card person vcard" },
63
+ { "name": "copy", "category": "actions", "tags": "duplicate clone clipboard" },
64
+ { "name": "cornerDownLeft", "category": "navigation", "tags": "enter return key" },
65
+ { "name": "crop", "category": "actions", "tags": "trim cut image" },
66
+ { "name": "dashboard", "category": "navigation", "tags": "overview layout widgets" },
67
+ { "name": "database", "category": "files", "tags": "storage data server sql" },
68
+ { "name": "dollar", "category": "commerce", "tags": "money price currency usd" },
69
+ { "name": "download", "category": "actions", "tags": "save get import" },
70
+ { "name": "droplet", "category": "weather", "tags": "water drop liquid humidity" },
71
+ { "name": "edit", "category": "actions", "tags": "pencil write change compose" },
72
+ { "name": "external", "category": "navigation", "tags": "open new window link out" },
73
+ { "name": "eye", "category": "actions", "tags": "view show visible preview" },
74
+ { "name": "eyeOff", "category": "actions", "tags": "hide hidden invisible" },
75
+ { "name": "file", "category": "files", "tags": "document page blank" },
76
+ { "name": "fileImage", "category": "files", "tags": "picture photo document jpg png" },
77
+ { "name": "filePlus", "category": "files", "tags": "new document add" },
78
+ { "name": "fileText", "category": "files", "tags": "document page text notes" },
79
+ { "name": "files", "category": "files", "tags": "documents copies multiple" },
80
+ { "name": "film", "category": "media", "tags": "movie video cinema reel" },
81
+ { "name": "filter", "category": "actions", "tags": "funnel refine narrow" },
82
+ { "name": "fingerprint", "category": "security", "tags": "biometric touch id identity" },
83
+ { "name": "flag", "category": "actions", "tags": "report mark milestone" },
84
+ { "name": "flame", "category": "health", "tags": "fire hot calories trending streak" },
85
+ { "name": "folder", "category": "files", "tags": "directory collection" },
86
+ { "name": "folderOpen", "category": "files", "tags": "directory browse" },
87
+ { "name": "folderPlus", "category": "files", "tags": "new directory add" },
88
+ { "name": "forward", "category": "navigation", "tags": "share email send on" },
89
+ { "name": "gift", "category": "commerce", "tags": "present reward surprise" },
90
+ { "name": "globe", "category": "maps", "tags": "world earth international language web" },
91
+ { "name": "grid", "category": "navigation", "tags": "apps tiles gallery" },
92
+ { "name": "headphones", "category": "media", "tags": "audio music listen podcast" },
93
+ { "name": "heart", "category": "health", "tags": "love like favorite" },
94
+ { "name": "help", "category": "status", "tags": "question support faq" },
95
+ { "name": "history", "category": "time", "tags": "recent past log" },
96
+ { "name": "home", "category": "navigation", "tags": "house start main" },
97
+ { "name": "hourglass", "category": "time", "tags": "wait loading sand" },
98
+ { "name": "image", "category": "media", "tags": "photo picture gallery" },
99
+ { "name": "inbox", "category": "communication", "tags": "tray messages received" },
100
+ { "name": "info", "category": "status", "tags": "information about details help" },
101
+ { "name": "italic", "category": "text", "tags": "emphasis slant text format" },
102
+ { "name": "key", "category": "security", "tags": "password access credential" },
103
+ { "name": "laptop", "category": "devices", "tags": "computer notebook macbook" },
104
+ { "name": "layers", "category": "navigation", "tags": "stack levels depth" },
105
+ { "name": "layoutGrid3", "category": "layout", "tags": "grid nine apps gallery" },
106
+ { "name": "layoutList", "category": "layout", "tags": "list view rows thumbnails" },
107
+ { "name": "lightbulb", "category": "ai", "tags": "idea insight tip" },
108
+ { "name": "lineChart", "category": "charts", "tags": "analytics trend graph" },
109
+ { "name": "link", "category": "actions", "tags": "url chain hyperlink" },
110
+ { "name": "list", "category": "navigation", "tags": "bullets items rows" },
111
+ { "name": "listChecks", "category": "text", "tags": "checklist tasks todo done" },
112
+ { "name": "listOrdered", "category": "text", "tags": "numbered list steps" },
113
+ { "name": "loader", "category": "status", "tags": "loading spinner progress wait" },
114
+ { "name": "loaderCircle", "category": "status", "tags": "loading spinner progress busy wait" },
115
+ { "name": "lock", "category": "security", "tags": "secure private password" },
116
+ { "name": "logIn", "category": "navigation", "tags": "sign in enter" },
117
+ { "name": "logOut", "category": "navigation", "tags": "sign out exit leave" },
118
+ { "name": "mail", "category": "communication", "tags": "email envelope inbox letter" },
119
+ { "name": "mailOpen", "category": "communication", "tags": "email read envelope" },
120
+ { "name": "map", "category": "maps", "tags": "directions atlas route" },
121
+ { "name": "mapPin", "category": "maps", "tags": "location place marker address" },
122
+ { "name": "maximize", "category": "navigation", "tags": "fullscreen expand enlarge" },
123
+ { "name": "megaphone", "category": "communication", "tags": "announce broadcast marketing" },
124
+ { "name": "menu", "category": "navigation", "tags": "hamburger navigation drawer" },
125
+ { "name": "message", "category": "communication", "tags": "chat bubble comment talk" },
126
+ { "name": "messageSquare", "category": "communication", "tags": "chat bubble comment" },
127
+ { "name": "messages", "category": "communication", "tags": "conversation chats threads" },
128
+ { "name": "mic", "category": "communication", "tags": "microphone voice record audio" },
129
+ { "name": "micOff", "category": "communication", "tags": "mute microphone silence" },
130
+ { "name": "minimize", "category": "navigation", "tags": "exit fullscreen shrink" },
131
+ { "name": "minus", "category": "actions", "tags": "remove subtract" },
132
+ { "name": "minusCircle", "category": "actions", "tags": "remove subtract" },
133
+ { "name": "monitor", "category": "devices", "tags": "desktop screen display" },
134
+ { "name": "moon", "category": "weather", "tags": "dark night sleep" },
135
+ { "name": "more", "category": "actions", "tags": "ellipsis horizontal options overflow" },
136
+ { "name": "moreVertical", "category": "actions", "tags": "ellipsis vertical options kebab" },
137
+ { "name": "mousePointer", "category": "design", "tags": "cursor arrow select click" },
138
+ { "name": "move", "category": "design", "tags": "drag position arrows pan" },
139
+ { "name": "music", "category": "media", "tags": "note song audio" },
140
+ { "name": "navigation", "category": "maps", "tags": "location gps direction pointer" },
141
+ { "name": "package", "category": "commerce", "tags": "box delivery shipping parcel" },
142
+ { "name": "palette", "category": "actions", "tags": "colors theme paint design" },
143
+ { "name": "paperclip", "category": "actions", "tags": "attach attachment" },
144
+ { "name": "pause", "category": "media", "tags": "hold stop" },
145
+ { "name": "penTool", "category": "design", "tags": "vector bezier nib draw" },
146
+ { "name": "percent", "category": "commerce", "tags": "discount sale rate" },
147
+ { "name": "phone", "category": "communication", "tags": "call telephone contact" },
148
+ { "name": "phoneCall", "category": "communication", "tags": "calling ringing" },
149
+ { "name": "pin", "category": "actions", "tags": "pushpin stick keep" },
150
+ { "name": "plane", "category": "maps", "tags": "flight travel airport trip" },
151
+ { "name": "play", "category": "media", "tags": "start video audio" },
152
+ { "name": "playCircle", "category": "media", "tags": "video start" },
153
+ { "name": "plus", "category": "actions", "tags": "add new create" },
154
+ { "name": "plusCircle", "category": "actions", "tags": "add new create" },
155
+ { "name": "power", "category": "actions", "tags": "on off shutdown" },
156
+ { "name": "qrCode", "category": "commerce", "tags": "scan code link" },
157
+ { "name": "receipt", "category": "commerce", "tags": "bill purchase order" },
158
+ { "name": "redo", "category": "navigation", "tags": "forward repeat" },
159
+ { "name": "refresh", "category": "actions", "tags": "reload sync update" },
160
+ { "name": "refreshCcw", "category": "navigation", "tags": "reload sync counterclockwise" },
161
+ { "name": "repeat", "category": "media", "tags": "loop again cycle" },
162
+ { "name": "reply", "category": "navigation", "tags": "respond answer email" },
163
+ { "name": "rocket", "category": "social", "tags": "launch startup boost ship" },
164
+ { "name": "save", "category": "files", "tags": "floppy disk store keep" },
165
+ { "name": "scan", "category": "security", "tags": "qr camera capture frame" },
166
+ { "name": "scissors", "category": "actions", "tags": "cut clip trim" },
167
+ { "name": "search", "category": "actions", "tags": "find magnifier lookup" },
168
+ { "name": "send", "category": "communication", "tags": "paper plane submit message" },
169
+ { "name": "settings", "category": "actions", "tags": "gear cog preferences options" },
170
+ { "name": "share", "category": "actions", "tags": "export send ios" },
171
+ { "name": "shield", "category": "security", "tags": "protect safe security" },
172
+ { "name": "shieldCheck", "category": "security", "tags": "protected verified safe" },
173
+ { "name": "shuffle", "category": "media", "tags": "random mix" },
174
+ { "name": "sidebar", "category": "navigation", "tags": "panel layout drawer" },
175
+ { "name": "skipBack", "category": "media", "tags": "previous track" },
176
+ { "name": "skipForward", "category": "media", "tags": "next track" },
177
+ { "name": "sliders", "category": "actions", "tags": "adjust controls preferences settings" },
178
+ { "name": "smartphone", "category": "devices", "tags": "mobile phone iphone android" },
179
+ { "name": "smile", "category": "social", "tags": "emoji happy face reaction" },
180
+ { "name": "sort", "category": "actions", "tags": "order arrange descending" },
181
+ { "name": "sparkle", "category": "ai", "tags": "star magic ai shine" },
182
+ { "name": "sparkles", "category": "ai", "tags": "magic ai generate new" },
183
+ { "name": "star", "category": "social", "tags": "favorite rating bookmark" },
184
+ { "name": "starHalf", "category": "social", "tags": "rating review half" },
185
+ { "name": "stop", "category": "media", "tags": "end square" },
186
+ { "name": "store", "category": "commerce", "tags": "shop market storefront" },
187
+ { "name": "sun", "category": "weather", "tags": "light day bright" },
188
+ { "name": "table", "category": "layout", "tags": "spreadsheet grid data rows columns" },
189
+ { "name": "tablet", "category": "devices", "tags": "ipad device" },
190
+ { "name": "tag", "category": "commerce", "tags": "price label discount" },
191
+ { "name": "target", "category": "charts", "tags": "goal aim objective focus" },
192
+ { "name": "terminal", "category": "files", "tags": "console command line shell" },
193
+ { "name": "thumbsDown", "category": "social", "tags": "dislike reject downvote" },
194
+ { "name": "thumbsUp", "category": "social", "tags": "like approve upvote" },
195
+ { "name": "ticket", "category": "commerce", "tags": "event pass coupon admission" },
196
+ { "name": "timer", "category": "time", "tags": "stopwatch countdown duration" },
197
+ { "name": "trash", "category": "actions", "tags": "delete remove bin garbage" },
198
+ { "name": "trendingDown", "category": "charts", "tags": "decline decrease loss" },
199
+ { "name": "trendingUp", "category": "charts", "tags": "growth increase stocks" },
200
+ { "name": "trophy", "category": "social", "tags": "winner champion achievement" },
201
+ { "name": "truck", "category": "commerce", "tags": "delivery shipping transport" },
202
+ { "name": "type", "category": "text", "tags": "text font typography letter" },
203
+ { "name": "umbrella", "category": "weather", "tags": "rain protection insurance" },
204
+ { "name": "underline", "category": "text", "tags": "text format underscore" },
205
+ { "name": "undo", "category": "navigation", "tags": "back revert history" },
206
+ { "name": "unlink", "category": "actions", "tags": "broken chain detach" },
207
+ { "name": "unlock", "category": "security", "tags": "open unsecure" },
208
+ { "name": "upload", "category": "actions", "tags": "send import attach" },
209
+ { "name": "user", "category": "users", "tags": "person profile account" },
210
+ { "name": "userCheck", "category": "users", "tags": "verified person approved" },
211
+ { "name": "userCircle", "category": "users", "tags": "avatar profile account" },
212
+ { "name": "userMinus", "category": "users", "tags": "remove person" },
213
+ { "name": "userPlus", "category": "users", "tags": "add person invite" },
214
+ { "name": "userX", "category": "users", "tags": "remove block delete account" },
215
+ { "name": "users", "category": "users", "tags": "team group people members" },
216
+ { "name": "video", "category": "communication", "tags": "camera call meeting record" },
217
+ { "name": "videoOff", "category": "communication", "tags": "camera off" },
218
+ { "name": "volume", "category": "media", "tags": "sound speaker audio loud" },
219
+ { "name": "volumeOff", "category": "media", "tags": "mute silent speaker" },
220
+ { "name": "wallet", "category": "commerce", "tags": "money balance purse" },
221
+ { "name": "wand", "category": "ai", "tags": "magic generate auto" },
222
+ { "name": "wifi", "category": "devices", "tags": "wireless internet network signal" },
223
+ { "name": "wifiOff", "category": "devices", "tags": "offline disconnected no internet" },
224
+ { "name": "x", "category": "actions", "tags": "close cancel dismiss remove" },
225
+ { "name": "xCircle", "category": "status", "tags": "error failed cancel" },
226
+ { "name": "zap", "category": "status", "tags": "bolt lightning fast power energy" },
227
+ { "name": "zoomIn", "category": "actions", "tags": "magnify enlarge plus" },
228
+ { "name": "zoomOut", "category": "actions", "tags": "magnify shrink minus" }
229
+ ]
package/src/index.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ // Patine UI's MCP server over stdio. Reads the docs from the patine-ui installed in the current project (so they match its
3
+ // version), from PATINE_DOCS if set, or from the docs site as a last resort.
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+ const readline = require('node:readline');
7
+
8
+ const { parsePages } = require('./docs');
9
+ const { handle } = require('./server');
10
+
11
+ const DOCS_URL = 'https://patine.dev/llms-full.txt';
12
+ const { version } = require('../package.json');
13
+
14
+ const localDocs = () => {
15
+ if (process.env.PATINE_DOCS) return fs.readFileSync(process.env.PATINE_DOCS, 'utf8');
16
+ try {
17
+ const pkg = require.resolve('patine-ui/package.json', { paths: [process.cwd()] });
18
+ return fs.readFileSync(path.join(path.dirname(pkg), 'llms-full.txt'), 'utf8');
19
+ } catch {
20
+ return null;
21
+ }
22
+ };
23
+
24
+ const loadDocs = async () => {
25
+ const local = localDocs();
26
+ if (local) return local;
27
+ const response = await fetch(DOCS_URL);
28
+ if (!response.ok) throw new Error(`Couldn't load the Patine docs: ${response.status} from ${DOCS_URL}`);
29
+ return response.text();
30
+ };
31
+
32
+ const main = async () => {
33
+ const pages = parsePages(await loadDocs());
34
+ const input = readline.createInterface({ input: process.stdin });
35
+ input.on('line', (line) => {
36
+ if (!line.trim()) return;
37
+ let message;
38
+ try {
39
+ message = JSON.parse(line);
40
+ } catch {
41
+ process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } })}\n`);
42
+ return;
43
+ }
44
+ const response = handle(pages, version, message);
45
+ if (response) process.stdout.write(`${JSON.stringify(response)}\n`);
46
+ });
47
+ };
48
+
49
+ main().catch((error) => {
50
+ process.stderr.write(`${error.message}\n`);
51
+ process.exit(1);
52
+ });
package/src/pro.js ADDED
@@ -0,0 +1,34 @@
1
+ // What only Patine Pro has, for search to point at after the free results. pro.json is written by scripts/pro.js from the
2
+ // private repo, so nothing here imports Pro. Pure, so it's testable.
3
+ const { searchIcons } = require('./icons');
4
+ const PRO = require('./pro.json');
5
+
6
+ const PRICING = 'https://patine.dev/pricing';
7
+
8
+ /** How to get a Pro item, under every Pro result. */
9
+ const PRO_NOTE = `Pro items need a Patine Pro license: ${PRICING}. Then import them from '@patine-ui/pro'.`;
10
+
11
+ /** A docs search's Pro matches: charts, blocks, app templates and Pro components, with what they are and where to read more. */
12
+ const searchProPages = (query, limit = 3, exclude = []) =>
13
+ searchIcons(query, limit + exclude.length, PRO.pages)
14
+ .filter((page) => !exclude.includes(page.name))
15
+ .slice(0, limit)
16
+ .map((page) => `- [Pro ${page.category}] ${page.name}: ${page.description} Docs: ${page.url}`);
17
+
18
+ /** An icon search's Pro matches: icons beyond the free set, and brand logos. */
19
+ const searchProIcons = (query, limit = 10) => {
20
+ const icons = searchIcons(query, limit, PRO.icons).map(
21
+ (icon) => `- [Pro] ${icon.name} (${icon.category}): ${icon.tags}. <Icon name="${icon.name}" /> from '@patine-ui/pro'`
22
+ );
23
+ const brands = searchIcons(query, limit, PRO.brands).map(
24
+ (brand) => `- [Pro brand logo] ${brand.name} (${brand.category}). <BrandIcon name="${brand.name}" /> from '@patine-ui/pro'`
25
+ );
26
+ return [...brands, ...icons].slice(0, limit);
27
+ };
28
+
29
+ module.exports = {
30
+ PRO,
31
+ PRO_NOTE,
32
+ searchProIcons,
33
+ searchProPages,
34
+ };