npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@terreno/mcp

v0.22.2

Published

MCP server for Terreno - provides documentation, tools, and prompts for building full-stack apps

Downloads

512

Readme

@terreno/mcp

MCP (Model Context Protocol) server for Terreno. Provides documentation, tools, and prompts for building full-stack applications with Terreno packages.

Features

Resources

Documentation resources accessible via MCP:

  • terreno://docs/overview - Overview of the Terreno monorepo
  • terreno://docs/api - @terreno/api documentation
  • terreno://docs/ui - @terreno/ui documentation
  • terreno://docs/rtk - @terreno/rtk documentation
  • terreno://docs/patterns - Common patterns and best practices

Tools

Code generation tools:

  • terreno_bootstrap_app - Scaffold a new full-stack Terreno app (frontend, backend, rules, MCP)
  • terreno_bootstrap_ai_rules - Scaffold AI assistant rules files for Cursor, Claude Code, etc.
  • terreno_generate_model - Generate a Mongoose model with proper Terreno conventions
  • terreno_generate_route - Generate a modelRouter route configuration
  • terreno_generate_screen - Generate a React Native screen component
  • terreno_generate_form_fields - Generate form field components
  • terreno_validate_model_schema - Validate a Mongoose schema follows conventions
  • terreno_install_admin - Generate admin panel integration files and instructions

Prompts

Code generation prompts:

  • terreno_bootstrap - Prompt workflow for scaffolding a new Terreno application
  • terreno_create_crud_feature - Generate complete CRUD feature (model, routes, screens)
  • terreno_create_api_endpoint - Generate custom API endpoint with OpenAPI docs
  • terreno_create_ui_component - Generate reusable UI component
  • terreno_create_form_screen - Generate form screen with validation
  • terreno_add_authentication - Generate authentication setup
  • terreno_migrate_to_terreno_app - Migrate from setupServer to TerrenoApp pattern
  • terreno_style_guide - Get the Terreno code style guide

Installation

# From the monorepo root
bun install
bun run mcp:build

Usage

With Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "terreno": {
      "command": "bun",
      "args": ["/path/to/terreno/mcp-server/dist/index.js"]
    }
  }
}

With Claude Code CLI

Add to your project's .claude/settings.json:

{
  "mcpServers": {
    "terreno": {
      "command": "bun",
      "args": ["./mcp-server/dist/index.js"]
    }
  }
}

Development

# Build
bun run build

# Watch mode
bun run dev

# Start server
bun run start

# Run tests
bun run test

# Lint
bun run lint

Docker

Build and run the MCP server in Docker:

# Build the image
docker build -t terreno-mcp-server ./mcp-server

# Run the container
docker run --rm terreno-mcp-server

CI/CD

The MCP server includes GitHub Actions workflows:

CI Workflow (.github/workflows/mcp-server-ci.yml)

  • Runs on every push/PR to mcp-server/**
  • Lints, builds, and tests the code
  • Builds Docker image to verify it works

Deploy Workflow (.github/workflows/mcp-server-deploy.yml)

  • Runs on push to master/main branch
  • Deploys to Google Cloud Run

Required GitHub Secrets for Deployment

Configure these secrets in your GitHub repository:

| Secret | Description | |--------|-------------| | GCP_PROJECT_ID | Your Google Cloud project ID | | GCP_WORKLOAD_IDENTITY_PROVIDER | Workload Identity Federation provider | | GCP_SERVICE_ACCOUNT | Service account email for deployment | | GCP_ARTIFACT_REGISTRY | Artifact Registry repository name |

Setting up GCP for Deployment

  1. Create an Artifact Registry repository:

    gcloud artifacts repositories create terreno \
      --repository-format=docker \
      --location=us-central1
  2. Set up Workload Identity Federation for GitHub Actions:

    # Create workload identity pool
    gcloud iam workload-identity-pools create "github" \
      --location="global" \
      --display-name="GitHub Actions"
    
    # Create provider
    gcloud iam workload-identity-pools providers create-oidc "github" \
      --location="global" \
      --workload-identity-pool="github" \
      --display-name="GitHub" \
      --attribute-mapping="google.subject=assertion.sub,attribute.actor=assertion.actor,attribute.repository=assertion.repository" \
      --issuer-uri="https://token.actions.githubusercontent.com"
  3. Grant permissions to the service account:

    # Cloud Run deployment
    gcloud projects add-iam-policy-binding PROJECT_ID \
      --member="serviceAccount:SA_EMAIL" \
      --role="roles/run.admin"
    
    # Artifact Registry push
    gcloud artifacts repositories add-iam-policy-binding terreno \
      --location=us-central1 \
      --member="serviceAccount:SA_EMAIL" \
      --role="roles/artifactregistry.writer"

How Tools Work

Important: MCP tools return generated code as text content. They do not create files directly. When using these tools with an AI assistant (like Claude in Cursor), the assistant should:

  1. Call the appropriate tool to generate code
  2. Take the returned code text and write it to the appropriate file in your project
  3. Follow up with any necessary steps (registering routes, regenerating SDK, etc.)

This design allows the AI assistant to:

  • Review and adapt the generated code to your project structure
  • Make any necessary modifications before writing
  • Handle file paths based on your project's conventions

Example Tool Usage

Generate a Model

{
  "name": "terreno_generate_model",
  "arguments": {
    "name": "Product",
    "fields": [
      { "name": "title", "type": "String", "required": true },
      { "name": "price", "type": "Number", "required": true },
      { "name": "active", "type": "Boolean", "default": "true" }
    ],
    "hasOwner": true,
    "softDelete": true
  }
}

The tool returns TypeScript code that should be written to backend/src/models/product.ts (or your project's model directory).

Generate a Route

{
  "name": "terreno_generate_route",
  "arguments": {
    "modelName": "Product",
    "routePath": "/products",
    "permissions": {
      "create": "authenticated",
      "list": "any",
      "read": "any",
      "update": "owner",
      "delete": "admin"
    },
    "queryFields": ["active", "category"],
    "ownerFiltered": true,
    "sort": "-created"
  }
}

The tool returns route configuration code that should be written to backend/src/api/product.ts, then exported from backend/src/api/index.ts and registered in your server setup.

Generate a Screen

{
  "name": "terreno_generate_screen",
  "arguments": {
    "name": "ProductList",
    "type": "list",
    "modelName": "Product",
    "fields": ["title", "price"]
  }
}

The tool returns React Native screen code that should be written to frontend/src/screens/ProductListScreen.tsx (or your project's screen directory).

Example Prompt Usage

Create CRUD Feature

Prompt: terreno_create_crud_feature
Arguments:
  - name: "Product"
  - fields: "title:string,price:number,description:string,active:boolean"
  - hasOwner: "yes"

This will generate a comprehensive prompt with instructions for creating:

  • Backend model with proper schema
  • API routes with permissions
  • Frontend list, detail, and form screens