Skip to main content
Glama

@stencil/mcp

A Model Context Protocol server that gives AI coding agents accurate, version-aware knowledge of a StencilJS project.

Proof-of-concept for stenciljs/core#6518.

Why

AI agents frequently suggest non-idiomatic Stencil code — e.g. manually adding a window.addEventListener in componentWillLoad instead of using the built-in @Listen() decorator, or mutating a @Prop. This server exposes Stencil's real API surface and best practices to the agent so it can self-correct, and tells it which Stencil version the project is actually running.

Related MCP server: Components Build MCP

Tools

Tool

Purpose

detect_stencil_version

Resolves the version from node_modules/@stencil/core (authoritative) and the declared range in package.json.

get_decorator_reference

Signatures, idiomatic examples, and anti-patterns for @Component, @Prop, @State, @Watch, @Event, @Listen, @Method, @Element, @AttachInternals.

get_lifecycle_reference

The component lifecycle hooks and when each fires.

get_best_practices

Concrete "wrong vs right" rules so agents use built-in Stencil features.

All reference content is sourced from Stencil's own public runtime type declarations, so it matches the framework rather than guessing.

Usage

npm install && npm run build

Register with an MCP-capable client (Claude Desktop, Cursor, VS Code, etc.):

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

Develop

npm run build      # compile TypeScript
npm test           # unit tests (node:test)
node test/smoke.mjs # end-to-end MCP stdio test

License

MIT

Available Tools

4 tools
detect_stencil_versionA

Detect the StencilJS version a project is actually using so suggestions match the installed framework. Reads node_modules/@stencil/core and package.json.

Inputs: projectRoot.

get_best_practicesA

Get idiomatic StencilJS best practices as concrete "wrong vs right" rules, so AI suggestions use built-in Stencil features instead of manual workarounds.

Inputs: id.

get_decorator_referenceA

Get accurate reference for StencilJS decorators (@Component, @Prop, @State, @Watch, @Event, @Listen, @Method, @Element, @AttachInternals), including signatures, idiomatic examples, and anti-patterns to avoid.

Inputs: name.

get_lifecycle_referenceA

Get the StencilJS component lifecycle methods (componentWillLoad, componentDidLoad, render, etc.) with when each fires.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: version detection, decorator reference, lifecycle reference, and best practices. There is no overlap or ambiguity among the four tools.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern using snake_case: detect_stencil_version, get_decorator_reference, get_lifecycle_reference, get_best_practices. Naming is predictable and uniform.

    Tool Count5/5

    With only 4 tools, the server is well-scoped for a focused reference utility. Each tool earns its place, and the count is neither too sparse nor overwhelming.

    Completeness4/5

    The server covers the core StencilJS reference needs: version, decorators, lifecycle, and best practices. Minor gaps exist like Stencil config or testing references, but the essential surface is well covered.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers