---
name: check-mcp
description: >
  Verify the PAPI MCP server is running and healthy.
  Use when the user says "check mcp", "is papi running", "mcp status",
  or at the start of any session that needs PAPI tools.
  Also use proactively if PAPI MCP tools are expected but not appearing.
invocable: true
---

# Check MCP Server Health

Run these steps in order and report the result clearly.

## Step 1: Read config

Read `.mcp.json` from the project root. Extract the server command, args, and env vars.

If `.mcp.json` doesn't exist, stop and report: "No MCP server configured. Create .mcp.json to connect PAPI."

## Step 2: Check connection

Look at the available tools list. If PAPI MCP tools (like `orient`, `plan`, `build_list`, `build_execute`) are present, the server is connected.

If not, tell the user:

"PAPI MCP server is configured but not connected. Try one of these:
1. Restart Claude Code (close and reopen)
2. In VS Code: Cmd+Shift+P → 'Developer: Reload Window'
3. Check that npx can run: `npx @papi-ai/server --help`"

## Step 3: Quick health check

If tools are available, run `orient` to verify the server can reach the database and return project state.

If orient fails, check:
- Is `PAPI_DATA_API_KEY` set in `.mcp.json` env?
- Is the API key valid? (Try regenerating from the dashboard onboarding page)

## Step 4: Report

Summarise with one of:
- **Healthy**: Server configured, tools available, database connected
- **Configured but disconnected**: .mcp.json exists, tools not showing — needs restart
- **Connection error**: Tools available but database unreachable — check API key
- **Not configured**: No .mcp.json found
