MCP Server

Give your AI assistant first-class access to spartan UI documentation, components, and blocks.

@spartan-ng/mcp is a Model Context Protocol server that exposes the spartan ecosystem as tools, resources, and prompts. MCP clients such as Claude Desktop, Cursor, and other AI assistants can use it to answer questions about spartan components with up-to-date API tables and code examples, fetched live from spartan.ng and cached on disk per version.

Setup

Add the server to your MCP client configuration. No installation is required - it runs on demand via npx :

{
	"mcpServers": {
		"spartan-ui": {
			"command": "npx",
			"args": ["-y", "@spartan-ng/mcp"]
		}
	}
}

Prefer a global install? Install the package and point the command at the binary:

npm install -g @spartan-ng/mcp

{
	"mcpServers": {
		"spartan-ui": {
			"command": "spartan-mcp"
		}
	}
}

Tools

The server registers 17 tools, grouped by purpose:

  • Components:spartan_components_list , spartan_components_get (with extract: 'code' | 'api' ), spartan_components_dependencies , and spartan_accessibility_check .
  • Blocks:spartan_blocks_list , spartan_blocks_get , and spartan_blocks_dependencies .
  • Docs:spartan_docs_get and spartan_meta .
  • Health:spartan_health_check , spartan_health_instructions , and spartan_health_command .
  • Cache:spartan_cache_status , spartan_cache_clear , spartan_cache_rebuild , spartan_cache_switch_version , and spartan_cache_list_versions .

Resources and prompts

Beyond tools, the server exposes resources for direct component lookups and prompts for common workflows.

  • Resources:spartan://components/list and per-component spartan://component/{name}/api , /examples , and /full .
  • Prompts:spartan-get-started , spartan-compare-apis , spartan-implement-feature , spartan-troubleshoot , and spartan-list-components .

Configuration

Behaviour can be tuned with environment variables:

  • SPARTAN_MCP_CACHE_DIR - directory for the on-disk version cache. Defaults to $XDG_CACHE_HOME/spartan-mcp , falling back to ~/.cache/spartan-mcp .
  • SPARTAN_CACHE_TTL_MS - TTL for the in-memory fetch cache (default 5 minutes).
  • SPARTAN_CACHE_TTL_HOURS - TTL before on-disk cached entries are considered stale (default 24 hours).
Skills Update Guide