Browse docs (18)

MCP Integration Guide

2,709 words ยท 14 min read ยท 9 sections

Overview

MicroGemLabs exposes an MCP server that lets any MCP-compatible AI agent โ€” Claude Code, Cursor, Hermes Agent, Grok Bot, or a custom agent โ€” read and (for GemSmart business teams) write your business/monitoring data through a standard protocol: monitoring, logging, and alerting data across all seven products, the MicroGemAI memory system, GemScrape web-data tools, and GemSmart CRM/booking data.

The catalog has 31 tools total: 20 covering the seven devops products plus MicroGemAI memory and GemScrape, and 11 GemSmart business-data tools (6 read-only + 5 writes โ€” see "GemSmart tools" below) for GemSmart business teams. Which tools a given team's tools/list call returns depends on that team's enabled products and team type โ€” an engineering team with nothing enabled yet sees the devops tools only; a GemSmart business team sees its 11 gemsmart tools plus any devops tools for products it has enabled.

Transport: the server speaks one-shot JSON-RPC 2.0 over HTTPS POST at /api/mcp (no SSE/streaming yet โ€” that's a planned follow-up). This is a "type": "http" MCP server, not "type": "url"/SSE โ€” use the JSON config form below if your client's UI or CLI offers both. Auth: a long-lived team API key (mgl_team_โ€ฆ) sent as a Bearer token โ€” see below. OAuth is planned but not yet available; the Bearer API key (PAT) is the only supported auth today.

Authentication

All MCP tool calls require a team API key. Generate one in Settings โ†’ Account โ†’ API Keys (key creation is owner/admin-gated โ€” MCP keys are operator-grade, see "Write tools" below).

The API key is passed as a Bearer token on every request:

Authorization: Bearer mgl_team_xxxxxxxxxxxxx

API keys are scoped to a single team. All data returned โ€” and every write โ€” is limited to that team's resources.

> OAuth is planned, not yet available. The PAT-style Bearer API key above is the only supported auth method today. Don't wait on OAuth to connect โ€” the API key works with every MCP client that supports a custom Authorization header.

Connecting Your Agent

The server endpoint is /api/mcp on your MicroGemLabs deployment, e.g. https://microgemlabs.ai/api/mcp (or your team's staging domain). All examples below use that placeholder โ€” swap in your actual deployment URL.

Claude Code

Claude Code's claude mcp add command adds an HTTP-transport MCP server with a custom header. The exact flags can shift between Claude Code versions, so verify against claude mcp add --help if this doesn't match what you see:

claude mcp add --transport http microgemlabs \
  https://microgemlabs.ai/api/mcp \
  --header "Authorization: Bearer mgl_team_xxxxxxxxxxxxx"

If your Claude Code version's CLI differs, the config file form is stable across versions โ€” add this to your MCP config (.mcp.json / ~/.claude.json, wherever your Claude Code setup stores it):

{
  "mcpServers": {
    "microgemlabs": {
      "type": "http",
      "url": "https://microgemlabs.ai/api/mcp",
      "headers": {
        "Authorization": "Bearer mgl_team_xxxxxxxxxxxxx"
      }
    }
  }
}

Cursor

Settings โ†’ MCP โ†’ Add new MCP server. Set the server URL to https://microgemlabs.ai/api/mcp and add a custom header Authorization: Bearer mgl_team_xxxxxxxxxxxxx. If Cursor's UI asks for a config JSON directly instead, use the same mcpServers block shown above for Claude Code (Cursor and Claude Code both consume this shape).

Hermes Agent

Add to your Hermes Agent MCP configuration:

# ~/.hermes/mcp_servers.yaml
servers:
  - name: microgemlabs
    url: https://microgemlabs.ai/api/mcp
    auth:
      type: bearer
      token: mgl_team_xxxxxxxxxxxxx

Grok Bot / other remote-MCP clients

Any agent that supports remote MCP with a custom Bearer header can connect directly:

Server URL: https://microgemlabs.ai/api/mcp
Authorization: Bearer mgl_team_xxxxxxxxxxxxx

Available Tools

query_monitors

Get the current status of all uptime monitors (PulseGuardPlus).

Parameters:
ParamTypeDescription
statusstringFilter: up, down, or all (default)
typestringFilter: http, tcp, ping, dns, ssl, heartbeat
Returns: Monitor name, target URL, type, current status, latest response time. Example prompt: "Check if any of my monitors are down"

query_incidents

Get recent incidents across ALL products โ€” PulseGuardPlus downtime, CronKeeper missed pings, LogVault alerts, CertGuard expiry warnings, CronRunner failures, HookRelay forward failures.

Parameters:
ParamTypeDescription
productstringFilter by product or all (default)
statusstringactive, resolved, or all (default)
hoursnumberLook-back period (default: 24)
Example prompt: "What incidents have occurred in the last 48 hours?"

search_logs

Search log entries in LogVault with full-text search.

Parameters:
ParamTypeRequiredDescription
querystringYesFull-text search query
levelstringNodebug, info, warn, error, fatal
streamstringNoStream name filter
hoursnumberNoLook-back period (default: 1)
limitnumberNoMax entries (default: 20)
Example prompt: "Search logs for database timeout errors in the last 6 hours"

query_cron_checks

Get cron job monitor status from CronKeeper.

Parameters:
ParamTypeDescription
statusstringup, late, down, or all (default)
Example prompt: "Are any cron jobs late or down?"

query_certs

Get SSL certificate and domain registration status from CertGuard.

Parameters:
ParamTypeDescription
statusstringhealthy, warning, critical, expired, or all
expiring_within_daysnumberOnly return certs expiring within N days
Example prompt: "Which SSL certificates expire within the next 14 days?"

query_scheduled_jobs

Get scheduled HTTP job status from CronRunner.

Parameters:
ParamTypeDescription
statusstringsuccess, failed, or all (default)
Example prompt: "Are any scheduled jobs failing?"

query_webhooks

Get webhook endpoint status from HookRelay.

Parameters:
ParamTypeDescription
with_failuresbooleanOnly return endpoints with failures (default: false)
Example prompt: "Which webhook endpoints have forwarding failures?"

query_errors

List ErrorGuard error groups โ€” tracked application errors grouped by fingerprint, newest activity first.

Parameters:
ParamTypeDescription
statusstringunresolved (default), resolved, or all
levelstringFilter by level, e.g. error, warning, fatal
hoursnumberOnly groups with activity in the last N hours
limitnumberMax groups to return, 1-50 (default 10)
Example prompt: "What unresolved errors spiked in the last 24 hours?"

get_oncall_status

Get current on-call schedule status.

Parameters: None Returns: Who is currently on call, active alerts, escalation policy status. Example prompt: "Who is on call right now and are there any active alerts?"

get_platform_health

Comprehensive health overview of ALL products in one call. This is the most useful tool for general "how are things?" queries.

Parameters:
ParamTypeDescription
hoursnumberLook-back period (default: 24)
Returns: Summary counts, active issues, and key metrics across all seven products. Example prompt: "Give me a full health check of our infrastructure"

search_memory

Search MicroGemAI's accumulated knowledge base.

Parameters:
ParamTypeRequiredDescription
querystringYesSearch query
categorystringNoFilter: infrastructure, pattern, runbook, preference, incident_learning, team_context, or all
Returns: Matching knowledge entries with category, content, and confidence score. Example prompt: "What do we know about our database architecture?"

correlate_events

Find events across ALL products that occurred around a specific time. The most powerful tool for incident investigation.

Parameters:
ParamTypeRequiredDescription
timestampISO 8601YesCenter of the search window
window_minutesnumberNoMinutes before and after (default: 30)
Returns: Events from all products within the time window, sorted chronologically. Example prompt: "What happened across all our monitoring between 2:00 AM and 3:00 AM today?"

Example Agent Sessions

Incident Investigation with Hermes Agent

You: What caused the API outage at 3 AM?

Hermes Agent:
  โ†’ [calls get_platform_health]
  โ†’ [calls query_incidents with hours=12]
  โ†’ [calls correlate_events with timestamp=2026-04-20T03:00:00Z]
  โ†’ [calls search_logs with query="error" hours=2]

"Based on the data, here's what happened:

The API gateway monitor went down at 2:58 AM. LogVault shows a spike of 
'SSL handshake failed' errors starting at 2:45 AM. CertGuard reports that 
the api.example.com certificate expired at 2:30 AM. CronKeeper shows the 
cert-renewal cron job has been in 'late' status for 3 days.

Root cause: The SSL certificate renewal cron job stopped running, the cert 
expired, and the API started rejecting HTTPS connections.

Fix: Renew the cert manually, then investigate why the renewal cron failed."

Proactive Check with Claude

You: @microgemlabs Are there any issues I should know about?

Claude:
  โ†’ [calls get_platform_health]
  โ†’ [calls query_certs with expiring_within_days=14]

"Your infrastructure looks mostly healthy. Two items to note:

1. The staging.example.com SSL cert expires in 9 days. Consider 
   renewing early.
2. CronRunner shows the 'analytics-sync' job has 2 consecutive 
   failures. The last error was 'Connection refused' โ€” your analytics 
   endpoint may be down."

Action Tools

These tools allow agents to interact with the runbook system (now part of the unified Skills library โ€” see /agent/skills?type=runbook). Trust levels apply โ€” see Runbook Actions in the MicroGemAI guide.

list_runbooks

List available runbook action templates for this team.

Parameters:
  • category โ€” Filter: restart, scale, cache, rollback, dns, custom, or all (default)
  • active_only โ€” Boolean, default true

execute_runbook

Trigger a runbook action. Trust levels apply: manual templates execute immediately when called by an authenticated agent, auto_approval templates return a pending status with approval link, full_auto templates execute immediately.

Parameters:
  • template_id (required) โ€” ActionTemplate ID from list_runbooks
  • incident_id โ€” Link execution to an incident
  • incident_source โ€” Product that created the incident
  • variables โ€” Key-value pairs for {{variable}} substitution
  • reasoning โ€” Why you're executing this (stored in audit trail)

check_execution_status

Poll for the result of a runbook execution.

Parameters:
  • execution_id (required) โ€” ActionExecution ID from execute_runbook

Returns: Status (pending/running/success/failed/approval_pending/cancelled), HTTP response status, duration, error message.

suggest_runbook

Find matching runbooks for an incident description. Uses trigger pattern matching and past execution history.

Parameters:
  • product (required) โ€” Where the incident occurred
  • incident_title (required) โ€” Description of the incident
  • error_message โ€” Error message for better matching

Returns: Ranked list of matching templates with confidence scores.

Example: Full Incident Investigation + Auto-Fix

You: My API is down, check MicroGemLabs and fix it.

Agent:
  โ†’ [calls get_platform_health]
  โ†’ [calls query_incidents with product=pulseguardplus, status=active]
  โ†’ [calls search_logs with query="error" hours=1]
  โ†’ [calls correlate_events with timestamp of the incident]
  โ†’ [calls suggest_runbook with product=pulseguardplus, incident_title="API Gateway DOWN"]
  โ†’ [calls execute_runbook with template_id of "Restart API Workers"]
  โ†’ [calls check_execution_status to verify success]
  โ†’ [calls query_monitors to confirm recovery]

"The API Gateway went down at 3:02 AM due to connection pool exhaustion.
LogVault showed 'max connections reached' errors starting at 2:45 AM. I
executed the 'Restart API Workers' runbook โ€” workers restarted in 3.2s
and the API is now responding normally (avg 142ms)."

GemSmart tools

Eleven tools for businesses running on GemSmart โ€” six read-only, five writes โ€” so a client-owned external agent (Grok Bot via its remote-MCP support, Claude Code, Cursor, or anything MCP-speaking) can use GemSmart as its structured data source AND take real CRM/booking actions on the business's behalf. These tools only work for GemSmart business teams; a devops-only team gets a clean "GemSmart tools are not enabled for this team" error if it calls one.

get_business_profile

The business's public profile โ€” name, services (price/duration), hours, service area, contact info. Public-safe subset only: no payment configuration, no intake question internals.

Parameters: None Example prompt: "What services does this business offer and when are they open?"

list_leads

List CRM leads, newest first.

Parameters:
ParamTypeDescription
statusstringFilter: new, contacted, qualified, won, lost
takenumberMax leads to return. Default and max: 50

list_bookings

List bookings/appointments. Returns id, service, customer name, start/end time, and status โ€” never intake answers or payment details, even though the underlying data includes them for the owner portal.

Parameters:
ParamTypeDescription
windowstringupcoming (default) or past
takenumberMax bookings to return. Default and max: 50

list_followups

List CRM follow-ups due today or overdue, oldest-due first.

Parameters: None

get_reviews_summary

Rating now, 7-day rating delta, new-review count, and a handful of recent reviews (author/rating/text).

Parameters: None

get_daily_snapshot

The morning briefing numbers โ€” follow-ups due, new leads, missed/handled calls, bookings today, no-shows, reputation/mentions context. The "what should I know this morning?" tool โ€” call this first for a general status question.

Parameters: None

Write tools

MCP writes are operator-grade. The caller authenticates AS the team โ€” whoever holds the mgl_team_โ€ฆ key can write to that team's CRM/booking data exactly like an owner/admin using the portal's manual-entry paths. There's no OTP or customer-facing confirmation step, because the key itself is the authorization. Treat these tools with the same care as giving someone portal owner/admin access. MCP writes never grant SMS consent. This is a binding rule, not a default: capture_lead never sets consentSms (it's hardcoded to the unset/false state) and always stamps the consent audit trail with consentSource: "mcp"; create_booking never touches the consent record at all. An external agent can create leads and bookings, but it can never opt a customer into SMS on their behalf.
ToolWhat it doesConsent / safety notes
capture_leadCreate a CRM lead + contact from name/phone/email/note.Never grants SMS consent. consentSource is always "mcp". Requires at least one of phone or email.
check_availabilityLook up real upcoming appointment openings for one bookable service.Read-only โ€” same slot engine as the public booking widget and voice receptionist.
create_bookingCreate a confirmed appointment.Enforced against the same availability engine as the public booking widget (business hours, lead time, booking horizon, double-booking prevention) โ€” cannot bypass availability rules or book in the past. Does not grant SMS consent to the customer.
add_followupAdd a CRM follow-up reminder (note + due date), optionally linked to a lead.Team-scoped; if leadId is given it must belong to the calling team.
get_intake_linkGet a booking's pre-visit intake form link (minted on first request), plus whether the customer has completed it.Never returns the intake answers themselves โ€” same sensitive-data rule as list_bookings. Use only to share/resend the link.

