Skip to main content
Glama

n8n MCP Server

MIT License
133
1,377
  • Apple
  • Linux
simple-client.test.ts1.53 kB
/** * Simple HTTP client tests without complex dependencies */ import { describe, it, expect } from '@jest/globals'; // Create a simple HTTP client class to test class SimpleHttpClient { constructor(private baseUrl: string, private apiKey: string) {} getBaseUrl(): string { return this.baseUrl; } getApiKey(): string { return this.apiKey; } buildAuthHeader(): Record<string, string> { return { 'X-N8N-API-KEY': this.apiKey }; } formatUrl(path: string): string { return `${this.baseUrl}${path.startsWith('/') ? path : '/' + path}`; } } describe('SimpleHttpClient', () => { it('should store baseUrl and apiKey properly', () => { const baseUrl = 'https://n8n.example.com/api/v1'; const apiKey = 'test-api-key'; const client = new SimpleHttpClient(baseUrl, apiKey); expect(client.getBaseUrl()).toBe(baseUrl); expect(client.getApiKey()).toBe(apiKey); }); it('should create proper auth headers', () => { const client = new SimpleHttpClient('https://n8n.example.com/api/v1', 'test-api-key'); const headers = client.buildAuthHeader(); expect(headers).toEqual({ 'X-N8N-API-KEY': 'test-api-key' }); }); it('should format URLs correctly', () => { const baseUrl = 'https://n8n.example.com/api/v1'; const client = new SimpleHttpClient(baseUrl, 'test-api-key'); expect(client.formatUrl('workflows')).toBe(`${baseUrl}/workflows`); expect(client.formatUrl('/workflows')).toBe(`${baseUrl}/workflows`); }); });

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/leonardsellem/n8n-mcp-server'

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