(path string, data map[string]any)
| 256 | } |
| 257 | |
| 258 | func writeJSON(path string, data map[string]any) error { |
| 259 | if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { |
| 260 | return fmt.Errorf("mcp: mkdir %s: %w", filepath.Dir(path), err) |
| 261 | } |
| 262 | out, err := json.MarshalIndent(data, "", " ") |
| 263 | if err != nil { |
| 264 | return fmt.Errorf("mcp: marshal %s: %w", path, err) |
| 265 | } |
| 266 | out = append(out, '\n') |
| 267 | if err := os.WriteFile(path, out, 0o600); err != nil { |
| 268 | return fmt.Errorf("mcp: write %s: %w", path, err) |
| 269 | } |
| 270 | return nil |
| 271 | } |
| 272 | |
| 273 | // ServerFromSchema constructs a Server from a registry schema, choosing the |
| 274 | // preferred installation method. Returns an error when the schema has no |
no outgoing calls
no test coverage detected