Skip to main content
Glama

Omi MCP Server

by fourcolors
test-mcp-client.js2.87 kB
#!/usr/bin/env node /** * Simple test script to interact with the Omi MCP server * * Usage: * node test-mcp-client.js */ const { spawn } = require('child_process'); const readline = require('readline'); // User ID for testing const USER_ID = 'PIVswRdbkOQimAqwxKTO0oH5EFO2'; // Start the MCP server process const mcpServer = spawn('node', ['./dist/index.js'], { stdio: ['pipe', 'pipe', process.stderr], }); // Set up readline interface for user input const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); // Handle server output mcpServer.stdout.on('data', (data) => { const output = data.toString().trim(); if (output) { try { // Try to parse as JSON for better formatting const jsonOutput = JSON.parse(output); console.log('\nServer response:', JSON.stringify(jsonOutput, null, 2)); } catch (e) { // If not valid JSON, just output as is console.log('\nServer output:', output); } } }); // Send a request to the server function sendRequest(request) { const jsonRequest = JSON.stringify(request); console.log('\nSending request:', jsonRequest); mcpServer.stdin.write(jsonRequest + '\n'); } // Examples of requests const exampleRequests = { conversations: { id: '1', type: 'request', method: 'tools.read_omi_conversations', params: { user_id: USER_ID, limit: 5, }, }, memories: { id: '2', type: 'request', method: 'tools.read_omi_memories', params: { user_id: USER_ID, limit: 5, }, }, createConversation: { id: '3', type: 'request', method: 'tools.create_omi_conversation', params: { user_id: USER_ID, text: 'This is a test conversation', text_source: 'message', }, }, }; // Display menu and handle user choice function showMenu() { console.log('\n=== Omi MCP Test Client ==='); console.log('1. Get conversations'); console.log('2. Get memories'); console.log('3. Create a conversation'); console.log('q. Quit'); rl.question('\nChoose an option: ', (answer) => { if (answer === 'q') { mcpServer.kill(); rl.close(); return; } switch (answer) { case '1': console.log('Fetching conversations...'); sendRequest(exampleRequests.conversations); break; case '2': console.log('Fetching memories...'); sendRequest(exampleRequests.memories); break; case '3': console.log('Creating a conversation...'); sendRequest(exampleRequests.createConversation); break; default: console.log('Invalid option'); } // Show menu again after short delay setTimeout(showMenu, 1000); }); } // Give the server a moment to start up setTimeout(() => { console.log('MCP test client started. Press Ctrl+C to exit.'); console.log(`Using user ID: ${USER_ID}`); showMenu(); }, 1000); // Handle exit process.on('SIGINT', () => { mcpServer.kill(); rl.close(); process.exit(0); });

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/fourcolors/omi-mcp'

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