Instruction file imported from microsoft/atlas-design (
.github/instructions/mcp.instructions.md). Copyright stays with the author.
Atlas MCP Server - Copilot Instructions
applyTo: "mcp/**"
This is the @microsoft/atlas-mcp package, a Model Context Protocol (MCP) server that exposes Atlas Design System resources — components, page-level patterns, atomic classes, design tokens, and code examples — to AI agents. Its primary job is to serve canonical HTML snippets so agents can build Atlas web pages; class-name and token data is supporting metadata.
Package Overview
- Name:
@microsoft/atlas-mcp - Type: MCP Server (private package)
- Build Tool: TypeScript compiler (tsc)
- Transport: stdio (for integration with AI agents)
Project Structure
mcp/
├── src/
│ ├── index.ts # Entry point with stdio transport
│ ├── server.ts # MCP server setup, tools, and resources
│ └── data/
│ └── loader.ts # Loads the pre-bundled data/atlas-data.json at runtime
├── dist/ # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md
Key Commands
npm run build- Compile TypeScript to JavaScriptnpm run dev- Watch mode for developmentnpm run start- Run the MCP server
Dependencies
@modelcontextprotocol/sdk- Official Model Context Protocol SDKzod- Schema validation for tool inputsfront-matter- Parse markdown frontmatter
Data pipeline
At build time, scripts/build-data.js bundles these sources into data/atlas-data.json. At runtime, the server reads only that bundle (see src/data/loader.ts):
site/src/components/*.md- Component HTML examplessite/src/patterns/*.md- Page-level pattern HTML examplessite/src/atomics/*.md- Atomic utility HTML examplescss/dist/class-names.json- Class names with color/size metadata (supporting)css/dist/tokens.json- Design tokens (supporting)
data/atlas-data.json is a generated artifact, not source: it is git-ignored (mcp/.gitignore), regenerated by npm run build:data, shipped in the npm package via package.json files, and rebuilt in CI and on prepublishOnly.
Only HTML code fences become examples (html, abut-html, html-no-indent, html-no-example), all normalized to html; CSS/SCSS fences are excluded. Each example keeps the nearest preceding doc heading as its title, so agents can request a snippet by intent. The goal is building HTML pages — not authoring CSS or suggesting class names.
Available Tools
- get_composition_guide - How to assemble a page (layout → atomic containers → large components → small elements)
- get_code_examples - Get canonical HTML snippets (component, pattern, or atomic) to build pages
- list_components - List all components
- list_patterns - List page-level patterns (multi-component HTML compositions)
- list_atomics - List atomic classes by category
- get_component - Get component details and HTML examples
- search_classes - (Supporting) Search CSS classes by name or pattern
- get_class_details - (Supporting) Get class color/size metadata
Available Resources
atlas://composition- How to compose a page (layout → atomics → large → small)atlas://components- Component catalogatlas://patterns- Page-level patterns (HTML compositions)atlas://atomics- Atomic classes by categoryatlas://tokens- Design tokens
Coding Guidelines
- Validate inputs with Zod - Define every tool input with a Zod schema.
- Cache loaded data - Class names, tokens, and docs are cached in memory after first load.
- Return JSON content - Return each tool result as JSON in the
textfield of an MCP content block. - Handle errors gracefully - Return helpful error messages instead of throwing.
When Making Changes
- Run
npm run buildto verify compilation. - Test the server with the MCP Inspector or direct JSON-RPC calls.
- Ensure data paths resolve from the compiled
dist/directory — this is the easiest thing to break. - Update
README.mdwhen adding or changing tools or resources.