Skip to main content
Glama

Gemini Context MCP Server

by ogoldberg
test-mcp.js2.42 kB
const { spawn } = require('child_process'); require('dotenv').config(); // Start the MCP server const server = spawn('node', ['dist/mcp-server.js'], { stdio: ['pipe', 'pipe', process.stderr] }); // Helper function to send request and get response function sendRequest(request) { return new Promise((resolve, reject) => { const responseHandler = (data) => { const response = JSON.parse(data.toString()); if (response.id === request.id) { server.stdout.removeListener('data', responseHandler); resolve(response); } }; server.stdout.on('data', responseHandler); server.stdin.write(JSON.stringify(request) + '\n'); }); } async function runTests() { try { // Test 1: Initialize console.log('Testing initialize...'); const initResponse = await sendRequest({ id: 1, method: 'initialize', params: {} }); console.log('Initialize response:', JSON.stringify(initResponse, null, 2)); // Test 2: Process message console.log('\nTesting process_message...'); const messageResponse = await sendRequest({ id: 2, method: 'process_message', params: { sessionId: 'test-session', message: 'What is the capital of France?' } }); console.log('Process message response:', JSON.stringify(messageResponse, null, 2)); // Test 3: Get context console.log('\nTesting get_context...'); const contextResponse = await sendRequest({ id: 3, method: 'get_context', params: { sessionId: 'test-session' } }); console.log('Get context response:', JSON.stringify(contextResponse, null, 2)); // Test 4: Clear context console.log('\nTesting clear_context...'); const clearResponse = await sendRequest({ id: 4, method: 'clear_context', params: { sessionId: 'test-session' } }); console.log('Clear context response:', JSON.stringify(clearResponse, null, 2)); } catch (error) { console.error('Test error:', error); } finally { // Cleanup server.stdin.end(); server.kill(); } } runTests();

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/ogoldberg/gemini-context-mcp-server'

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