CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a Deno workspace containing two packages:
- @wyattjoh/jsr - A TypeScript client library for the JSR (JavaScript Registry) API
- @wyattjoh/jsr-mcp - A Model Context Protocol (MCP) server that exposes JSR functionality to AI assistants
The workspace structure follows Deno best practices with separate packages that can be independently published to JSR.
Workspace Structure
/
โโโ deno.json # Workspace configuration
โโโ packages/
โ โโโ jsr/ # JSR client library package
โ โ โโโ deno.json # Package configuration
โ โ โโโ mod.ts # Main exports
โ โ โโโ src/
โ โ โ โโโ client.ts # JSR API client implementation
โ โ โ โโโ types.ts # TypeScript types and Zod schemas
โ โ โโโ tests/
โ โ โโโ client.test.ts
โ โโโ jsr-mcp/ # MCP server package
โ โโโ deno.json # Package configuration
โ โโโ mod.ts # Main entry point
โ โโโ src/
โ โ โโโ index.ts # MCP server implementation with inline tool definitions
โ โโโ tests/
โ โโโ server.test.ts
Development Commands
Workspace-level commands (run from root):
- Format all code:
deno fmt - Lint all code:
deno lint - Type check all code:
deno check packages/jsr/mod.ts packages/jsr-mcp/mod.ts - Run all tests:
deno test --allow-net packages/ - Run a single test file:
deno test --allow-net packages/jsr/tests/client.test.ts - Run development server:
deno run --allow-read --allow-write --allow-env --allow-run --allow-net --watch packages/jsr-mcp/mod.ts - Run production server:
deno run --allow-read --allow-write --allow-env --allow-run --allow-net packages/jsr-mcp/mod.ts - Build MCP server binary:
cd packages/jsr-mcp && deno compile --allow-read --allow-write --allow-env --allow-run --allow-net --output=jsr-mcp mod.ts
Git hooks (managed via deno-task-hooks):
- Install hooks:
deno task hooks:install - Pre-commit: Runs
deno check,deno fmt --check, anddeno lint - Pre-push: Runs
deno publish --dry-run --allow-dirty
Architecture
JSR Client Package (packages/jsr/)
- Purpose: Reusable TypeScript client for the JSR API
- Main exports:
mod.tsexports all client functions and types - Dependencies: Only
zodfor schema validation - Can be used independently of the MCP server
- Testing: Uses
jsr:@std/assertfor assertions
MCP Server Package (packages/jsr-mcp/)
- Purpose: MCP server that exposes JSR functionality to AI assistants
- Dependencies:
- Local:
@wyattjoh/jsr(the client package, imported via relative path) - External:
@modelcontextprotocol/sdk,@std/dotenv,zod
- Local:
- Pattern: Uses inline
server.tool()calls for MCP tool definitions - Configuration: Via environment variables (JSR_API_URL, JSR_REGISTRY_URL, JSR_API_TOKEN)
Key Design Patterns
- Workspace imports: The MCP server imports the JSR client using a relative path configured in workspace root
- Type safety: All API interactions use Zod schemas for validation
- Error handling: Consistent error wrapping and reporting
- Testing: Each package has its own test suite using Deno's built-in test runner
- MCP tools: Defined inline using
server.tool()with Zod schemas that mirror the JSR client types
Repository Management
- Always run
deno fmt,deno lint, anddeno check packages/jsr/mod.ts packages/jsr-mcp/mod.tsafter modifying code - Run
deno test --allow-net packages/to verify all tests pass - When updating tool definitions in the MCP server, ensure schemas match the JSR client types
- The JSR client package can be published independently to JSR for reuse in other projects
Publishing
Each package can be published separately to JSR:
packages/jsr/as@wyattjoh/jsrpackages/jsr-mcp/as@wyattjoh/jsr-mcp
Both packages include their own LICENSE file and are configured for JSR publishing via deno publish.