verify-mcp.ts•1.94 kB
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
async function main() {
const transport = new StdioClientTransport({
command: "node",
args: ["build/index.js"],
});
const client = new Client(
{
name: "test-client",
version: "1.0.0",
},
{
capabilities: {},
}
);
await client.connect(transport);
console.log("Connected to MCP server.");
// Test generate_hooks
console.log("\n--- Testing generate_hooks ---");
const hooksResult = await client.callTool({
name: "generate_hooks",
arguments: { topic: "AI Agents" },
});
console.log("Hooks Result:", JSON.parse((hooksResult.content as any)[0].text));
// Test format_thread
console.log("\n--- Testing format_thread ---");
const longText = "This is a very long sentence that should be split into multiple tweets because it is going to be part of a thread that we are formatting automatically. We want to make sure that the splitting logic works correctly and that the numbering is applied as expected. This is the second sentence which is also quite long to ensure we have enough content for at least two tweets in this test case.";
const threadResult = await client.callTool({
name: "format_thread",
arguments: { text: longText },
});
console.log("Thread Result:", JSON.parse((threadResult.content as any)[0].text));
// Test audit_copy
console.log("\n--- Testing audit_copy ---");
const copyResult = await client.callTool({
name: "audit_copy",
arguments: { copy: "Get this exclusive bonus for free today! It is a secret method." },
});
console.log("Audit Result:", JSON.parse((copyResult.content as any)[0].text));
await client.close();
}
main().catch(console.error);