Integrations › MCP

DevSnips MCP

Access DevSnips resources directly from your AI coding agent. Read-only, stdio-based, and a thin consumer of the same canonical registry the CLI uses.

pip install devsnips-mcp
GitHub

At a Glance


  • Install: pip install devsnips-mcp
  • Transport: stdio — launched as a subprocess by the client
  • Registry: snippets-index.json + library/
  • Tools: search_resources, get_resource, get_resource_file, list_facets
  • Local mode: DEVSNIPS_MCP_SOURCE=/path/to/DevSnips
  • Guarantee: strictly read-only — no writes, no network, no arbitrary URLs

Installation


Two supported install paths. Both run the same read-only stdio server and read the same snippets-index.json registry and library/ tree as the CLI — the MCP never creates a second database.

1. From PyPI (recommended)

terminal
$pip install devsnips-mcp

2. From the DevSnips repository

Useful if you want to pin to a commit, patch the server, or run entirely from a local checkout without publishing a package.

terminal
$pip install 'devsnips-mcp @ git+https://github.com/sarthakbystander/DevSnips.git#subdirectory=integrations/mcp'

Requires Python 3.10+. Package source lives at integrations/mcp.

Tools


The MCP server exposes exactly four tools. Call them in this order for best results:

  • Plan — list_facets answers "what does DevSnips actually contain?"
  • Search — search_resources answers "which resources match this query?"
  • Inspect — get_resource answers "what does this resource include?"
  • Read — get_resource_file answers "show me the code, one file at a time."

Search supports both exact and fuzzy modes and matches across name, description, tags and family. When a query matches nothing, the server retries with spelling variants and prefix matching instead of returning an empty page.

Discover resources by keyword, technology, type and pagination.

signature.py
def search_resources(
    query: str,
    technology: str | None = None,
    type: str | None = None,
    family: str | None = None,
    limit: int = 10,
) -> str
technology
e.g. tailwind, react, vanilla
type
components | sections | templates
family
e.g. accordions, login, pricing
limit
Max results per call, 1-50. Default 10.
request.json
{
  "query": "pricing section",
  "technology": "react",
  "limit": 5
}
response.json
{
  "mode": "exact",
  "items": [/* ... */],
  "total_matches": 12
}

get_resource

Metadata, README, template AGENTS.md, and a file manifest for one resource.

signature.py
def get_resource(
    id: str,
    include: list[str] | None = None,
    maxBytes: int | None = None,
) -> str
id
e.g. Tailwind/Components/Accordions/basic-accordion
include
metadata, readme, agents, files, family — default returns the manifest.
maxBytes
Truncate inline README / AGENTS content to this size.
request.json
{
  "id": "Tailwind/Components/Accordions/basic-accordion"
}

get_resource_file

One allowlisted source or doc file from a resource. Paths outside the resource's manifest are rejected.

signature.py
def get_resource_file(
    id: str,
    file: str,
    maxBytes: int | None = None,
    truncate: bool = False,
) -> str
id
Resource ID from search_resources or get_resource.
file
Relative path from the manifest, e.g. src/Accordion.tsx or AGENTS.md.
maxBytes
Hard cap on returned bytes. Falls back to DEVSNIPS_MCP_MAX_BYTES.
truncate
When true, returns the truncated body and a truncated: true flag instead of an error.

list_facets

Current inventory — technologies, types, categories, families with counts.

signature.py
def list_facets(
    facet: str | None = None,
    technology: str | None = None,
    includeVariants: bool = False,
) -> str
facet
technologies | types | categories | families
technology
Narrow counts to one technology.
includeVariants
Include per-variant counts where a family defines variants.

Resources


The MCP exposes the same three resource types as the DevSnips library:

  • Components — buttons, forms, cards, navigation.
  • Sections — product, marketing and page sections.
  • Templates — complete starting points; fetch page by page with get_resource_file.

Browse the library →

Connect your agent


DevSnips MCP runs over stdio — clients launch it as a subprocess with the same shape. Pick the tab that matches your editor.

claude_desktop_config.json
{
  "mcpServers": {
    "devsnips": {
      "command": "devsnips-mcp",
      "args": []
    }
  }
}

Providers, Caching and Security


The server is intentionally constrained. Every guarantee below is enforced in code, not convention — the agent cannot ask it to do more than read.

Read-only guarantee

  • No tool writes to the library, registry, or filesystem.
  • No network fetches — all content is served from the on-disk registry.
  • No arbitrary URL or path arguments are accepted by any tool.

Path gates

Every id and file is resolved through the registry and clamped to the library/ tree. Requests that escape the root, use .., or reference files outside the resource manifest are rejected with structured errors.

Caching

The registry is loaded once per process and cached in memory. get_resource_file results are memoised per session keyed on id + file + maxBytes. Disable with DEVSNIPS_MCP_CACHE=0 when developing against a live registry.

Structured errors

error.json
{
  "ok": false,
  "error": {
    "code": "PATH_OUT_OF_SCOPE",
    "message": "File is not in the resource manifest."
  }
}

Exceptions never cross the transport.

Local mode

Point the server at a local checkout or a custom registry path with DEVSNIPS_MCP_SOURCE. Useful when you maintain your own snippets next to the DevSnips library.

environment
DEVSNIPS_MCP_SOURCE=/path/to/DevSnips

Configuration


All settings are environment variables. Defaults are tuned for the public DevSnips registry.

DEVSNIPS_MCP_SOURCE
Path to a local DevSnips checkout or custom registry. Overrides the bundled registry.
DEVSNIPS_MCP_CACHE
1 | 0 — enable in-memory caching. Default 1.
DEVSNIPS_MCP_CACHE_TTL
Cache TTL in seconds. Default 300.
DEVSNIPS_MCP_MAX_BYTES
Default max bytes per returned file. Default 65536.
DEVSNIPS_MCP_LOG_LEVEL
debug | info | warn | error. Default info.

How it works


  1. DevSnips Library
  2. Resource Registry — snippets-index.json
  3. DevSnips MCP
  4. AI Coding Agent

MCP exposes the existing DevSnips library to the agent rather than generating a separate library. Supported registry schema is 2.0; v1 is strictly read-only.

Package


package
devsnips-mcp
version
0.1.0
license
MIT
requires
Python ≥ 3.10
GitHub
integrations/mcp
PyPI
pypi.org/project/devsnips-mcp

Documentation


Read the full MCP documentation →

DevSnips MCP


terminal
$pip install devsnips-mcp