Skip to main content
Glama
nieperdragon

MCP Login Server

by nieperdragon

test_connection

Verifies accessibility of the target URL (http://localhost) to ensure proper connectivity for localhost web applications in the MCP Login Server environment.

Instructions

Tests if the target URL (http://localhost) is accessible

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline async handler function that implements the core logic of the test_connection tool. It attempts a HEAD fetch to http://localhost with 5s timeout and returns a markdown-formatted response with connection status.
    async () => { try { // Basic connectivity test const response = await fetch(LOGIN_CREDENTIALS.targetUrl, { method: 'HEAD', signal: AbortSignal.timeout(5000) }); return { content: [ { type: "text", text: `Connection Test Results: 🎯 Target URL: ${LOGIN_CREDENTIALS.targetUrl} ✅ Status: ${response.status} ${response.statusText} 🔗 Accessible: Yes ⏱️ Response Time: Available 💡 The target URL is accessible and ready for login operations.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Connection Test Results: 🎯 Target URL: ${LOGIN_CREDENTIALS.targetUrl} ❌ Status: Connection Failed 🔗 Accessible: No ⚠️ Error: ${error instanceof Error ? error.message : String(error)} 💡 Please ensure the target server is running on localhost.` } ] }; } }
  • src/tools.ts:124-171 (registration)
    Registers the test_connection tool with the MCP server, providing the tool name, description, empty input schema {}, and the inline handler function.
    export function registerTestConnectionTool(server: McpServer): void { server.tool( "test_connection", "Tests if the target URL (http://localhost) is accessible", {}, async () => { try { // Basic connectivity test const response = await fetch(LOGIN_CREDENTIALS.targetUrl, { method: 'HEAD', signal: AbortSignal.timeout(5000) }); return { content: [ { type: "text", text: `Connection Test Results: 🎯 Target URL: ${LOGIN_CREDENTIALS.targetUrl} ✅ Status: ${response.status} ${response.statusText} 🔗 Accessible: Yes ⏱️ Response Time: Available 💡 The target URL is accessible and ready for login operations.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Connection Test Results: 🎯 Target URL: ${LOGIN_CREDENTIALS.targetUrl} ❌ Status: Connection Failed 🔗 Accessible: No ⚠️ Error: ${error instanceof Error ? error.message : String(error)} 💡 Please ensure the target server is running on localhost.` } ] }; } } ); }
  • src/tools.ts:244-244 (registration)
    Within registerAllTools, calls registerTestConnectionTool to include test_connection in the full toolset registration.
    registerTestConnectionTool(server);
  • Configuration constant providing the targetUrl used by the test_connection handler for the fetch request.
    export const LOGIN_CREDENTIALS = { username: "admin", password: "AIWorkshopJuly!25", targetUrl: "http://localhost" };
  • Lists test_connection in the array of available tools returned by getAvailableTools().
    "test_connection",

Other Tools

Related Tools

Latest Blog Posts

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/nieperdragon/custom_mcp'

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