Sign inSign up

marksivill/mcp-spectral

By marksivill

•Updated over 1 year ago

Model Context Protocol (MCP) Server for Spectral to lint OpenAPI specifications

Image
API management
Developer tools
0

493

marksivill/mcp-spectral repository overview

⁠Spectral MCP Server

Lints/Validates an OpenAPI specification

⁠Available Tools

Tools provided by mcp-spectral

  • lint_openapi - lints OpenAPI specification
  • lint_openapi_with_ruleset - lints OpenAPI specification with Spectral ruleset
  • spectral_version - returns version of Spectral being used

⁠Using this MCP Server

Ensure Docker⁠ is installed on the local machine.

Update the configuration file to include the Docker image mcp-spectral.

{
  "mcpServers": {
    "OpenAPI linting (Spectral)": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "marksivill/mcp-spectral"
      ]
    }
  }
}

For example if using Anthropic⁠Claude Desktop⁠ to call mcp-spectral update the claude_desktop_config.json⁠ file and restart Claude Desktop, Claude Desktop will automatically pull down the mcp-spectral docker image from Docker Hub.

⁠Example Claude Desktop prompts

Below are example prompts for Claude Desktop which may also work in other Large Language Model (LLM) tools that are calling mcp-spectral.

Note mcp/fetch⁠ may also need to be installed into Claude Desktop to fetch URLs.

Prompt 1

What version of spectral do we have access to

Prompt 2

Validate the openapi specification from OpenWeatherMap API.
If any errors are found, fix them, then revalidate, repeat the last steps until the OpenAPI specification is valid.

Prompt 3

Build an OpenAPI specification version 3.1 for the Rick and Morty API.
Ensure that there are no validation errors.
If any errors are found, fix them, then revalidate, repeat the last steps until the OpenAPI specification is valid.

Prompt 4

Using the API documentation found at https://wheretheiss.at/w/developer build an OpenAPI specification.
Ensure that there are no validation errors.
If any errors are found, fix them, then revalidate, repeat the last steps until the OpenAPI specification is valid.

Prompt 5

Using the API documentation found at https://wheretheiss.at/w/developer build an OpenAPI specification version 3.1 using the rules
1) ensure all operationIds use kebab case
2) add info and contact information using your details
3) ensure servers are defined
4) ensure all operations contains a description
5) ensure all operations have one or more relevant tags
6) ensure there is a tag section

Ensure that there are no validation errors.
If any errors are found, fix them, then revalidate, repeat the last steps until the OpenAPI specification is valid.

Tag summary

Content type

Image

Digest

sha256:72ac7a13e…

Size

196.9 MB

Last updated

over 1 year ago

docker pull marksivill/mcp-spectral