Key custody warning

Treat your mgl_team_โ€ฆ key like a password โ€” for write-capable teams, more so, since it's an operator-grade credential. If you connect it to a third-party agent and later stop using that tool, rotate the key.

A key also unlocks intake links whose pages can show a returning customer's prior intake answers โ€” another reason to rotate keys you no longer use.

Rate Limits

MCP has two independent rate-limit buckets, both enforced server-side (no per-client action needed beyond backing off on a rate-limit response):

  • tools/call, per team: 120 requests/minute. Applies after authentication succeeds, keyed on the authenticated team. For bulk queries, use get_platform_health (one call for everything) instead of querying each product individually.
  • Failed authentication, per IP: 20 attempts/minute. Applies to bad/missing/revoked Bearer tokens, keyed on the caller's IP โ€” this is what stops key-guessing/enumeration bursts. A single mistyped key won't trip it; hammering the endpoint with bad keys will.

A rate-limited call gets back a JSON-RPC error with code: -32005 (an implementation-defined code in the JSON-RPC reserved -32000..-32099 server-error range โ€” there's no MCP-standard code for this yet) and a Retry-After header/data.retryAfterSec field telling you how long to wait.

Data Scope

All tools return data scoped to the authenticated team. You cannot access other teams' data, and no write tool can affect any team other than the one the API key belongs to. Most tools (all devops/monitoring tools, and six of the eleven GemSmart tools) are read-only โ€” no tool can create, modify, or delete resources beyond what the write tools above explicitly allow. Use the MicroGemLabs dashboard for anything not covered by a write tool.