// Test script for the get_cursor_integration tool
import fs from 'fs-extra';
import path from 'path';
// Sample parameters for testing
const params = {
packageName: '@your-username/test-mcp-server',
config: {
exampleConfig: 'test value'
}
};
// Function to generate Cursor integration code (same logic as in the tool)
function getCursorIntegration(params) {
const { packageName, config = {} } = params;
const configString = JSON.stringify(config).replace(/"/g, '\\"');
const cursorConfig = {
command: "npx",
args: [
"-y",
"@smithery/cli@latest",
"run",
packageName,
"--config",
`"${configString}"`
]
};
const mcpJson = {
mcpServers: {
[packageName.split('/').pop()]: cursorConfig
}
};
return {
mcpJson: JSON.stringify(mcpJson, null, 2),
commandLine: `npx -y @smithery/cli@latest run ${packageName} --config "${configString}"`,
instructions: "Add this to your ~/.cursor/mcp.json file to integrate with Cursor IDE"
};
}
// Execute the function and display results
const result = getCursorIntegration(params);
console.log('--- Cursor Integration Result ---');
console.log('\nmcpJson:');
console.log(result.mcpJson);
console.log('\nCommand Line:');
console.log(result.commandLine);
console.log('\nInstructions:');
console.log(result.instructions);