Skip to main content
Glama
MCP API OAS Checker

MCP API OAS Checker

Official
by italia
README.md
# MCP API OAS Checker

![License](https://img.shields.io/github/license/italia/api-oas-checker-mcp?style=flat-square)
![Issues](https://img.shields.io/github/issues/italia/api-oas-checker-mcp?style=flat-square)

A Model Context Protocol (MCP) server that validates OpenAPI specifications (OAS3) using the official [Italian Public Administration Guidelines](https://github.com/italia/api-oas-checker-rules).

It wraps the [api-oas-checker](https://github.com/italia/api-oas-checker-rules) ruleset (Spectral) to provide validation directly within your LLM environment (like Claude Desktop).

## Features

- **Validate OpenAPI Files**: Check local OpenAPI files against Italian PA rules.
- **Validate Content**: Paste OpenAPI content directly for validation.
- **Multiple Rulesets**: Choose from 4 standard Italian PA rulesets (`spectral`, `spectral-full`, `spectral-generic`, `spectral-security`) or use a custom one.
- **List Rules**: Inspect the available rules in any ruleset.
- **Smart Filtering**:
  - Filter by Line Numbers (`line_start`, `line_end`)
  - Filter by JSON Path (`filter_path`, e.g., `paths./users`)
  - Filter by Rule Codes (`allowed_rules`)
- **Token Efficient**: Summarized output design to save context window tokens.

## Installation

### Option 1: Install directly from GitHub (Recommended)

You can run the server directly using `npx` without cloning the repository manually:

```bash
npx -y github:italia/api-oas-checker-mcp
```

Or install it globally via `npm`:

```bash
npm install -g git+https://github.com/italia/api-oas-checker-mcp.git
```

Then you can run `api-oas-checker-mcp` directly.

Or add it to your configuration (see Configuration section).

### Option 2: Build from Source

```bash
git clone https://github.com/italia/api-oas-checker-mcp.git
cd api-oas-checker-mcp
npm install
```

The `prepare` script automatically compiles TypeScript during `npm install`.

**Verify Build**:
```bash
node build/index.js
```
(It should hang waiting for MCP input, which is normal. Press `Ctrl+C` to exit.)

## Configuration
/
### Claude Desktop

Add the server to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "api-oas-checker": {
      "command": "npx",
      "args": [
        "-y",
        "github:italia/api-oas-checker-mcp"
      ]
    }
  }
}
```

### From Local Build (Development)

If you built it locally:

```json
{
  "mcpServers": {
    "api-oas-checker": {
      "command": "node",
      "args": [
        "/absolute/path/to/api-oas-checker-mcp/build/index.js"
      ]
    }
  }
}
```

### Global Install

If you installed it globally:

```json
{
  "mcpServers": {
    "api-oas-checker": {
      "command": "api-oas-checker-mcp",
      "args": []
    }
  }
}
```

## Usage

### Tools

#### `validate_openapi`
Validates an OpenAPI document.

**Arguments:**
- `openapi_path` (string, optional): Absolute path to the file.
- `openapi_content` (string, optional): Raw string content of the OpenAPI file.
- `standard_ruleset` (string, optional): One of `spectral`, `spectral-full`, `spectral-generic`, `spectral-security`. Default: `spectral`.
- `ruleset_path` (string, optional): URL or local path to a custom Spectral ruleset file.
- `allowed_rules` (string[], optional): List of rule codes to check. If omitted, all rules are checked.
- `filter_path` (string, optional): Filter issues containing this string in their path (e.g., `info.version`).
- `line_start` (number, optional): Show issues starting from this line.
- `line_end` (number, optional): Show issues ending at this line.
- `max_issues` (number, optional): Limit the number of reported issues (Default: 20).

**Example Prompt:**
> "Check the file /home/user/my-api.yaml for errors, focusing on the '/users' path."

#### `list_rules`
Lists the available rules from a Spectral ruleset.

**Arguments:**
- `standard_ruleset` (string, optional): One of `spectral`, `spectral-full`, `spectral-generic`, `spectral-security`. Default: `spectral`.
- `ruleset_path` (string, optional): URL or local path to a custom Spectral ruleset file.

## Development

- `npm run build`: Compile TypeScript to JavaScript.
- `npm start`: Run the server (stdio).

## Contributing

Contributions are welcome! Please feel free to open a Pull Request.

## License

This project is licensed under the MIT License.

TDQS

A4/5.0

Scored across 3 tools

Disambiguation4/5

Each tool has a distinct role: listing rules, fetching full guidance, and validating a spec. The only mild overlap is that list_rules already returns descriptions while get_rule_guidance returns longer guidance text, but the descriptions clarify when to use each.

Naming Consistency5/5

All three tools follow a consistent snake_case verb_noun pattern (list_rules, get_rule_guidance, validate_openapi). No mixing of conventions or vague verbs.

Tool Count4/5

Three tools is well-scoped for a validator and each earns its place. The two rule-inspection tools (list_rules and get_rule_guidance) could arguably be merged, making the set slightly redundant.

Completeness4/5

The core workflow — discover rules, read guidance, validate a spec — is fully covered. Minor gaps exist: validate_openapi accepts only local paths or raw content (no URL input), and there is no way to export or batch-validate multiple specs.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues