@primer/mcp 0.0.4 → 0.0.5

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 CHANGED
@@ -1,4 +1,4 @@
1
- export { s as server } from './server-DHzOLtG9.js';
1
+ export { s as server } from './server-Ccnupv1s.js';
2
2
  import '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import 'cheerio';
4
4
  import 'zod';
@@ -163,7 +163,7 @@ function serialize(value) {
163
163
  }).join('\n');
164
164
  }
165
165
 
166
- var version = "0.0.4-rc.0";
166
+ var version = "0.1.0-rc.1";
167
167
  var packageJson = {
168
168
  version: version};
169
169
 
@@ -234,7 +234,7 @@ You can use the \`get_component\` tool to get more information about a specific
234
234
  }]
235
235
  };
236
236
  });
237
- server.tool('get_component', 'Get a specific component by name', {
237
+ server.tool('get_component', 'Retrieve documentation and usage details for a specific React component from the @primer/react package by its name. This tool provides the official Primer documentation for any listed component, making it easy to inspect, reuse, or integrate components in your project.', {
238
238
  name: z.string().describe('The name of the component to retrieve')
239
239
  }, async ({
240
240
  name
@@ -247,7 +247,7 @@ server.tool('get_component', 'Get a specific component by name', {
247
247
  return {
248
248
  content: [{
249
249
  type: 'text',
250
- text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`get_components\` tool.`
250
+ text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`
251
251
  }]
252
252
  };
253
253
  }
@@ -376,7 +376,7 @@ ${text}`
376
376
  }]
377
377
  };
378
378
  });
