@spartan-ng/mcp
v1.1.0
Published
Model Context Protocol server exposing Spartan Angular UI documentation, components, and blocks as AI-consumable tools.
Maintainers
Readme
@spartan-ng/mcp
Website • Documentation • Components • GitHub
The official Model Context Protocol server for spartan/ui. Give your AI assistant up-to-date Spartan documentation, components, and blocks.
@spartan-ng/mcp exposes the Spartan Angular UI ecosystem - documentation, components, and blocks - as tools, resources, and prompts for MCP clients such as Claude Desktop, Cursor, and other AI assistants. It fetches content live from the public Spartan site and caches it on disk per version, so assistants can answer questions about Spartan components with current API tables and code examples.
What it provides
- Components - list components and fetch a component's documentation, with structured Brain API (
Brn*) / Helm API (Hlm*) extraction or raw code blocks. - Blocks - list and fetch pre-built UI patterns (sidebar, login, signup, calendar) and analyze the components/packages they depend on.
- Docs - fetch official documentation topics (installation, cli, theming, dark-mode, typography, health-checks, update-guide) with optional code/heading/link extraction.
- Analysis - inspect a component's dependencies (npm packages, Angular CDK, peer components, imports) and its accessibility features (ARIA, keyboard, screen reader, WCAG).
- Health - check availability of the Spartan docs site and surface the Spartan CLI health-check commands.
- Caching - version-aware on-disk cache with status, clear, rebuild, switch-version, and list-versions tools.
Installation
With npx (no install)
Configure your MCP client:
{
"mcpServers": {
"spartan-ui": {
"command": "npx",
"args": ["-y", "@spartan-ng/mcp"]
}
}
}Global install
npm install -g @spartan-ng/mcp{
"mcpServers": {
"spartan-ui": {
"command": "spartan-mcp"
}
}
}Local build
{
"mcpServers": {
"spartan-ui": {
"command": "node",
"args": ["/path/to/dist/libs/mcp/src/server.js"]
}
}
}- Run
nx build mcpto compile todist/libs/mcp. - Point
argsat the builtsrc/server.js. - Restart your MCP client.
MCP surface
Tools (17)
| Tool | Description |
| --------------------------------- | ------------------------------------------------------------------------ |
| spartan_components_list | List known components with documentation URLs |
| spartan_components_get | Fetch a component page; extract: 'code' \| 'api' |
| spartan_components_dependencies | Analyze a component's dependencies |
| spartan_accessibility_check | Analyze a component's accessibility features |
| spartan_blocks_list | List known blocks |
| spartan_blocks_get | Fetch a block page; format: 'html' \| 'text' |
| spartan_blocks_dependencies | Analyze a block's dependencies |
| spartan_docs_get | Fetch a docs topic; extract: 'none' \| 'code' \| 'headings' \| 'links' |
| spartan_meta | Topics, components, and blocks for client autocomplete |
| spartan_health_check | Check availability of docs/component pages |
| spartan_health_instructions | Spartan CLI health-check instructions |
| spartan_health_command | Build the exact health-check command (ng/nx) |
| spartan_cache_status | Current cache version and statistics |
| spartan_cache_clear | Clear the current (or all) cache version(s) |
| spartan_cache_rebuild | Rebuild the cache from the live site |
| spartan_cache_switch_version | Switch the active cache version |
| spartan_cache_list_versions | List cached versions |
Resources (4)
spartan://components/listspartan://component/{name}/apispartan://component/{name}/examplesspartan://component/{name}/full
Prompts (5)
spartan-get-startedspartan-compare-apisspartan-implement-featurespartan-troubleshootspartan-list-components
Example tool calls
// List all known components
{ "tool": "spartan_components_list" }
// Fetch the accordion's structured API data
{ "tool": "spartan_components_get", "name": "accordion", "extract": "api" }
// Fetch a docs topic and extract its headings
{ "tool": "spartan_docs_get", "topic": "cli", "extract": "headings" }
// Fetch a block as plain text
{ "tool": "spartan_blocks_get", "name": "sidebar", "format": "text" }
// Analyze a component's dependencies
{ "tool": "spartan_components_dependencies", "componentName": "dialog" }
// Check docs-site availability
{ "tool": "spartan_health_check", "topics": ["installation", "cli"] }Configuration
Environment variables:
| Variable | Default | Description |
| ------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------- |
| SPARTAN_MCP_CACHE_DIR | $XDG_CACHE_HOME/spartan-mcp or ~/.cache/spartan-mcp | Directory for the on-disk version cache. Override to use a custom location. |
| SPARTAN_CACHE_TTL_MS | 300000 (5 min) | TTL for the in-memory fetch cache. |
| SPARTAN_CACHE_TTL_HOURS | 24 | TTL for on-disk cached entries before they are considered stale. |
Notes
- Data source: all content is fetched from public pages at spartan.ng; responses include source URLs.
- Input validation: all tool inputs are validated with Zod schemas.
- Versions: cached data is stored per Spartan UI version under
cache/{version}/; passspartanVersionto component/block/docs tools or usespartan_cache_switch_version.
Development
This library was generated with Nx.
- Build:
nx build mcp - Test:
nx test mcp - Lint:
nx lint mcp
Documentation
Community
License
MIT © goetzrobin and the spartan contributors
