Skip to main content
Glama

NervusDB MCP Server

Official
by nervusdb
gitFingerprint.ts1.47 kB
import path from 'node:path'; import simpleGitFactory from 'simple-git'; export interface GitFingerprint { commit?: string; branch?: string; dirty: boolean; } export async function computeGitFingerprint(projectPath: string): Promise<GitFingerprint> { const git = simpleGitFactory({ baseDir: projectPath }); try { const isRepo = await git.checkIsRepo(); if (!isRepo) { return { dirty: false }; } const [commit, branch, status] = await Promise.all([ git.revparse(['HEAD']), git.revparse(['--abbrev-ref', 'HEAD']), git.status(), ]); return { commit, branch, dirty: status.files.length > 0, }; } catch { return { dirty: false, }; } } export function formatFingerprint(fingerprint: GitFingerprint): string { if (fingerprint.commit) { const dirtySuffix = fingerprint.dirty ? '+dirty' : ''; return `${fingerprint.commit}${dirtySuffix}`; } return fingerprint.dirty ? 'filesystem+dirty' : 'filesystem'; } /** * Get project directory name from path * Uses the project's basename for easy identification */ export function projectHash(projectPath: string): string { const resolved = path.resolve(projectPath); const basename = path.basename(resolved); // Sanitize the name: remove special chars, replace spaces with hyphens return basename .toLowerCase() .replace(/[^a-z0-9-_]/g, '-') .replace(/-+/g, '-') .replace(/^-|-$/g, ''); }

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/nervusdb/nervusdb-mcp'

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