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 🙏

© 2025 – Pkg Stats / Ryan Hefner

fabric-mcp

v0.1.4

Published

MCP server for Fabric/Yarn/Mixins built with TypeScript

Downloads

511

Readme

Fabric MCP Server

Model Context Protocol (MCP) server dla Minecraft Fabric modding — asystent AI z pełną wiedzą o Yarn mappings, Fabric API i Mixinach.

Funkcje

  • 🔍 Analiza kodu — wykrywa błędy w kodzie Fabric (named mappings w reflection, brakujący @Environment, deprecated API)
  • 🗺️ Yarn mappings — konwersja między official ↔ intermediary ↔ named namespace'ami
  • 🔧 Walidacja Mixinów — sprawdza poprawność @Inject, @At selectors, CallbackInfo
  • 📚 Javadoc — dostęp do dokumentacji Yarn i Fabric API
  • 📖 Fabric docs — oficjalne tutoriale jako MCP resources
  • 💡 Prompty — gotowe system prompts dla AI

Instalacja

Lokalna (development)

# Clone repository
git clone https://github.com/rafalohaki/fabric-mcp.git
cd fabric-mcp

# Instaluj dependencies
npm install

# Build
npm run build

# Test
npm test

NPM (po publikacji)

npm i fabric-mcp -g

Konfiguracja

Claude Desktop

Edytuj config: %APPDATA%/Claude/claude_desktop_config.json (Windows) lub ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)

{
  "mcpServers": {
    "fabric-mcp": {
      "command": "node",
      "args": [
        "C:/sciezka/do/fabric-mcp/dist/index.js"
      ]
    }
  }
}

Lub po publikacji na NPM:

{
  "mcpServers": {
    "fabric-mcp": {
      "command": "npx",
      "args": ["-y", "fabric-mcp"]
    }
  }
}

Cursor / VSCode z Copilot

Dodaj do .vscode/settings.json:

{
  "github.copilot.chat.mcp.servers": {
    "fabric-mcp": {
      "command": "node",
      "args": ["path/to/fabric-mcp/dist/index.js"]
    }
  }
}

Użycie

1. Analiza kodu Fabric

Prompt dla AI:

Sprawdź ten kod Fabric dla MC 1.21.10:

public class PlayerMixin {
  public void badCode() {
    Field f = PlayerEntity.class.getDeclaredField("inventory");
    MinecraftClient.getInstance().player.sendMessage(Text.of("test"));
  }
}

Odpowiedź AI (używa tool analyze_fabric_code):

  • ❌ Błędy: Reflection z Named mapping "inventory" — nie zadziała w produkcji!
    • 💡 Fix: Użyj intermediary: "field_7514" lub MappingResolver
  • ⚠️ Ostrzeżenia: Używasz MinecraftClient bez @Environment(EnvType.CLIENT)
    • 💡 Fix: Dodaj @Environment(EnvType.CLIENT) do klasy/metody

2. Wyszukiwanie mappings

Prompt:

Znajdź Yarn mapping dla PlayerEntity.inventory w MC 1.21.10

AI używa get_yarn_mapping:

| Namespace | Name | |-----------|------| | Named (Yarn) | inventory | | Intermediary | field_7514 | | Official (obf) | h |

Descriptor: Lnet/minecraft/inventory/Inventory;
Parent: net/minecraft/entity/player/PlayerEntity

3. Walidacja Mixinów

Prompt:

Sprawdź czy ten Mixin jest poprawny:

@Mixin(PlayerEntity.class)
public class PlayerMixin {
  @Inject(method = "tick", at = @At("INVOKE"))
  private void onTick() {
    System.out.println("Tick!");
  }
}

AI używa validate_mixin:

  • ❌ @At("INVOKE") wymaga target = "..."
  • ❌ @Inject handler musi mieć parametr CallbackInfo/CallbackInfoReturnable

4. Dostęp do Javadoc

Prompt:

Pokaż dokumentację dla net.minecraft.entity.player.PlayerEntity

AI używa get_javadoc:

  • Zwraca opis z Javadoc lub komunikat o braku dokumentacji

Dostępne Tools

| Tool | Opis | Parametry | |------|------|-----------| | analyze_fabric_code | Analizuje kod Java pod kątem błędów Fabric | code, mcVersion, checkMixins | | get_yarn_mapping | Wyszukuje i konwertuje mappings | query, mcVersion, searchType | | validate_mixin | Waliduje kod Mixin | code, mcVersion | | get_javadoc | Pobiera dokumentację klasy | className, mcVersion |

Resources

| URI | Opis | |-----|------| | fabric://docs/tutorial/items | Tutorial: Custom Items | | fabric://docs/mixin/introduction | Wprowadzenie do Mixinów | | fabric://docs/tutorial/blocks | Tutorial: Custom Blocks |

Prompts

| Prompt | Opis | Argumenty | |--------|------|-----------| | fabric_developer | System prompt dla AI asystenta Fabric | mcVersion (optional) |

Development

# Watch (jeśli dodasz w przyszłości)
# npm run dev

# Testy
npm test
npm run test:watch
npm run test:coverage

# Lint / type-check
npm run lint
npm run type-check

# Build
npm run build

Troubleshooting

  • Tool not found — sprawdź ścieżkę w config, zrestartuj klienta.
  • Cannot find module — uruchom npm run build ponownie.
  • Mappings not found for MC X.X — sprawdź, czy wersja istnieje na Maven (yarn).
  • Server nie startujenpm run type-check i npm test po kolei.

Roadmap (v1.1+)

  • check_deprecated — detekcja deprecated API
  • get_migration_guide — diff mappings między wersjami
  • Resources dla ASM
  • Pattern templates (snippety kodu)
  • SQLite cache dla mappings
  • Multi-version comparison (1.20 → 1.21)

Technologie

  • MCP SDK 0.5+
  • TypeScript 5.3+
  • Vitest 1.0+
  • Fabric API (Yarn mappings)

Licencja

MIT License — patrz LICENSE

Contributing

Pull requests mile widziane! Sprawdź CONTRIBUTING.md przed wysłaniem PR.

Credits

Contact

  • Issues: https://github.com/rafalohaki/fabric-mcp/issues
  • Discord: (link do serwera)
  • Email: [email protected]

⭐ Star this repo jeśli pomaga w Fabric moddingu!