Big docs tidy up in preparation for launch (#364)

## Motivation and Context
Docs currently don't have very clear organisation, and don't explain
core flows.

This fixes #89 (although we still might want to push these to
`https://modelcontextprotocol.io/docs/`), based on the plan there.

One minor change from that plan is that I merged tutorials and guides,
because they ended up basically being duplicates which I thought would
be annoying for us to keep in sync. Additionally in the Diátaxis
framework, tutorials and guides are separated by whether they are
focused on acquisition of skills (e.g. in a learning environment) or
application of skills (e.g. in a work environment). I expect the
registry to be something that will be used occasionally in a work
environment, rather than a fundamental 'learnable' skill so I think it's
reasonable not to have tutorials and fold these into guides.

## How Has This Been Tested?
- Read through all these updated docs
- Unit and integration tests (that previously used examples.md and use
the schema) working
- Ran `npx markdown-link-check .` to check all the links work

## Breaking Changes
Links to old docs will break, but I don't think there are any. All
internal links have been checked and updated.

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
This commit is contained in:
adam jones 2025-09-07 10:44:42 +01:00 • committed by GitHub
commit 2e7108d366
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,10 +20,9 @@ import (
)
const (
// expectedExampleCount is the number of JSON examples we expect to find in examples.md
// IMPORTANT: Only change this count if you have intentionally added or removed examples
// from the examples.md file. This check prevents accidental formatting changes from
// causing examples to be skipped during validation.
// expectedExampleCount is the number of JSON examples we expect to find in generic-server-json.md
// IMPORTANT: Only change this count if you have intentionally added or removed examples. This
// check prevents accidental formatting changes from causing examples to be skipped during validation.
expectedExampleCount = 12
)
@ -36,11 +35,10 @@ func main() {
}
func runValidation() error {
basePath := filepath.Join("docs", "server-json")
basePath := filepath.Join("docs", "reference", "server-json")
examplesPath := filepath.Join(basePath, "examples.md")
examplesPath := filepath.Join(basePath, "generic-server-json.md")
schemaPath := filepath.Join(basePath, "server.schema.json")
registrySchemaPath := filepath.Join(basePath, "registry-schema.json")
examples, err := extractExamples(examplesPath)
if err != nil {
@ -61,17 +59,12 @@ func runValidation() error {
return fmt.Errorf("failed to compile server.schema.json: %w", err)
}
registrySchema, err := compileSchema(registrySchemaPath)
if err != nil {
return fmt.Errorf("failed to compile registry-schema.json: %w", err)
}
validatedCount := 0
for i, example := range examples {
log.Printf("Example %d:", i+1)
if validateExample(example, baseSchema, registrySchema) {
if validateExample(example, baseSchema) {
validatedCount++
}
@ -87,7 +80,7 @@ func runValidation() error {
return nil
}
func validateExample(ex example, baseSchema, registrySchema *jsonschema.Schema) bool {
func validateExample(ex example, baseSchema *jsonschema.Schema) bool {
var data any
if err := json.Unmarshal([]byte(ex.content), &data); err != nil {
log.Printf(" ❌ Invalid JSON: %v", err)
@ -111,11 +104,10 @@ func validateExample(ex example, baseSchema, registrySchema *jsonschema.Schema)
}
baseValid := validateAgainstSchema(serverData, baseSchema, "server.schema.json")
registryValid := validateAgainstSchema(serverData, registrySchema, "registry-schema.json")
goValidatorValid := validateWithObjectValidator(serverData)
// Only count as validated if all validations passed
return publishRequestValid && baseValid && registryValid && goValidatorValid
return publishRequestValid && baseValid && goValidatorValid
}
func validateAgainstSchema(data any, schema *jsonschema.Schema, schemaName string) bool {