We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/asoluka/antigravity-pdf-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
import { spawn } from "child_process";
import path from "path";
import fs from "fs";
const serverPath = path.join(__dirname, "dist", "src", "server.js");
const serverProcess = spawn("node", [serverPath], {
stdio: ["pipe", "pipe", "inherit"]
});
const testMdPath = path.join(__dirname, "test_doc.md");
fs.writeFileSync(testMdPath, "# Test Document\n\nThis is a test paragraph.\n\nIt has multiple lines.\nAnd some structure.");
const requests = [
{
jsonrpc: "2.0",
id: 1,
method: "initialize",
params: {
protocolVersion: "2024-11-05",
capabilities: {},
clientInfo: { name: "test-client", version: "1.0.0" }
}
},
{
jsonrpc: "2.0",
id: 2,
method: "tools/list",
params: {}
},
{
jsonrpc: "2.0",
id: 3,
method: "tools/call",
params: {
name: "ingest_document",
arguments: {
path: testMdPath
}
}
},
{
jsonrpc: "2.0",
id: 4,
method: "tools/call",
params: {
name: "query_knowledge_base",
arguments: {
query: "test paragraph"
}
}
}
];
let buffer = "";
let currentReqIndex = 0;
function sendNextRequest() {
if (currentReqIndex >= requests.length) return;
const req = requests[currentReqIndex];
const msg = JSON.stringify(req) + "\n";
serverProcess.stdin.write(msg);
}
serverProcess.stdout.on("data", (data) => {
buffer += data.toString();
const lines = buffer.split("\n");
buffer = lines.pop() || "";
for (const line of lines) {
if (!line.trim()) continue;
try {
const response = JSON.parse(line);
console.log("Received response:", JSON.stringify(response, null, 2));
// Move to next request
currentReqIndex++;
if (currentReqIndex < requests.length) {
sendNextRequest();
} else {
console.log("Verification complete.");
serverProcess.kill();
if (fs.existsSync(testMdPath)) fs.unlinkSync(testMdPath);
process.exit(0);
}
} catch (e) {
console.error("Error parsing JSON:", e);
}
}
});
// Start with first request
sendNextRequest();
setTimeout(() => {
console.error("Timeout waiting for response");
serverProcess.kill();
if (fs.existsSync(testMdPath)) fs.unlinkSync(testMdPath);
process.exit(1);
}, 10000);