Skip to content

Commit 9b75a99

Browse files
authored
Update MCP SDK (#789)
1 parent 5eec825 commit 9b75a99

4 files changed

Lines changed: 165 additions & 51 deletions

File tree

.changeset/update-mcp-sdk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openzeppelin/contracts-mcp': patch
3+
---
4+
5+
Update `@modelcontextprotocol/sdk` to ^1.29.0 to address security advisories.

packages/mcp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"test:watch": "ava --watch"
2424
},
2525
"dependencies": {
26-
"@modelcontextprotocol/sdk": "^1.11.1",
26+
"@modelcontextprotocol/sdk": "^1.29.0",
2727
"@openzeppelin/wizard-common": "^0.4.4",
2828
"@openzeppelin/wizard": "^0.10.7",
2929
"@openzeppelin/wizard-stylus": "^0.3.0",

packages/mcp/src/helpers.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import type { RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp';
1+
import type { RegisteredTool, ToolCallback } from '@modelcontextprotocol/sdk/server/mcp';
2+
import type { ZodRawShapeCompat } from '@modelcontextprotocol/sdk/server/zod-compat';
23
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol';
3-
import type { Implementation, ServerRequest, ServerNotification } from '@modelcontextprotocol/sdk/types';
4+
import type { Implementation, ServerRequest, ServerNotification, TextContent } from '@modelcontextprotocol/sdk/types';
45
import type { ExecutionContext } from 'ava';
56
import type { z } from 'zod';
67

@@ -16,7 +17,7 @@ const testMcpContext: RequestHandlerExtra<ServerRequest, ServerNotification> = {
1617
return;
1718
},
1819
sendRequest: async () => {
19-
return {};
20+
return {} as never;
2021
},
2122
};
2223

@@ -49,14 +50,15 @@ export async function assertAPIEquivalence<T>(
4950
wizardApiFunction: (params: T) => string,
5051
expectError?: boolean,
5152
) {
52-
const result = await t.context.tool.callback(
53+
const result = await (t.context.tool.handler as ToolCallback<ZodRawShapeCompat>)(
5354
{
5455
...params,
5556
...testMcpContext,
5657
},
5758
testMcpContext,
5859
);
59-
const mcpResult = result?.content[0]?.text as string;
60+
const firstContent = result?.content[0] as TextContent;
61+
const mcpResult = firstContent.text;
6062

6163
if (expectError) {
6264
const apiError = t.throws(() => wizardApiFunction(params));

0 commit comments

Comments
 (0)