Skip to content

Commit 99414d2

Browse files
authored
Export Confidential Contracts tools in MCP package (#776)
1 parent d653f94 commit 99414d2

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.changeset/great-months-double.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+
Export Confidential Contracts tools

packages/mcp/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export { registerSolidityTools } from './solidity/tools';
22
export { registerCairoTools } from './cairo/tools';
3+
export { registerConfidentialTools } from './confidential/tools';
34
export { registerStellarTools } from './stellar/tools';
45
export { registerStylusTools } from './stylus/tools';
56
export { registerUniswapHooksTools } from './uniswap-hooks/tools';

packages/mcp/src/server.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import { readFile } from 'fs/promises';
66
const PACKAGES_CORE_PATH = join(__dirname, '../../core');
77
const PACKAGES_MCP_SRC_PATH = join(__dirname);
88
const SERVER_TS_PATH = join(__dirname, 'server.ts');
9+
const INDEX_TS_PATH = join(__dirname, 'index.ts');
10+
11+
function toPascalCase(value: string) {
12+
return value
13+
.split('-')
14+
.map(part => part.charAt(0).toUpperCase() + part.slice(1))
15+
.join('');
16+
}
917

1018
// Languages that do not need MCP tools
1119
const MCP_EXCLUDED_LANGUAGES: string[] = ['cairo_alpha'];
@@ -31,6 +39,25 @@ test('each core language has mcp tools folder', async t => {
3139
}
3240
});
3341

42+
test('each mcp tools folder is exported from index.ts', async t => {
43+
// Get all directories in packages/mcp/src
44+
const mcpEntries = await readdir(PACKAGES_MCP_SRC_PATH, { withFileTypes: true });
45+
const mcpDirs = mcpEntries.filter(entry => entry.isDirectory()).map(entry => entry.name);
46+
47+
// Read index.ts content
48+
const indexContent = await readFile(INDEX_TS_PATH, 'utf-8');
49+
50+
// For each directory, check if its register function is exported from index.ts
51+
for (const mcpDir of mcpDirs) {
52+
const expectedExport = `register${toPascalCase(mcpDir)}Tools`;
53+
54+
t.true(
55+
indexContent.includes(expectedExport),
56+
`Expected '${expectedExport}' not found in index.ts for language '${mcpDir}'`,
57+
);
58+
}
59+
});
60+
3461
test('each mcp tools folder is registered in server.ts', async t => {
3562
// Get all directories in packages/mcp/src
3663
const mcpEntries = await readdir(PACKAGES_MCP_SRC_PATH, { withFileTypes: true });

0 commit comments

Comments
 (0)