UNPKG

@inso_web/els-mcp

Version:

MCP-сервер поверх INSO Error Logs Service. Read-only tools (search, analytics, fingerprinting, correlations) для подключения Claude Desktop/Code и ChatGPT к логам ошибок. Streamable HTTP transport + stdio для npx-запуска.

79 lines 3.62 kB
const BASE = [ 'You are connected to INSO Event Logs MCP — read-only access to error', 'logs and analytics from INSO platform (ELS).', '', 'ENVIRONMENTS available: DEV, PRODUCTION. Always set `deploymentEnv`', 'filter explicitly on every read tool to avoid mixing dev/prod data.', '', 'PROACTIVE WORKFLOW (act without explicit user request):', '', ' - After finishing a feature locally and running tests', ' -> search_logs(deploymentEnv=DEV, from=20m ago) to verify', ' no new errors in dev.', '', ' - After git push / deployment', ' -> wait ~5 min for build & deploy, then triage_recent_critical', ' (deploymentEnv=PRODUCTION). Compare error_histogram for the hour', ' before and after deploy.', '', ' - User reports a bug -> search_logs(search=<keyword>) +', ' explain_error(traceId) if known.', '', ' - Investigating regression after deploy ->', ' version_regression(baselineVersion=<prev BUILD_VERSION>, candidate=<new>).', '', ' - Pre-merge of feature branch -> error_histogram + top_error_messages.', '', ' - During long sessions -> triage_recent_critical as a periodic', ' background sanity check (every ~1h).', '', 'If `els.config.json` or `package.json[inso.els]` is detected in the workdir,', 'this server will enrich these instructions with project-specific', 'appSlug, environments and recent activity summary.', ].join('\n'); /** * Собирает финальный текст instructions. * * Базовый блок присутствует всегда. Если задан `project` — добавляется * секция PROJECT CONTEXT. Если есть `recentActivity` — расширяется * данными по recent errors/h и версиям. */ export function buildInstructions(opts = {}) { const project = opts.project ?? null; const activity = opts.recentActivity ?? null; if (!project) return BASE; const lines = [BASE, '', 'PROJECT CONTEXT (auto-detected):']; lines.push(` appSlug: ${project.appSlug}`); if (project.environments) { const pairs = Object.entries(project.environments) .map(([k, v]) => `${k}: "${v}"`) .join(', '); lines.push(` environments: { ${pairs} }`); } if (project.defaultEnvironment) { lines.push(` default environment: ${project.defaultEnvironment}`); } if (activity) { const baselineNote = activity.baseline !== undefined ? ` (baseline ${activity.baseline}/h - ${activity.errorsPerHour <= activity.baseline ? 'OK' : 'ELEVATED'})` : ''; lines.push(` recent activity: ${activity.errorsPerHour} errors/h${baselineNote}`); if (activity.currentVersion || activity.prevVersion) { const parts = []; if (activity.currentVersion) parts.push(`${activity.currentVersion} (current prod)`); if (activity.prevVersion) parts.push(`${activity.prevVersion} (prev)`); lines.push(` recent versions: ${parts.join(', ')}`); } } if (project.alerts?.criticalRateThreshold !== undefined) { lines.push(` alerts.criticalRateThreshold: ${project.alerts.criticalRateThreshold} errors/h`); } lines.push(''); lines.push('When user mentions deployment/feature/bug without specifying app, default'); lines.push(`to appSlug=${project.appSlug} in all tool calls below.`); return lines.join('\n'); } //# sourceMappingURL=instructions.js.map