Skip to main content
Glama

DotNet MCP Server Demo

by kasirajan22
test-bridge.jsโ€ข2.85 kB
#!/usr/bin/env node // Test script for the MCP bridge const { spawn } = require('child_process'); const path = require('path'); async function testMcpBridge() { console.log('๐Ÿงช Testing MCP Bridge...\n'); // Set environment variables process.env.MCP_SERVER_URL = 'http://localhost:5000'; process.env.MCP_USERNAME = 'admin'; process.env.MCP_PASSWORD = 'password123'; // Start the bridge const bridge = spawn('node', ['mcp-bridge.js'], { cwd: __dirname, stdio: ['pipe', 'pipe', 'pipe'] }); // Test messages const testMessages = [ { 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" }, { jsonrpc: "2.0", id: "3", method: "tools/call", params: { name: "echo", arguments: { message: "Hello from MCP bridge test!" } } } ]; let responseCount = 0; bridge.stdout.on('data', (data) => { const responses = data.toString().trim().split('\n'); responses.forEach(response => { if (response.trim()) { try { const parsed = JSON.parse(response); console.log(`๐Ÿ“จ Response ${++responseCount}:`); console.log(JSON.stringify(parsed, null, 2)); console.log(''); } catch (e) { console.log(`๐Ÿ“จ Raw response: ${response}`); } } }); // End test after all responses if (responseCount >= testMessages.length) { bridge.kill(); } }); bridge.stderr.on('data', (data) => { console.error(`โŒ Bridge error: ${data}`); }); bridge.on('close', (code) => { console.log(`๐Ÿ Bridge test completed with code ${code}`); }); // Send test messages with delay for (let i = 0; i < testMessages.length; i++) { setTimeout(() => { const message = JSON.stringify(testMessages[i]) + '\n'; console.log(`๐Ÿ“ค Sending message ${i + 1}: ${testMessages[i].method}`); bridge.stdin.write(message); }, i * 1000); } // Timeout after 10 seconds setTimeout(() => { console.log('โฐ Test timeout - killing bridge'); bridge.kill(); }, 10000); } if (require.main === module) { testMcpBridge().catch(console.error); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kasirajan22/DotnetMCPServer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server