379
- server.tool('get_component_accessibility_guidelines', 'Get accessibility information for how to use a component from Primer React', {
379
+ server.tool('get_component_accessibility_guidelines', 'Retrieve accessibility guidelines and best practices for a specific component from the @primer/react package by its name. Use this tool to get official accessibility recommendations, usage tips, and requirements to ensure your UI components are inclusive and meet accessibility standards.', {
380
380
  name: z.string().describe('The name of the component to retrieve')
381
381
  }, async ({
382
382
  name
@@ -389,7 +389,7 @@ server.tool('get_component_accessibility_guidelines', 'Get accessibility informa
389
389
  return {
390
390
  content: [{
391
391
  type: 'text',
392
- text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`get_components\` tool.`
392
+ text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`
393
393
  }]
394
394
  };
395
395
  }
@@ -668,4 +668,51 @@ The following list of coding guidelines must be followed:
668
668
  };
669
669
  });
670
670
 
671
+ // -----------------------------------------------------------------------------
672
+ // Accessibility
673
+ // -----------------------------------------------------------------------------
674
+
675
+ /**
676
+ * The `review_alt_text` tool is experimental and may be removed in future versions.
677
+ *
678
+ * The intent of this tool is to assist products like Copilot Code Review and Copilot Coding Agent
679
+ * in reviewing both user- and AI-generated alt text for images, ensuring compliance with accessibility guidelines.
680
+ * This tool is not intended to replace human-generated alt text; rather, it supports the review process
681
+ * by providing suggestions for improvement. It should be used alongside human review, not as a substitute.
682
+ *
683
+ *
684
+ **/
685
+ server.tool('review_alt_text', 'Evaluates image alt text against accessibility best practices and context relevance.', {
686
+ surroundingText: z.string().describe('Text surrounding the image, relevant to the image.'),
687
+ alt: z.string().describe('The alt text of the image being evaluated'),
688
+ image: z.union([z.instanceof(File).describe('The image src file being evaluated'), z.string().url().describe('The URL of the image src being evaluated'), z.string().describe('The file path of the image src being evaluated')]).describe('The image file, file path, or URL being evaluated')
689
+ }, async ({
690
+ surroundingText,
691
+ alt,
692
+ image
693
+ }) => {
694
+ // Call the LLM through MCP sampling
695
+ const response = await server.server.createMessage({
696
+ messages: [{
697
+ role: 'user',
698
+ content: {
699
+ type: 'text',
700
+ text: `Does this alt text: '${alt}' meet accessibility guidelines and describe the image: ${image} accurately in context of this surrounding text: '${surroundingText}'?\n\n`
701
+ }
702
+ }],
703
+ sampling: {
704
+ temperature: 0.4
705
+ },
706
+ maxTokens: 500
707
+ });
708
+ return {
709
+ content: [{
710
+ type: 'text',
711
+ text: response.content.type === 'text' ? response.content.text : 'Unable to generate summary'
712
+ }],
713
+ altTextEvaluation: response.content.type === 'text' ? response.content.text : 'Unable to generate summary',
714
+ nextSteps: `If the evaluation indicates issues with the alt text, provide more meaningful alt text based on the feedback. DO NOT run this tool repeatedly on the same image - evaluations may vary slightly with each run.`
715
+ };
716
+ });
717
+
671
718
  export { server as s };
@@ -163,7 +163,7 @@ function serialize(value) {
163
163
  }).join('\n');
164
164
  }
165
165
 
166
- var version = "0.0.4-rc.0";
166
+ var version = "0.0.5";
167
167
  var packageJson = {
168
168
  version: version};
169
169
 
@@ -234,7 +234,7 @@ You can use the \`get_component\` tool to get more information about a specific
234
234
  }]
235
235
  };
236
236
  });
237
- server.tool('get_component', 'Get a specific component by name', {
237
+ server.tool('get_component', 'Retrieve documentation and usage details for a specific React component from the @primer/react package by its name. This tool provides the official Primer documentation for any listed component, making it easy to inspect, reuse, or integrate components in your project.', {
238
238
  name: z.string().describe('The name of the component to retrieve')
239
239
  }, async ({
240
240
  name
@@ -247,7 +247,7 @@ server.tool('get_component', 'Get a specific component by name', {
247
247
  return {
248
248
  content: [{
249
249
  type: 'text',
250
- text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`get_components\` tool.`
250
+ text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`
251
251
  }]
252
252
  };
253
253
  }
@@ -376,7 +376,7 @@ ${text}`
376
376
  }]
377
377
  };
378
378
  });
379
- server.tool('get_component_accessibility_guidelines', 'Get accessibility information for how to use a component from Primer React', {
379
+ server.tool('get_component_accessibility_guidelines', 'Retrieve accessibility guidelines and best practices for a specific component from the @primer/react package by its name. Use this tool to get official accessibility recommendations, usage tips, and requirements to ensure your UI components are inclusive and meet accessibility standards.', {
380
380
  name: z.string().describe('The name of the component to retrieve')
381
381
  }, async ({
382
382
  name
@@ -389,7 +389,7 @@ server.tool('get_component_accessibility_guidelines', 'Get accessibility informa
389
389
  return {
390
390
  content: [{
391
391
  type: 'text',
392
- text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`get_components\` tool.`
392
+ text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`
393
393
  }]
394
394
  };
395
395
  }
package/dist/stdio.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
- import { s as server } from './server-DHzOLtG9.js';
2
+ import { s as server } from './server-Ccnupv1s.js';
3
3
  import '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import 'cheerio';
5
5
  import 'zod';
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.0.4",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "mcp": "./bin/mcp.js"
@@ -33,7 +33,7 @@
33
33
  "@modelcontextprotocol/sdk": "^1.12.0",
34
34
  "@primer/octicons": "^19.15.5",
35
35
  "@primer/primitives": "10.x || 11.x",
36
- "@primer/react": "^38.0.0-rc.0",
36
+ "@primer/react": "^38.0.0-rc.3",
37
37
  "cheerio": "^1.0.0",
38
38
  "turndown": "^7.2.0",
39
39
  "zod": "^3.23.8"
package/src/server.ts CHANGED
@@ -86,7 +86,7 @@ You can use the \`get_component\` tool to get more information about a specific
86
86
 
87
87
  server.tool(
88
88
  'get_component',
89
- 'Get a specific component by name',
89
+ 'Retrieve documentation and usage details for a specific React component from the @primer/react package by its name. This tool provides the official Primer documentation for any listed component, making it easy to inspect, reuse, or integrate components in your project.',
90
90
  {
91
91
  name: z.string().describe('The name of the component to retrieve'),
92
92
  },
@@ -100,7 +100,7 @@ server.tool(
100
100
  content: [
101
101
  {
102
102
  type: 'text',
103
- text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`get_components\` tool.`,
103
+ text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`,
104
104
  },
105
105
  ],
106
106
  }
@@ -270,7 +270,7 @@ ${text}`,
270
270
 
271
271
  server.tool(
272
272
  'get_component_accessibility_guidelines',
273
- 'Get accessibility information for how to use a component from Primer React',
273
+ 'Retrieve accessibility guidelines and best practices for a specific component from the @primer/react package by its name. Use this tool to get official accessibility recommendations, usage tips, and requirements to ensure your UI components are inclusive and meet accessibility standards.',
274
274
  {
275
275
  name: z.string().describe('The name of the component to retrieve'),
276
276
  },
@@ -284,7 +284,7 @@ server.tool(
284
284
  content: [
285
285
  {
286
286
  type: 'text',
287
- text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`get_components\` tool.`,
287
+ text: `There is no component named \`${name}\` in the @primer/react package. For a full list of components, use the \`list_components\` tool.`,
288
288
  },
289
289
  ],
290
290
  }