Skip to main content
Glama
nieperdragon

MCP Login Server

by nieperdragon

test_connection

Verify connectivity to the MCP Login Server's target URL to ensure the server is accessible before attempting automated login procedures for localhost applications.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline asynchronous handler function that implements the core logic of the 'test_connection' tool. It attempts a HEAD fetch to the target URL with a 5-second timeout and returns a structured response indicating accessibility.
    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:125-171 (registration)
    Direct registration of the 'test_connection' tool via server.tool() call within registerTestConnectionTool function, specifying name, description, input schema (empty), and handler.
    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:241-246 (registration)
    The registerAllTools function that includes the call to registerTestConnectionTool(server), thereby registering the test_connection tool as part of all tools.
    export function registerAllTools(server: McpServer): void { registerPerformLoginTool(server); registerGetLoginCredentialsTool(server); registerTestConnectionTool(server); registerNavigateToPimTool(server); }
  • src/index.ts:28-28 (registration)
    Top-level call to registerAllTools(server) in the main MCP server initialization, which triggers registration of test_connection.
    registerAllTools(server);
  • Configuration object 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" };

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