systemprompt-mcp-interview
Version:
A specialized Model Context Protocol (MCP) server that enables AI-powered interview roleplay scenarios
30 lines • 946 B
JavaScript
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
export class DedupingTransport {
sent = new Set();
transport;
constructor() {
this.transport = new StdioServerTransport();
}
async write(data) {
// Use request ID as deduping key
try {
const parsed = JSON.parse(data);
const key = `${parsed.id}`;
if (this.sent.has(key)) {
return; // Skip duplicate response
}
this.sent.add(key);
// Clean up old entries periodically
setTimeout(() => this.sent.delete(key), 5000);
await this.transport.write(data);
}
catch (e) {
// If we can't parse the JSON, just send it
await this.transport.write(data);
}
}
onMessage(handler) {
this.transport.onMessage(handler);
}
}
//# sourceMappingURL=transport.js.map