{
 "openapi": "3.0.3",
 "info": {
  "title": "The Nervous System - x402 API",
  "version": "1.1.0",
  "description": "External governance layer for agent systems by Arthur Palyan dba Levels Of Self. Pay-per-call, no signup, no API keys. USDC on Base, exact scheme, x402. Read-only audit-trail chain verification plus a deterministic MCP-config governance lint.",
  "contact": {
   "email": "ArtPalyan@LevelsOfSelf.com",
   "url": "https://levelsofself.com"
  }
 },
 "servers": [
  {
   "url": "https://api.100levelup.com"
  }
 ],
 "paths": {
  "/x402/verify-audit": {
   "get": {
    "operationId": "verifyAudit",
    "summary": "Nervous System audit-trail chain verification (read-only)",
    "description": "Verifies the integrity of the Nervous System governance audit chain and returns a JSON verification result. $0.005 USDC per call via x402 on Base mainnet.",
    "tags": [
     "governance",
     "audit",
     "x402"
    ],
    "x-payment-info": {
     "price": {
      "mode": "fixed",
      "amount": "0.005",
      "currency": "USD"
     },
     "protocols": [
      {
       "x402": {
        "x402Version": 2,
        "scheme": "exact",
        "network": "eip155:8453",
        "amount": "5000",
        "resource": "https://api.100levelup.com/x402/verify-audit",
        "description": "Nervous System audit-trail chain verification (read-only).",
        "mimeType": "application/json",
        "payTo": "0x00916a5282D67A7CB309B40ab4071bBB7B8bd998",
        "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "maxTimeoutSeconds": 60,
        "extra": {
         "name": "USD Coin",
         "version": "2"
        }
       }
      }
     ]
    },
    "responses": {
     "200": {
      "description": "Audit chain verification result",
      "content": {
       "application/json": {}
      }
     },
     "402": {
      "description": "Payment required. x402 v2 payment terms in JSON body + PAYMENT-REQUIRED header."
     }
    }
   }
  },
  "/x402/audit-mcp": {
   "post": {
    "operationId": "auditMcp",
    "summary": "Governance lint for MCP server configurations",
    "description": "Deterministic governance lint for MCP server configs: secrets exposure, supply-chain pinning, scope breadth, transport security. Returns findings + a 0-100 score. Accepts a Claude-Desktop {\"mcpServers\":{...}} config or a single server object. $0.05 USDC per call via x402 on Base mainnet.",
    "tags": [
     "governance",
     "mcp",
     "x402"
    ],
    "x-payment-info": {
     "price": {
      "mode": "fixed",
      "amount": "0.05",
      "currency": "USD"
     },
     "protocols": [
      {
       "x402": {
        "x402Version": 2,
        "scheme": "exact",
        "network": "eip155:8453",
        "amount": "50000",
        "resource": "https://api.100levelup.com/x402/audit-mcp",
        "description": "Governance lint for MCP server configs: secrets exposure, supply-chain pinning, scope breadth, transport security. Deterministic findings + score.",
        "mimeType": "application/json",
        "payTo": "0x00916a5282D67A7CB309B40ab4071bBB7B8bd998",
        "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "maxTimeoutSeconds": 60,
        "extra": {
         "name": "USD Coin",
         "version": "2"
        }
       }
      }
     ]
    },
    "requestBody": {
     "required": true,
     "description": "MCP server configuration JSON (max 64 KB).",
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "description": "Claude-Desktop config {\"mcpServers\":{\"<name>\":{command,args,env,...}}} or a single server object {command,args,env}.",
        "properties": {
         "mcpServers": {
          "type": "object",
          "additionalProperties": {
           "type": "object",
           "properties": {
            "command": {
             "type": "string"
            },
            "args": {
             "type": "array",
             "items": {
              "type": "string"
             }
            },
            "env": {
             "type": "object",
             "additionalProperties": {
              "type": "string"
             }
            },
            "url": {
             "type": "string"
            }
           }
          }
         }
        }
       },
       "example": {
        "mcpServers": {
         "filesystem": {
          "command": "npx",
          "args": [
           "-y",
           "@modelcontextprotocol/server-filesystem",
           "/"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Governance lint result: score + findings + summary.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "score": {
           "type": "integer",
           "minimum": 0,
           "maximum": 100
          },
          "findings": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "severity": {
              "type": "string",
              "enum": [
               "error",
               "warn",
               "info"
              ]
             },
             "code": {
              "type": "string"
             },
             "server": {
              "type": "string"
             },
             "message": {
              "type": "string"
             },
             "hint": {
              "type": "string"
             }
            }
           }
          },
          "summary": {
           "type": "object",
           "properties": {
            "servers": {
             "type": "integer"
            },
            "errors": {
             "type": "integer"
            },
            "warns": {
             "type": "integer"
            },
            "infos": {
             "type": "integer"
            }
           }
          }
         }
        },
        "example": {
         "score": 85,
         "findings": []
        }
       }
      }
     },
     "400": {
      "description": "Invalid JSON body."
     },
     "402": {
      "description": "Payment required. x402 v2 payment terms in JSON body + PAYMENT-REQUIRED header."
     },
     "413": {
      "description": "Request body exceeds the 64 KB limit."
     }
    }
   }
  },
  "/x402/legal-prep": {
   "post": {
    "operationId": "legalPrep",
    "summary": "Certified-agent legal-prep (assistance, never advice)",
    "description": "Legal-prep by a certified agent (LOS-CA-0002): explain a clause, review a pasted document, draft or revise wording, or prep questions for a licensed professional. Assistance only, never advice; every response ends with the disclaimer. $0.25 USDC per call via x402 on Base mainnet.",
    "tags": [
     "governance",
     "legal-prep",
     "x402",
     "certified-agent"
    ],
    "x-payment-info": {
     "price": {
      "mode": "fixed",
      "amount": "0.25",
      "currency": "USD"
     },
     "protocols": [
      {
       "x402": {
        "x402Version": 2,
        "scheme": "exact",
        "network": "eip155:8453",
        "amount": "250000",
        "resource": "https://api.100levelup.com/x402/legal-prep",
        "description": "Legal-prep by a certified agent (LOS-CA-0002): explain a clause, review a pasted document, draft or revise wording, or prep questions for a licensed professional. Assistance only, never advice; every response ends with the disclaimer.",
        "mimeType": "application/json",
        "payTo": "0x00916a5282D67A7CB309B40ab4071bBB7B8bd998",
        "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "maxTimeoutSeconds": 60,
        "extra": {
         "name": "USD Coin",
         "version": "2"
        }
       }
      }
     ]
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "mode",
         "text"
        ],
        "properties": {
         "mode": {
          "type": "string",
          "enum": [
           "explain",
           "doc_review",
           "draft",
           "questions"
          ]
         },
         "text": {
          "type": "string",
          "maxLength": 20000
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Governance lint result: score + findings + summary.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "score": {
           "type": "integer",
           "minimum": 0,
           "maximum": 100
          },
          "findings": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "severity": {
              "type": "string",
              "enum": [
               "error",
               "warn",
               "info"
              ]
             },
             "code": {
              "type": "string"
             },
             "server": {
              "type": "string"
             },
             "message": {
              "type": "string"
             },
             "hint": {
              "type": "string"
             }
            }
           }
          },
          "summary": {
           "type": "object",
           "properties": {
            "servers": {
             "type": "integer"
            },
            "errors": {
             "type": "integer"
            },
            "warns": {
             "type": "integer"
            },
            "infos": {
             "type": "integer"
            }
           }
          }
         }
        },
        "example": {
         "score": 85,
         "findings": []
        }
       }
      }
     },
     "400": {
      "description": "Invalid JSON body."
     },
     "402": {
      "description": "Payment required. x402 v2 payment terms in JSON body + PAYMENT-REQUIRED header."
     },
     "413": {
      "description": "Request body exceeds the 64 KB limit."
     }
    }
   }
  }
 }
}