mcp-call.mjs 380 B

1234567891011121314
  1. const body = JSON.stringify({
  2. jsonrpc: '2.0',
  3. id: 1,
  4. method: process.argv[2] || 'tools/list',
  5. params: process.argv[3] ? JSON.parse(process.argv[3]) : {},
  6. });
  7. const res = await fetch('http://127.0.0.1:3000/mcp', {
  8. method: 'POST',
  9. headers: { 'Content-Type': 'application/json' },
  10. body,
  11. });
  12. const text = await res.text();
  13. console.log(res.status, text.slice(0, 4000));