shadcn-svelte-mcp
Copilot instructions58 starsChanged 58 days agoMITView on GitHub
This file gives concise, actionable instructions for an AI coding agent to be productive in this codebase. Important: AI-generated/progress documentation and ephemeral notes Shell command preference
- Sends data out
In this repositoryOne other file it gives its agents.
The file
We split this copilot-instructions.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
All AI-generated progress docs, status logs, design notes, or autogenerated markdown should be created or updated only inside the …
- Distinctive: line 26
When moving or manipulating files as part of progress updates, prefer Git-aware operations (for example git mv) so history is preserved.
- Very specific: line 30
When suggesting or running commands, prefer POSIX bash commands.
- Very specific: line 49
Test file organization: ALWAYS place test files in the test/ directory at the repository root, never in src/.
- Very specific: line 84
No database. Cache persistence is optional: in-memory plus disk (./.cache) on Node/Bun.
- Very specific: line 88
If a tool returns "not found", check the web scraping services in src/services/ and verify the component exists on shadcn-svelte.com.
- Very specific: line 89
Verify protocol behavior with curl: curl -X POST http://localhost:3000/mcp -H "Content-Type: application/json" -H "Accept: …
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- .github/copilot-instructions.md - guidance for AI coding agents -->AI assistant quick-start for this repository
This file gives concise, actionable instructions for an AI coding agent to be productive in this codebase.
- What this repo is
- A tmcp-based MCP server (lightweight, schema-agnostic MCP SDK). See
src/mcp/server.tsfor theMcpServerassembly,src/index.tsfor the Node/Bun HTTP entry, andsrc/stdio.tsfor local MCP clients. - Documentation is fetched in real-time from shadcn-svelte.com using Cheerio + Turndown (HTML → Markdown) and direct
.md/llms.txtendpoint fetching undersrc/services/.
- How to run / common developer commands
- Runtimes: Node >= 20.9.0 or Bun >= 1.1 (see
package.json"engines"). - Development:
bun run dev(HTTP server with watch on http://localhost:3000, MCP endpoint/mcp, health/health). - Type checking:
bun run check(runstsc --noEmitacross the project). - Local MCP:
bun run mcp(stdio transport). - Build:
bun run build(bundlessrc/index.ts+src/stdio.ts→dist/for Fly.io/Render). - Agent sync guard:
bun run check:agents(fails if the per-editor agent bodies inagents/drift apart;agents-md-snippet.mdis a declared variant). - Version guard:
bun run check-versions(package.jsonmust matchsrc/mcp/server.ts). - CI:
.github/workflows/ci.ymlrunscheck,check:agents,check-versions,bun test, and a report-only link check on every push and pull request. Onlybun.lockexists, so CI usesbun install --frozen-lockfile—npm cicannot work in this repo.
Important: AI-generated/progress documentation and ephemeral notes
- All AI-generated progress docs, status logs, design notes, or autogenerated markdown should be created or updated only inside the
ai-generated-docs/folder at the repository root. Do not place generated progress docs in other directories. - When moving or manipulating files as part of progress updates, prefer Git-aware operations (for example
git mv) so history is preserved.
Shell command preference
- When suggesting or running commands, prefer POSIX
bashcommands. Provide exact, copyable bash snippets and usegitfor VCS operations. Wrap examples in bash code blocks and avoid platform-specific shells unless requested.
- Big-picture architecture (quick map)
- MCP Server (
src/mcp/server.ts): exportsserver(tmcpMcpServer) andserverVersion. Registers 5 tools + 5 prompts, uses the Valibot adapter (@tmcp/adapter-valibot) — all schemas are valibot. - Entry points:
src/index.ts— srvx HTTP server (Node/Bun): Streamable HTTP at/mcp,/healthendpoint.src/stdio.ts—StdioTransportfor local MCP clients.
- Tools (
src/mcp/tools/*): each is created withdefineTool(...)fromtmcp/tooland follows the pattern: valibotschema,async (input) => tool.text(...) | tool.error(...). Examples:shadcn-svelte-get,shadcn-svelte-list,shadcn-svelte-icons,shadcn-svelte-search,bits-ui-get. - Prompts (
src/mcp/prompts/*): created withdefinePrompt(...)fromtmcp/prompt, valibotschema, return{ messages: [...] }. - Web scraping services:
src/services/doc-fetcher.ts(real-time doc fetching),src/services/catalog.ts(unified live catalog:llms.txtcategories + descriptions merged with thecomponent-discovery.tsregistry index andbits-ui-discovery.ts),src/services/catalog-search.ts(pure multi-term search core used by the search tool),src/services/cache-manager.ts(memory + optional KV + optional disk tiers, 3-day TTL).
- Project-specific conventions and gotchas (do not invent alternatives)
- Tools use
defineToolfromtmcp/toolwith valibot schemas (import * as v from "valibot") for input validation. Usev.object({...}),v.string(),v.number(),v.picklist([...])for string literals,v.optional(schema, default)for optional-with-default, andv.pipe(schema, v.description("..."))for field descriptions. Tool handlers MUST return content viatool.text(...)/tool.error(...)fromtmcp/utils— never a bare string. - Prompts use
definePromptfromtmcp/promptwith the same valibot schema conventions and return{ messages: [...] }(role: "user" | "assistant",content: { type: "text", text }). - The version anchor:
version: "x.y.z"insrc/mcp/server.tsMUST stay in sync withpackage.json(seescripts/check-versions.js/sync-versions*.js; regex isversion:\s*"[^"]+",). - Web scraping approach: tools fetch documentation in real-time from shadcn-svelte.com (
.mdendpoints,llms.txt, Cheerio+Turndown HTML fallback). Components are discovered dynamically from the live website. - The cache manager loads
node:fsdynamically so it stays loadable on runtimes without it, degrading to memory-only. Do not add staticnode:*imports to shared services. - Test file organization: ALWAYS place test files in the
test/directory at the repository root, never insrc/. Usegit mvwhen moving files to preserve version history.
Testing rule: run bun test before reporting any change as done. It is fast (well under a second), network-free, and the only objective evidence that a change works. An AI agent that reports "done", "fixed", or "tests pass" without having run it in this session is wrong — and if a test fails, fix the cause rather than the expectation. Where behaviour cannot be pinned by a unit test (live scraping, MCP tool calls), validate through the MCP testing channel #test-mcp instead, which exercises the tools through the real protocol. Do NOT start or run bun run dev from within AI tests — the development server is expected to already be running. If a local manual smoke-test is required by a developer, run bun run dev locally for 10–15s, but AI agents must not start it.
Caching: tools use the shared cache-manager (3-day TTL; memory + .cache/ disk on Node/Bun). Expect stale cached results when iterating; clear .cache/ or restart the process during development if necessary.
- Common edit patterns and examples (concrete references)
To add a new tool, mirror src/mcp/tools/shadcn-svelte-get.ts:
import { defineTool } from "tmcp/tool";
import { tool } from "tmcp/utils";
import * as v from "valibot";
export const myTool = defineTool(
{
name: "my-tool",
description: "What it does",
schema: v.object({
param: v.pipe(v.string(), v.description("What param is")),
}),
},
async ({ param }) => tool.text(`Received: ${param}`),
);Then register it in src/mcp/server.ts via server.tools([...]). Prompts follow the same shape with definePrompt + server.prompts([...]).
- To examine how components are discovered and searched, inspect
src/services/catalog.ts(search/list catalog) andsrc/services/catalog-search.ts(ranking); for doc fetching, inspectsrc/mcp/tools/shadcn-svelte-get.ts. - To test changes quickly: run
bun test, then use the#test-mcpMCP channel for anything that needs live tools. Do not startbun run devfrom AI-driven runs.
- Integration & external deps
- Key runtime deps (see
package.json): tmcp, @tmcp/adapter-valibot, @tmcp/transport-http, @tmcp/transport-stdio, valibot, srvx, cheerio, turndown, @orama/orama. Respect the pinned major versions when adding features unless requested. - No database. Cache persistence is optional: in-memory plus disk (
./.cache) on Node/Bun.
- Debugging tips for AI agents
- If a tool returns "not found", check the web scraping services in
src/services/and verify the component exists on shadcn-svelte.com. - Verify protocol behavior with curl:
curl -X POST http://localhost:3000/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'. - For runtime discovery iterate: change code and run
bun run devfor 10–15s to surface issues; focus on reproducing the failing scenario in that window.
- What not to change without confirmation
- The
McpServerassembly insrc/mcp/server.ts(server info, adapter, capabilities) — changes affect all transports. - The registry format and field names used by tools (
items[].name,items[].files[].path,items[].type). - The version-sync tooling (
.releaserc.json,.github/workflows/version-and-release.yml,scripts/sync-versions*.js) — they anchor onsrc/mcp/server.ts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

