Install and configure
@dawmatt/api-grade-mcpso your AI tool can grade API specifications directly.
- Node.js 20 or later — nodejs.org
- An MCP-compatible AI tool (Claude Code, Claude Desktop, GitHub Copilot VS Code Agent mode, Cursor, Windsurf, or any MCP host)
- An OpenAPI or AsyncAPI specification file to grade
No global install is required. The server runs on demand via npx:
npx -y @dawmatt/api-grade-mcpOr install globally if you prefer a local binary:
npm install -g @dawmatt/api-grade-mcpIf your environment restricts direct node/npx execution but allows approved container images, run the server as a Docker container instead. Tool behaviour is identical to the npx/node invocation.
docker pull dawmatt/api-grade-mcp
docker run -i --rm -v "$PWD:/workspace" -w /workspace dawmatt/api-grade-mcpThe -v "$PWD:/workspace" bind mount is required — spec and ruleset file paths must resolve inside the container, so mount the directory containing the files you want to grade. The -i flag keeps stdin open for the stdio transport (no -t needed; this is not an interactive terminal session).
Register the server from the terminal:
claude mcp add api-grade -- npx -y @dawmatt/api-grade-mcpOr add it to .claude/settings.json manually:
{
"mcpServers": {
"api-grade": {
"command": "npx",
"args": ["-y", "@dawmatt/api-grade-mcp"]
}
}
}The tools are available immediately in your Claude Code session.
Via Docker:
{
"mcpServers": {
"api-grade": {
"command": "docker",
"args": ["run", "-i", "--rm", "-v", "${PWD}:/workspace", "-w", "/workspace", "dawmatt/api-grade-mcp"]
}
}
}-
Open the configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the server entry:
{
"mcpServers": {
"api-grade": {
"command": "npx",
"args": ["-y", "@dawmatt/api-grade-mcp"]
}
}
}- Restart Claude Desktop. The six api-grade tools will appear in the tools panel.
Via Docker:
{
"mcpServers": {
"api-grade": {
"command": "docker",
"args": ["run", "-i", "--rm", "-v", "/path/to/your/workspace:/workspace", "-w", "/workspace", "dawmatt/api-grade-mcp"]
}
}
}Requires VS Code 1.99 or later with the GitHub Copilot extension.
- Create
.vscode/mcp.jsonin your project root:
{
"servers": {
"api-grade": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@dawmatt/api-grade-mcp"]
}
}
}-
Open the Copilot Chat panel and switch to Agent mode.
-
The api-grade tools are now available to Copilot in agent mode.
Via Docker:
{
"servers": {
"api-grade": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-v", "${workspaceFolder}:/workspace", "-w", "/workspace", "dawmatt/api-grade-mcp"]
}
}
}Create .cursor/mcp.json in your project root (or ~/.cursor/mcp.json for global):
{
"mcpServers": {
"api-grade": {
"command": "npx",
"args": ["-y", "@dawmatt/api-grade-mcp"]
}
}
}Reload Cursor after saving.
| Tool | What it does |
|---|---|
grade-api |
Quick grade: letter grade, numeric score, and summary |
grade-api-detailed |
Full grade with all violations, diagnostics, and recommendations |
assert-api-grade |
Pass/fail assertion for a minimum grade threshold |
grade-api-remediation-safety |
Classified list of diagnostics filtered by remediation safety level (safe, humanreview, or unsafe), each with a risk/confidence indicator, for AI-assisted correction |
analyse-ruleset-safety |
Per-rule risk, confidence, and remediation-safety analysis for a ruleset, independent of grading any spec |
set-ruleset-config |
Set the default Spectral ruleset at session, workspace, or global scope |
get-ruleset-config |
Get the active Spectral ruleset and which scope is effective |
Once configured, ask your AI tool naturally:
Grade an API:
Grade the API at
/workspace/my-api/openapi.yaml
Get detailed diagnostics:
Show me all the violations in
/workspace/my-api/openapi.yamlwith recommendations
Assert a minimum grade:
Check whether
/workspace/my-api/openapi.yamlmeets a minimum grade of B
AI-assisted fix:
Apply safe remediations to
/workspace/my-api/openapi.yaml
To confirm the server starts correctly:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | npx -y @dawmatt/api-grade-mcpYou should see a JSON response listing all the tools above.
- Configuration Reference — default rulesets, auth, and scope precedence
- Troubleshooting — common issues and solutions
- Package Documentation — full tool reference
- Documentation Index