@primer/mcp 0.5.0 → 0.5.1-rc.9cb467491
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/dist/index.js +1 -1
- package/dist/{server-rl4CHqO6.js → server-Dv5XFnmA.js} +5 -5
- package/dist/stdio.js +1 -1
- package/package.json +2 -2
- package/src/server.test.ts +22 -0
- package/src/server.ts +4 -6
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as server } from "./server-
|
|
1
|
+
import { t as server } from "./server-Dv5XFnmA.js";
|
|
2
2
|
export { server };
|
|
@@ -692,7 +692,7 @@ function runStylelint(css) {
|
|
|
692
692
|
//#region src/server.ts
|
|
693
693
|
const server = new McpServer({
|
|
694
694
|
name: "Primer",
|
|
695
|
-
version: "0.5.
|
|
695
|
+
version: "0.5.1"
|
|
696
696
|
});
|
|
697
697
|
const turndownService = new TurndownService();
|
|
698
698
|
const allTokensWithGuidelines = loadAllTokensWithGuidelines();
|
|
@@ -736,11 +736,11 @@ ${listComponents().map((component) => {
|
|
|
736
736
|
return `- ${component.name}`;
|
|
737
737
|
}).join("\n")}
|
|
738
738
|
|
|
739
|
-
|
|
739
|
+
Use \`get_component\` for exactly one component and \`get_component_batch\` for 2 to 10 components. You can use these components from the @primer/react package.`
|
|
740
740
|
}] };
|
|
741
741
|
});
|
|
742
742
|
server.registerTool("get_component", {
|
|
743
|
-
description: "Retrieve documentation and usage details for
|
|
743
|
+
description: "Retrieve official documentation and usage details for exactly one React component from the @primer/react package. Use get_component_batch for 2 to 10 components.",
|
|
744
744
|
inputSchema: { name: z.string().describe("The name of the component to retrieve") },
|
|
745
745
|
annotations: { readOnlyHint: true }
|
|
746
746
|
}, async ({ name }) => {
|
|
@@ -767,7 +767,7 @@ server.registerTool("get_component", {
|
|
|
767
767
|
};
|
|
768
768
|
});
|
|
769
769
|
server.registerTool("get_component_batch", {
|
|
770
|
-
description: "Retrieve documentation
|
|
770
|
+
description: "Retrieve official documentation and usage details for 2 to 10 React components from the @primer/react package in one call. Use get_component for exactly one component.",
|
|
771
771
|
inputSchema: { names: z.array(z.string()).min(2).max(10).describe("Component names to retrieve (e.g. [\"ActionMenu\", \"Button\", \"Pagination\"])") },
|
|
772
772
|
annotations: { readOnlyHint: true }
|
|
773
773
|
}, async ({ names }) => {
|
|
@@ -1211,7 +1211,7 @@ server.registerTool("review_alt_text", {
|
|
|
1211
1211
|
text: `Does this alt text: '${alt}' meet accessibility guidelines and describe the image: ${image} accurately in context of this surrounding text: '${surroundingText}'?\n\n`
|
|
1212
1212
|
}
|
|
1213
1213
|
}],
|
|
1214
|
-
|
|
1214
|
+
temperature: .4,
|
|
1215
1215
|
maxTokens: 500
|
|
1216
1216
|
});
|
|
1217
1217
|
return {
|
package/dist/stdio.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as server } from "./server-
|
|
1
|
+
import { t as server } from "./server-Dv5XFnmA.js";
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
//#region src/transports/stdio.ts
|
|
4
4
|
const transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/mcp",
|
|
3
3
|
"description": "An MCP server that connects AI tools to the Primer Design System",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1-rc.9cb467491",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mcp": "./bin/mcp.js"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"watch": "rolldown -c -w"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
37
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
38
38
|
"@primer/octicons": "^19.15.5",
|
|
39
39
|
"@primer/primitives": "10.x || 11.x",
|
|
40
40
|
"@primer/react": "^38.33.0",
|
package/src/server.test.ts
CHANGED
|
@@ -33,6 +33,28 @@ describe('get_component_batch', () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
it('documents which component tool to use for each supported count', async () => {
|
|
37
|
+
const {tools} = await client.listTools()
|
|
38
|
+
const getComponent = tools.find(tool => tool.name === 'get_component')
|
|
39
|
+
const getComponentBatch = tools.find(tool => tool.name === 'get_component_batch')
|
|
40
|
+
const listResult = await client.callTool({name: 'list_components'})
|
|
41
|
+
|
|
42
|
+
expect(getComponent?.description).toBe(
|
|
43
|
+
'Retrieve official documentation and usage details for exactly one React component from the @primer/react package. Use get_component_batch for 2 to 10 components.',
|
|
44
|
+
)
|
|
45
|
+
expect(getComponentBatch?.description).toBe(
|
|
46
|
+
'Retrieve official documentation and usage details for 2 to 10 React components from the @primer/react package in one call. Use get_component for exactly one component.',
|
|
47
|
+
)
|
|
48
|
+
expect(listResult.content).toContainEqual(
|
|
49
|
+
expect.objectContaining({
|
|
50
|
+
type: 'text',
|
|
51
|
+
text: expect.stringContaining(
|
|
52
|
+
'Use `get_component` for exactly one component and `get_component_batch` for 2 to 10 components.',
|
|
53
|
+
),
|
|
54
|
+
}),
|
|
55
|
+
)
|
|
56
|
+
})
|
|
57
|
+
|
|
36
58
|
it('requires between 2 and 10 names', async () => {
|
|
37
59
|
const tooFew = await callBatch(['Button'])
|
|
38
60
|
const tooMany = await callBatch(Array.from({length: 11}, (_, index) => `Component${index}`))
|
package/src/server.ts
CHANGED
|
@@ -106,7 +106,7 @@ server.registerTool(
|
|
|
106
106
|
|
|
107
107
|
${components.join('\n')}
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Use \`get_component\` for exactly one component and \`get_component_batch\` for 2 to 10 components. You can use these components from the @primer/react package.`,
|
|
110
110
|
},
|
|
111
111
|
],
|
|
112
112
|
}
|
|
@@ -117,7 +117,7 @@ server.registerTool(
|
|
|
117
117
|
'get_component',
|
|
118
118
|
{
|
|
119
119
|
description:
|
|
120
|
-
'Retrieve documentation and usage details for
|
|
120
|
+
'Retrieve official documentation and usage details for exactly one React component from the @primer/react package. Use get_component_batch for 2 to 10 components.',
|
|
121
121
|
inputSchema: {
|
|
122
122
|
name: z.string().describe('The name of the component to retrieve'),
|
|
123
123
|
},
|
|
@@ -165,9 +165,7 @@ server.registerTool(
|
|
|
165
165
|
'get_component_batch',
|
|
166
166
|
{
|
|
167
167
|
description:
|
|
168
|
-
'Retrieve documentation for
|
|
169
|
-
'Pass all component names you need at once. Docs are fetched in parallel to avoid repeated MCP round-trips when resolving several components. ' +
|
|
170
|
-
'For a single component, prefer get_component instead.',
|
|
168
|
+
'Retrieve official documentation and usage details for 2 to 10 React components from the @primer/react package in one call. Use get_component for exactly one component.',
|
|
171
169
|
inputSchema: {
|
|
172
170
|
names: z
|
|
173
171
|
.array(z.string())
|
|
@@ -1037,7 +1035,7 @@ server.registerTool(
|
|
|
1037
1035
|
},
|
|
1038
1036
|
},
|
|
1039
1037
|
],
|
|
1040
|
-
|
|
1038
|
+
temperature: 0.4,
|
|
1041
1039
|
maxTokens: 500,
|
|
1042
1040
|
})
|
|
1043
1041
|
|