Skip to main content
Glama
index.ts1.05 kB
#!/usr/bin/env node /** * Ollama MCP Server - Main entry point * Exposes Ollama SDK functionality through MCP tools */ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; import { createServer } from './server.js'; /** * Main function to start the MCP server * Exported for testing purposes */ export async function main() { const server = createServer(); const transport = new StdioServerTransport(); await server.connect(transport); // Handle shutdown gracefully process.on('SIGINT', async () => { await server.close(); process.exit(0); }); return { server, transport }; } // Only run if this is the main module (not being imported for testing) // Check both direct execution and npx execution const isMain = import.meta.url.startsWith('file://') && (import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.includes('ollama-mcp')); if (isMain) { main().catch((error) => { console.error('Fatal error:', error); process.exit(1); }); }

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/rawveg/ollama-mcp'

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