Skip to main content
Glama

Kagi MCP

by yuki-yano
test-api.js1.91 kB
import axios from 'axios'; async function testKagiAPI() { const apiKey = process.env.KAGI_API_KEY; if (!apiKey) { console.error('Please set KAGI_API_KEY environment variable'); process.exit(1); } console.log('Testing Kagi API with key:', apiKey.substring(0, 10) + '...'); // Test Search API console.log('\n1. Testing Search API...'); try { const searchResponse = await axios.get('https://kagi.com/api/v0/search', { params: { q: 'test' }, headers: { 'Authorization': `Bot ${apiKey}`, }, }); console.log('✅ Search API works!'); console.log('Response:', JSON.stringify(searchResponse.data, null, 2).substring(0, 200) + '...'); } catch (error) { console.error('❌ Search API failed:'); if (error.response) { console.error('Status:', error.response.status); console.error('Status Text:', error.response.statusText); console.error('Data:', error.response.data); } else { console.error('Error:', error.message); } } // Test Summarizer API console.log('\n2. Testing Summarizer API...'); try { const summaryResponse = await axios.post('https://kagi.com/api/v0/summarize', { url: 'https://example.com', engine: 'cecil', }, { headers: { 'Authorization': `Bot ${apiKey}`, 'Content-Type': 'application/json', }, }); console.log('✅ Summarizer API works!'); console.log('Response:', JSON.stringify(summaryResponse.data, null, 2).substring(0, 200) + '...'); } catch (error) { console.error('❌ Summarizer API failed:'); if (error.response) { console.error('Status:', error.response.status); console.error('Status Text:', error.response.statusText); console.error('Data:', error.response.data); } else { console.error('Error:', error.message); } } } testKagiAPI().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/yuki-yano/kagi-mcp'

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