Skip to main content
Glama
double2dev

stitchmath-mcp

🧢 StitchMath Core (stitchmath-core)

Official Website License: MIT TypeScript Ready

Product Hunt    Approved on SaaSHub


StitchMath Core is the open-source mathematical calculation engine and standardized dataset repository by StitchMath.com. Built for developers, designers, and craft bloggers, this library eliminates guesswork in knitting and crochet by providing robust algorithms for gauge sizing, even row decreases, yarn WPI classification, and international needle size conversions.

IMPORTANT

🌟 Need the Full Interactive Web Suite & AI Assistant?
This repository contains our lightweight algorithmic SDK and public datasets. For the complete visual experienceβ€”including 20+ interactive calculators, our custom Sweater Pattern Generator, and the AI Pattern Assistantβ€”visit the official web application at https://stitchmath.com.


πŸ†š Open-Source SDK vs. StitchMath.com Platform

Feature

stitchmath-core (This Repo)

StitchMath.com Official Platform

Core Math Algorithms (JS/TS SDK)

βœ… Yes (Raw Functions)

βœ… Yes (Visual & Interactive)

Standardized JSON Datasets

βœ… Yes (Needles, Yarn WPI, Blankets)

βœ… Yes (Interactive Tables)

20+ Visual Web Calculators

❌

βœ… Yes (Gauge, Socks, Sleeves, etc.)

AI Pattern Assistant

❌

βœ… Yes (Instant AI Fitment Solving)

Custom Sweater Pattern Generator

❌

βœ… Yes (Dynamic Garment Sizing)

Printable Guides & Swatch Tutorials

❌

βœ… Yes (Comprehensive Reference Hub)

πŸ‘‰ Experience all interactive tools for free on StitchMath.com β†’


Related MCP server: rundida-mcp

πŸ“¦ Features & Datasets

  • πŸ“ Gauge Conversion Algorithm: Adjust pattern stitch counts precisely based on actual swatch measurements.

  • βž• Increase & Decrease Spacing: Automatically calculate even stitch distribution and generate row work instructions (k2tog, m1).

  • βš–οΈ Curated JSON Datasets: Machine-readable, standardized JSON files for:

    • Needle Sizes (data/needle-sizes.json): Comprehensive US, UK/Canadian, and Metric (mm) conversions.

    • Yarn Weights & WPI (data/yarn-weights.json): Standard 0–6 classifications, Wraps Per Inch ranges, and UK/Aus Ply equivalents.

    • Standard Dimensions (data/blanket-sizes.json): Standard sizes for throws, baby blankets, scarves, and socks.

  • 🌐 Unit Agnostic: Seamless bidirectional conversion between US Imperial (in, oz, yd) and Metric (cm, g, m).

  • πŸ”· Full TypeScript Support: Bundled with comprehensive type declarations (src/index.d.ts).


πŸ€– Model Context Protocol (MCP) Server

StitchMath Core now includes a built-in MCP server, allowing AI assistants like Claude Desktop and Cursor to perform 100% accurate knitting math, gauge conversions, and sizing calculations directly within your chats.

Available AI Tools

The server exposes the following tools to LLMs:

  • calculate_gauge: Adjust stitch counts precisely based on actual swatch measurements.

  • calculate_even_spacing: Calculate evenly spaced increases or decreases across a row.

  • convert_needle_size: Convert between US, UK, and Metric needle sizes.

  • convert_units: Convert Imperial / Metric dimensions.

  • get_blanket_cast_on: Get recommended cast-on stitches for standard blanket sizes.

Installing in Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "stitchmath": {
      "command": "npx",
      "args": ["-y", "stitchmath-core"]
    }
  }
}

πŸš€ Quick Start (For Developers)

Installation

You can install stitchmath-core via npm or yarn into your Node.js, React, Vue, or React Native projects:

npm install stitchmath-core

Usage Examples

1. Calculate Gauge Adjustment

When a pattern calls for 20 stitches over 4 inches, but your actual swatch is 22 stitches over 4 inches:

const { calculateGauge } = require('stitchmath-core');

// How many stitches should you cast on for a 36-inch bust?
const castOnStitches = calculateGauge(22, 4, 36);
console.log(`Cast on ${castOnStitches} stitches`); // Output: Cast on 198 stitches

2. Calculate Even Decreases Across a Row

When shaping a sleeve or hat crown and you need to decrease 8 stitches evenly across 80 total stitches:

const { calculateEvenSpacing } = require('stitchmath-core');

const shaping = calculateEvenSpacing(80, 8, true); // true = decrease
console.log(shaping.instructions);
// Output: Work 9 sts, then [k2tog (or decrease), work 9 sts] across the row.

3. Lookup Needle Sizes & Conversions

const { convertNeedleSize } = require('stitchmath-core');

const sizeInfo = convertNeedleSize('8', 'us');
console.log(sizeInfo);
// Output: { mm: '5.0', us: '8', uk: '6' }

πŸ“Š Standardized JSON Datasets

You can import our curated industry datasets directly without importing the calculation functions:

// Import needle chart dataset directly
const needleChart = require('stitchmath-core/data/needle-sizes.json');

// Import yarn weight classifications and WPI standards
const yarnChart = require('stitchmath-core/data/yarn-weights.json');

// Import standard blanket and scarf dimensions
const blanketDimensions = require('stitchmath-core/data/blanket-sizes.json');

🌐 Embedding StitchMath on Your Blog or Website

Are you a craft blogger, pattern designer, or knitting tutorial author? We encourage you to reference and embed StitchMath in your articles!

To add a direct link or badge to the official calculation suite on your website, simply copy the following HTML snippet:

<!-- StitchMath Badge & Link -->
<a href="https://stitchmath.com" target="_blank" rel="noopener noreferrer" style="display:inline-block;padding:10px 20px;background:#10b981;color:#fff;text-decoration:none;border-radius:25px;font-weight:bold;box-shadow:0 4px 10px rgba(16,185,129,0.3);">
  🧢 Powered by StitchMath Calculators β†’
</a>

By linking to StitchMath.com, you help your readers calculate exact gauge swatches and sizing without leaving their browser!


🀝 Contributing

We welcome contributions from fellow developers, knitters, and crocheters!

  1. Fork the repository.

  2. Create your feature branch (git checkout -b feature/amazing-calculation).

  3. Commit your changes (git commit -m 'Add new sock heel shaping formula').

  4. Push to the branch (git push origin feature/amazing-calculation).

  5. Open a Pull Request.


πŸ“„ License

This repository is licensed under the MIT License. See the LICENSE file for details.


A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Provides 21 mathematical tools across 6 domains including basic calculations, array operations, statistics, financial mathematics, linear algebra, and calculus. Supports batch execution for complex multi-step workflows with intelligent dependency resolution.
    Last updated
    21
    5
    MIT
  • A
    license
    C
    quality
    C
    maintenance
    A comprehensive MCP server that turns any AI assistant into a powerful mathematical computation engine, providing 52 advanced functions, 158 unit conversions, financial calculations, and secure AST-based evaluation.
    Last updated
    18
    10
    MIT

View all related MCP servers

Related MCP Connectors

  • AI-callable calculators and engineering models with real formulas. No hallucinated math.

  • Open-source AI accounting skills verified by licensed accountants (tax, VAT, payroll).

  • Precision math engine for AI agents. 203 exact methods. Zero hallucination.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/double2dev/stitchmath-core'

If you have feedback or need assistance with the MCP directory API, please join our Discord server