@primer/mcp 0.5.1 → 1.0.0-rc.abf5f0b80

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,7 +1,6 @@
1
- import { t as server } from "./server-Dv5XFnmA.js";
2
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
1
+ import { t as createServer } from "./server-MtARfEmu.js";
2
+ import { serveStdio } from "@modelcontextprotocol/server/stdio";
3
3
  //#region src/transports/stdio.ts
4
- const transport = new StdioServerTransport();
5
- await server.connect(transport);
4
+ serveStdio(createServer);
6
5
  //#endregion
7
6
  export {};
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.1",
4
+ "version": "1.0.0-rc.abf5f0b80",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "mcp": "./bin/mcp.js"
@@ -26,6 +26,9 @@
26
26
  "type": "git",
27
27
  "url": "git+https://github.com/primer/react.git"
28
28
  },
29
+ "engines": {
30
+ "node": ">=20"
31
+ },
29
32
  "scripts": {
30
33
  "clean": "rimraf dist",
31
34
  "build": "rolldown -c",
@@ -34,7 +37,8 @@
34
37
  "watch": "rolldown -c -w"
35
38
  },
36
39
  "dependencies": {
37
- "@modelcontextprotocol/sdk": "^1.29.0",
40
+ "@modelcontextprotocol/client": "^2.0.0",
41
+ "@modelcontextprotocol/server": "^2.0.0",
38
42
  "@primer/octicons": "^19.15.5",
39
43
  "@primer/primitives": "10.x || 11.x",
40
44
  "@primer/react": "^38.33.0",
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export {server} from './server'
1
+ export {createServer, server} from './server'
@@ -1,12 +1,29 @@
1
- import {Client} from '@modelcontextprotocol/sdk/client/index.js'
2
- import {InMemoryTransport} from '@modelcontextprotocol/sdk/inMemory.js'
1
+ import {Client, InMemoryTransport} from '@modelcontextprotocol/client'
3
2
  import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi} from 'vitest'
4
3
  import {server} from './server'
5
4
 
6
- describe('get_component_batch', () => {
7
- const client = new Client({name: 'mcp-server-test', version: '1.0.0'})
5
+ describe('MCP server', () => {
6
+ const client = new Client(
7
+ {name: 'mcp-server-test', version: '1.0.0'},
8
+ {
9
+ capabilities: {
10
+ sampling: {},
11
+ },
12
+ },
13
+ )
8
14
 
9
15
  beforeAll(async () => {
16
+ client.setRequestHandler('sampling/createMessage', async () => {
17
+ return {
18
+ model: 'test-model',
19
+ role: 'assistant',
20
+ content: {
21
+ type: 'text',
22
+ text: 'The alt text is descriptive and relevant.',
23
+ },
24
+ }
25
+ })
26
+
10
27
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair()
11
28
  await server.connect(serverTransport)
12
29
  await client.connect(clientTransport)
@@ -144,4 +161,20 @@ describe('get_component_batch', () => {
144
161
  })
145
162
  expect(vi.getTimerCount()).toBe(0)
146
163
  })
164
+
165
+ it('reviews alt text through the multi-round-trip sampling flow', async () => {
166
+ const result = await client.callTool({
167
+ name: 'review_alt_text',
168
+ arguments: {
169
+ surroundingText: 'A pull request description',
170
+ alt: 'Screenshot of a successful test run',
171
+ image: 'test-results.png',
172
+ },
173
+ })
174
+
175
+ expect(result.content).toContainEqual({
176
+ type: 'text',
177
+ text: 'The alt text is descriptive and relevant.',
178
+ })
179
+ })
147
180
  })