@primer/mcp 0.3.3 → 0.3.4

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/stdio.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
- import { s as server } from './server-C2QaEv-c.js';
2
+ import { s as server } from './server-CaSuVJt0.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.3.3",
4
+ "version": "0.3.4",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "mcp": "./bin/mcp.js"
package/src/server.ts CHANGED
@@ -39,6 +39,7 @@ server.registerTool(
39
39
  'init',
40
40
  {
41
41
  description: 'Setup or create a project that includes Primer React',
42
+ annotations: {readOnlyHint: true},
42
43
  },
43
44
  async () => {
44
45
  const url = new URL(`/product/getting-started/react`, 'https://primer.style')
@@ -92,7 +93,7 @@ ${text}
92
93
  // -----------------------------------------------------------------------------
93
94
  server.registerTool(
94
95
  'list_components',
95
- {description: 'List all of the components available from Primer React'},
96
+ {description: 'List all of the components available from Primer React', annotations: {readOnlyHint: true}},
96
97
  async () => {
97
98
  const components = listComponents().map(component => {
98
99
  return `- ${component.name}`
@@ -120,6 +121,7 @@ server.registerTool(
120
121
  inputSchema: {
121
122
  name: z.string().describe('The name of the component to retrieve'),
122
123
  },
124
+ annotations: {readOnlyHint: true},
123
125
  },
124
126
  async ({name}) => {
125
127
  const components = listComponents()
@@ -166,6 +168,7 @@ server.registerTool(
166
168
  inputSchema: {
167
169
  name: z.string().describe('The name of the component to retrieve'),
168
170
  },
171
+ annotations: {readOnlyHint: true},
169
172
  },
170
173
  async ({name}) => {
171
174
  const components = listComponents()
@@ -226,6 +229,7 @@ server.registerTool(
226
229
  inputSchema: {
227
230
  name: z.string().describe('The name of the component to retrieve'),
228
231
  },
232
+ annotations: {readOnlyHint: true},
229
233
  },
230
234
  async ({name}) => {
231
235
  const components = listComponents()
@@ -298,6 +302,7 @@ server.registerTool(
298
302
  inputSchema: {
299
303
  name: z.string().describe('The name of the component to retrieve'),
300
304
  },
305
+ annotations: {readOnlyHint: true},
301
306
  },
302
307
  async ({name}) => {
303
308
  const components = listComponents()
@@ -367,7 +372,7 @@ ${text}`,
367
372
  // -----------------------------------------------------------------------------
368
373
  server.registerTool(
369
374
  'list_patterns',
370
- {description: 'List all of the patterns available from Primer React'},
375
+ {description: 'List all of the patterns available from Primer React', annotations: {readOnlyHint: true}},
371
376
  async () => {
372
377
  const patterns = listPatterns().map(pattern => {
373
378
  return `- ${pattern.name}`
@@ -392,6 +397,7 @@ server.registerTool(
392
397
  inputSchema: {
393
398
  name: z.string().describe('The name of the pattern to retrieve'),
394
399
  },
400
+ annotations: {readOnlyHint: true},
395
401
  },
396
402
  async ({name}) => {
397
403
  const patterns = listPatterns()
@@ -469,6 +475,7 @@ server.registerTool(
469
475
  .default(15)
470
476
  .describe('Maximum results to return to stay within context limits'),
471
477
  },
478
+ annotations: {readOnlyHint: true},
472
479
  },
473
480
  async ({query, group, limit}) => {
474
481
  // Resolve group via aliases
@@ -566,6 +573,7 @@ server.registerTool(
566
573
  inputSchema: {
567
574
  groups: z.array(z.string()).describe('Array of group names (e.g., ["overlay", "shadow", "focus"])'),
568
575
  },
576
+ annotations: {readOnlyHint: true},
569
577
  },
570
578
  async ({groups}) => {
571
579
  // Normalize and resolve aliases
@@ -608,6 +616,7 @@ server.registerTool(
608
616
  {
609
617
  description:
610
618
  'CRITICAL: CALL THIS FIRST. Provides the logic matrix and the list of valid group names. You cannot search accurately without this map.',
619
+ annotations: {readOnlyHint: true},
611
620
  },
612
621
  async () => {
613
622
  const groups = listTokenGroups()
@@ -631,6 +640,7 @@ server.registerTool(
631
640
  {
632
641
  description:
633
642
  'Provides "Golden Example" CSS for core patterns: Button (Interactions) and Stack (Layout). Use this to understand how to apply the Logic Matrix, Motion, and Spacing scales.',
643
+ annotations: {readOnlyHint: true},
634
644
  },
635
645
  async () => {
636
646
  const customPatterns = getTokenUsagePatternsText()
@@ -659,6 +669,7 @@ server.registerTool(
659
669
  description:
660
670
  'REQUIRED FINAL STEP. Use this to validate your CSS. You cannot complete a task involving CSS without a successful run of this tool.',
661
671
  inputSchema: {css: z.string()},
672
+ annotations: {readOnlyHint: true},
662
673
  },
663
674
  async ({css}) => {
664
675
  try {
@@ -694,7 +705,7 @@ server.registerTool(
694
705
  // -----------------------------------------------------------------------------
695
706
  server.registerTool(
696
707
  'get_color_usage',
697
- {description: 'Get the guidelines for how to apply color to a user interface'},
708
+ {description: 'Get the guidelines for how to apply color to a user interface', annotations: {readOnlyHint: true}},
698
709
  async () => {
699
710
  const url = new URL(`/product/getting-started/foundations/color-usage`, 'https://primer.style')
700
711
  const response = await fetch(url)
@@ -732,7 +743,10 @@ server.registerTool(
732
743
 
733
744
  server.registerTool(
734
745
  'get_typography_usage',
735
- {description: 'Get the guidelines for how to apply typography to a user interface'},
746
+ {
747
+ description: 'Get the guidelines for how to apply typography to a user interface',
748
+ annotations: {readOnlyHint: true},
749
+ },
736
750
  async () => {
737
751
  const url = new URL(`/product/getting-started/foundations/typography`, 'https://primer.style')
738
752
  const response = await fetch(url)
@@ -773,7 +787,10 @@ server.registerTool(
773
787
  // -----------------------------------------------------------------------------
774
788
  server.registerTool(
775
789
  'list_icons',
776
- {description: 'List all of the icons (octicons) available from Primer Octicons React'},
790
+ {
791
+ description: 'List all of the icons (octicons) available from Primer Octicons React',
792
+ annotations: {readOnlyHint: true},
793
+ },
777
794
  async () => {
778
795
  const icons = listIcons().map(icon => {
779
796
  const keywords = icon.keywords.map(keyword => {
@@ -808,6 +825,7 @@ server.registerTool(
808
825
  name: z.string().describe('The name of the icon to retrieve'),
809
826
  size: z.string().optional().describe('The size of the icon to retrieve, e.g. "16"').default('16'),
810
827
  },
828
+ annotations: {readOnlyHint: true},
811
829
  },
812
830
  async ({name, size}) => {
813
831
  const icons = listIcons()
@@ -865,7 +883,10 @@ ${text}`,
865
883
  // -----------------------------------------------------------------------------
866
884
  server.registerTool(
867
885
  'primer_coding_guidelines',
868
- {description: 'Get the guidelines when writing code that uses Primer or for UI code that you are creating'},
886
+ {
887
+ description: 'Get the guidelines when writing code that uses Primer or for UI code that you are creating',
888
+ annotations: {readOnlyHint: true},
889
+ },
869
890
  async () => {
870
891
  return {
871
892
  content: [
@@ -922,6 +943,7 @@ server.registerTool(
922
943
  alt: z.string().describe('The alt text of the image being evaluated'),
923
944
  image: z.string().describe('The image URL or file path being evaluated'),
924
945
  },
946
+ annotations: {readOnlyHint: true},
925
947
  },
926
948
  async ({surroundingText, alt, image}) => {
927
949
  // Call the LLM through MCP sampling