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

contextforge-cli

v1.0.1

Published

ContextForge CLI - Generate production-ready MCP servers from docs, OpenAPI, GraphQL & codebases. Multi-URL, private docs, generate_code tool. Local + cloud LLMs (BYOK). Archestra & Claude Desktop ready.

Readme

License: MIT Node.js 18+ npm version


📖 Table of Contents


Overview

ContextForge CLI is a developer-focused command-line tool that automatically generates production-ready MCP (Model Context Protocol) servers from multiple knowledge sources.

In essence, it solves a critical problem: scattered documentation is hard for AI assistants to consume accurately. ContextForge collects knowledge from diverse sources (web docs, API specs, schemas, codebases), normalizes it into structured context, and packages it into an MCP server with built-in tools for reliable Q&A and code generation.

What This Means in Practice

Instead of manually building context pipelines, LLM integrations, and deployment scaffolding, you:

  1. Provide sources (URLs, OpenAPI file, GraphQL schema, codebase folder)
  2. Run one command (contextforge create)
  3. Get a working MCP server ready to integrate with Claude Desktop, Archestra, or any MCP client

The resulting server exposes tools like ask_docs, search_docs, and (for TypeScript) generate_code — all powered by your collected knowledge base.


Why ContextForge?

The Problem

  • Documentation lives in many places: docs portals, API specs, schema files, source repos
  • AI assistants lack proper context boundaries → hallucinations & inaccurate answers
  • Building MCP servers from scratch requires deep knowledge of protocol internals
  • Keeping context in sync with changing docs is manual and error-prone

The Solution

ContextForge automates the entire pipeline:

  • Multi-source ingestion in one command (no manual data wrangling)
  • Smart normalization (HTML → Markdown, specs → searchable blocks)
  • Context deduplication (no repeated content)
  • LLM-agnostic design (Ollama, OpenAI, Anthropic, Azure, etc.)
  • Deploy-ready output (Docker support, Claude Desktop integration, Archestra manifests)
  • Incremental updates (add new sources, refresh docs, without rebuilding)

Quick Start

1️⃣ Install

npm install -g contextforge-cli
# or use npx directly
npx contextforge-cli create

2️⃣ Create Your First MCP Server

contextforge create -n my-docs-server -u https://docs.example.com

This will:

  • Detect local LLM (Ollama, LM Studio, etc.)
  • Scrape & process documentation
  • Generate TypeScript/Python server code
  • Install dependencies
  • Write context files metadata

3️⃣ Run & Deploy

cd my-docs-server-mcp
npm start
# or with Docker
docker-compose up

4️⃣ Integrate with Claude Desktop

contextforge add-to-claude
# Automatically registers server in Claude Desktop config

That's it! Claude can now query the documentation through MCP tools.


Features

🔄 Multi-Source Ingestion

Combine multiple knowledge sources in a single MCP server:

  • Documentation URLs – Automatic web scraping, sitemap detection, recursive crawling
  • OpenAPI/Swagger – Parses REST endpoints, parameters, schemas, response types
  • GraphQL Schemas – Extracts types, interfaces, enums into searchable context
  • Local Codebases – Indexes source files (TypeScript, Python, Go, Rust, etc.)

🔐 Private Documentation Support

  • Auth headers for token-based access
  • Cookie support for session-based authentication
  • No public credential exposure in generated artifacts

🧠 LLM-Agnostic & BYOK

  • Auto-detects local LLM endpoints (Ollama, LM Studio, vLLM, LocalAI)
  • Seamlessly switches to cloud providers (OpenAI, Anthropic, Groq, Together)
  • Zero lock-in: switch providers by changing environment variables

🛠️ Flexible Output

  • TypeScript – Full MCP SDK support, async/await, rich tooling
  • Python – Lightweight async server using standard MCP library
  • Docker – Multi-stage optimized Dockerfile + docker-compose
  • Deployment-ready – Includes env configs, logging, health checks

📦 One-Command Integrations

  • add-to-claude – Registers server in Claude Desktop config
  • export-archestra – Generates Archestra-compatible manifest
  • add-sources – Incrementally add new knowledge sources
  • refresh – Re-scrape & update documentation

🔍 Intelligent Tools

Generated servers expose:

  • ask_docs – Natural language Q&A against collected context
  • search_docs – Keyword search with relevance ranking
  • generate_code (TypeScript) – LLM-guided code suggestions constrained by docs

Installation

Option 1: Global Installation (Recommended)

npm install -g contextforge-cli
contextforge create --help

Option 2: Via npx (No Installation)

npx contextforge-cli create -n my-server -u https://docs.example.com

Option 3: Local Development

git clone https://github.com/CodewithEvilxd/ContextForge-CLI.git
cd ContextForge-CLI
npm install
node bin/contextforge.js create

Requirements

  • Node.js 18+ (18.0.0 or higher)
  • npm 8+ or compatible package manager
  • Optional: Ollama or cloud LLM API keys for runtime

Commands

Core Commands

contextforge create

Generate a new MCP server from knowledge sources

contextforge create [options]
Options

| Option | Short | Type | Default | Description | |--------|-------|------|---------|-------------| | --name | -n | string | (required) | Server name (e.g., stripe-expert, api-docs-server) | | --url | -u | string[] | (optional) | Documentation URL(s) — repeat flag for multiple: -u url1 -u url2 | | --lang | -l | typescript / python | typescript | Generated server language | | --output | -o | string | current dir | Output directory for generated project | | --openapi | — | string[] | (optional) | OpenAPI/Swagger file or URL | | --graphql | — | string[] | (optional) | GraphQL schema file or URL | | --codebase | — | string[] | (optional) | Local directory to index | | --auth-header | — | string | (optional) | Auth header for private docs (e.g., Bearer YOUR_TOKEN) | | --cookies | — | string | (optional) | Cookie header for session-based auth | | --max-pages | — | number | 200 | Max pages to scrape per URL | | --no-docker | — | flag | — | Skip Docker artifacts generation | | --preset | -p | default / archestra / claude-desktop | default | Output preset |

Examples
# Single documentation URL
contextforge create -n stripe-api \
  -u https://stripe.com/docs/api

# Multi-URL with OpenAPI
contextforge create -n payment-platform \
  -u https://docs.stripe.com \
  -u https://docs.paddle.com \
  --openapi https://api.stripe.com/openapi.json

# Private documentation with auth
contextforge create -n internal-docs \
  -u https://internal.company.com/docs \
  --auth-header "Bearer sk_internal_xyz123" \
  --cookies "session=abc123"

# Full-stack: docs + API spec + codebase
contextforge create -n full-platform \
  -u https://fastapi.tiangolo.com \
  --openapi ./api-spec.json \
  --codebase ./backend \
  -l python

# Custom output location
contextforge create -n my-server \
  -u https://docs.example.com \
  -o ~/projects/mcp-servers

contextforge add-sources

Add more knowledge sources to an existing MCP server (incremental)

contextforge add-sources [directory]

Interactively prompts for source type (URL, OpenAPI, GraphQL, codebase) and merges new content without duplicates.

Example
cd my-server-mcp
contextforge add-sources
# → Choose: Documentation URL(s)
# → Enter: https://new-docs.example.com
# → Result: docs merged, duplicates removed

contextforge refresh

Re-scrape documentation for existing server

contextforge refresh [directory]

Useful for keeping docs in sync with upstream changes.

Example
contextforge refresh ./my-server-mcp
# Re-scrapes baseUrl from original docs.json
# Updates context with latest content

contextforge list

List all generated MCP servers in current directory

contextforge list

Output:

Generated MCP servers:

  my-server-mcp
    Pages: 42 | Generated: 2/19/2026

  api-docs-server
    Pages: 128 | Generated: 2/18/2026

contextforge test

Verify MCP server health (structure + LLM connectivity)

contextforge test [directory]

Checks:

  • Project structure validity
  • Context files exist
  • .env file present
  • LLM connection available

contextforge add-to-claude

Register generated server in Claude Desktop config

contextforge add-to-claude [directory]

Automatically:

  • Locates claude_desktop_config.json (Windows/Mac/Linux)
  • Adds server entry with correct paths
  • Includes environment variable defaults

Then restart Claude Desktop to see the new MCP server.


contextforge export-archestra

Export Archestra-ready manifest

contextforge export-archestra [directory]

Generates archestra-manifest.yaml with Docker-based transport and environment variable placeholders.


Configuration

Generated Server Environment Variables

Each generated server respects these env vars:

| Variable | Type | Default | Description | |----------|------|---------|-------------| | LLM_PROVIDER | string | ollama | LLM provider: ollama, openai, anthropic, groq, together, mistral, azure_openai | | LLM_ENDPOINT | string | http://localhost:11434/api/generate | LLM endpoint URL | | LLM_MODEL | string | llama3.2 | Model name (depends on provider) | | CONTEXT_PATH | string | ./context/docs.json | Path to context file | | LOG_LEVEL | string | info | Logging level: error, warn, info, debug | | OPENAI_API_KEY | string | — | OpenAI API key (if using OpenAI) | | ANTHROPIC_API_KEY | string | — | Anthropic API key (if using Anthropic) | | GROQ_API_KEY | string | — | Groq API key | | AZURE_OPENAI_ENDPOINT | string | — | Azure OpenAI endpoint (if using Azure) |

Example .env File

# Local LLM (Ollama)
LLM_PROVIDER=ollama
LLM_ENDPOINT=http://localhost:11434/api/generate
LLM_MODEL=llama3.2

# OR Cloud Provider (OpenAI)
# LLM_PROVIDER=openai
# OPENAI_API_KEY=sk-...
# LLM_MODEL=gpt-4

# Context & Logging
CONTEXT_PATH=./context/docs.json
LOG_LEVEL=info

Examples

Example 1: API Documentation Server (Stripe)

# Create
contextforge create -n stripe-expert \
  -u https://stripe.com/docs/api \
  --openapi https://api.stripe.com/openapi.json

# Run
cd stripe-expert-mcp
npm start

# Use with Claude Desktop
contextforge add-to-claude

Now Claude can:

  • Ask questions about Stripe API
  • Search payment flow documentation
  • Generate integration code examples

Example 2: Internal Platform Documentation (Private)

# Create with auth
contextforge create -n platform-docs \
  -u https://internal.company.com/platform \
  --auth-header "Bearer $COMPANY_TOKEN" \
  -l python

# Run with environment
cd platform-docs-mcp
python server.py

# Test connectivity
contextforge test

Example 3: Multi-Source Knowledge Base (Full Stack)

# Combine docs, specs, and codebase
contextforge create -n fullstack-backend \
  -u https://fastapi.tiangolo.com \
  -u https://docs.sqlalchemy.org \
  --openapi ./generated/openapi.json \
  --codebase ./src \
  --preset archestra

# Later, add more sources
cd fullstack-backend-mcp
contextforge add-sources
# → Add: GraphQL schema
# → Add: New microservice docs URL

Generated Server Capabilities

Tools Available (TypeScript Template)

1. ask_docs(question, include_examples?)

Ask natural-language questions about collected documentation.

Input:

{
  "question": "How do I create a webhook in Stripe?",
  "include_examples": true
}

Output:

LLM searches context, finds relevant docs sections, provides answer with code examples.

2. search_docs(query, max_results?)

Full-text search with relevance ranking.

Input:

{
  "query": "authentication JWT tokens",
  "max_results": 5
}

Output:

Returns 5 most relevant documentation sections.

3. generate_code(task, language?, context_hint?)

Generate code implementations guided by documentation.

Input:

{
  "task": "Create a webhook listener for payment events",
  "language": "typescript",
  "context_hint": "webhook events transactions"
}

Output:

Complete, runnable code snippet based on docs context.

Tools Available (Python Template)

Python output provides ask_docs and search_docs (minimal setup, async support).


LLM Providers

Local LLMs (Recommended for Development)

Ollama (Default)

# Install: https://ollama.ai
ollama pull llama3.2
ollama serve

# Then in your server:
LLM_PROVIDER=ollama
LLM_MODEL=llama3.2

LM Studio

LLM_ENDPOINT=http://localhost:1234/v1/chat/completions
LLM_PROVIDER=openai

vLLM

LLM_ENDPOINT=http://localhost:8000/v1/chat/completions
LLM_PROVIDER=openai

Cloud Providers (BYOK)

OpenAI

LLM_PROVIDER=openai
OPENAI_API_KEY=sk_...
LLM_MODEL=gpt-4

Anthropic Claude

LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=sk-ant-...
LLM_MODEL=claude-3-5-sonnet-20241022

Groq

LLM_PROVIDER=groq
GROQ_API_KEY=gsk_...
LLM_MODEL=llama-3.1-70b-versatile

Azure OpenAI

LLM_PROVIDER=azure_openai
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
AZURE_OPENAI_KEY=...
AZURE_OPENAI_DEPLOYMENT=gpt-4

Architecture

High-Level Flow

User Command (create)
    ↓
[CLI Routing] → bin/contextforge.js
    ↓
[Create Command] → src/commands/create.js
    ├─ [LLM Detection] → src/llm-detector.js
    ├─ [Data Acquisition] → Multiple loaders (below)
    │  ├─ Web Scraper → src/scraper.js
    │  ├─ OpenAPI Loader → src/loaders/openapi.js
    │  ├─ GraphQL Loader → src/loaders/graphql.js
    │  └─ Codebase Loader → src/loaders/codebase.js
    ├─ [Content Merge & Dedup] → src/commands/create.js
    └─ [Code Generation] → src/generator.js
         ├─ [Templates Rendering] → templates/**/*.hbs
         ├─ [Handlebars Template Engine] → Handlebars
         └─ [Output Writing] → Generated project folder

Key Components

| Component | Path | Purpose | |-----------|------|---------| | CLI Entry | bin/contextforge.js | Command routing & argument parsing | | Create Command | src/commands/create.js | Orchestrates generation workflow | | Web Scraper | src/scraper.js | HTML → Markdown conversion, sitemap detection, recursive crawling | | OpenAPI Loader | src/loaders/openapi.js | Parses REST endpoints, schemas into context | | GraphQL Loader | src/loaders/graphql.js | Extracts types/interfaces into blocks | | Codebase Loader | src/loaders/codebase.js | Indexes source files | | LLM Detector | src/llm-detector.js | Health-checks local LLM endpoints | | Generator | src/generator.js | Template rendering & project creation | | TypeScript Template | templates/typescript/** | MCP server code (index.ts, context mgr, LLM client) | | Python Template | templates/python/** | MCP server code (server.py with async runtime) | | Docker Template | templates/docker/** | Dockerfile + docker-compose.yml |

Generated Project Structure

my-server-mcp/
├── src/
│   ├── index.ts (or server.py)
│   ├── context-manager.ts
│   ├── llm-client.ts
│   ├── logger.ts
│   └── types.ts
├── context/
│   ├── docs.json          (normalized content)
│   └── metadata.json      (generation info)
├── dist/                  (compiled TS only)
├── Dockerfile
├── docker-compose.yml
├── package.json           (with dependencies)
├── tsconfig.json          (TS config)
├── .env.example
└── README.md              (usage docs)

Advanced Usage

Updating Documentation Sources

  1. Add a new source (incremental)

    contextforge add-sources ./my-server-mcp
  2. Refresh from original source

    contextforge refresh ./my-server-mcp
  3. Manually edit context

    # Edit ./my-server-mcp/context/docs.json directly
    # Changes persist after server restart

Custom Docker Deployment

cd my-server-mcp

# Build image
docker build -t my-server-mcp:latest .

# Run with Ollama on host
docker run --rm -i --network=host \
  -e LLM_PROVIDER=ollama \
  -e LLM_MODEL=llama3.2 \
  my-server-mcp:latest

# Or with remote Ollama
docker run --rm -i \
  -e LLM_ENDPOINT=http://ollama-server:11434/api/generate \
  my-server-mcp:latest

Archestra Integration

# Export manifest
contextforge export-archestra ./my-server-mcp

# Build Docker image
cd my-server-mcp
docker build -t my-server-mcp:latest .

# Import archestra-manifest.yaml into Archestra MCP Registry
# Archestra will orchestrate the MCP server

Troubleshooting

Issue: "Cannot detect LLM"

Solution: Ensure Ollama is running:

ollama serve
# or set explicit endpoint:
LLM_ENDPOINT=http://localhost:11434/api/generate

Issue: "Large documentation takes too long to scrape"

Solution: Limit pages:

contextforge create -n my-server \
  -u https://docs.example.com \
  --max-pages 100

Issue: "Private docs return 401/403"

Solution: Provide correct auth headers:

contextforge create -n internal \
  -u https://internal.docs.com \
  --auth-header "Bearer $(cat ~/.token)" \
  --cookies "session=$(cat ~/.session)"

Issue: "Generated server won't start"

Solution: Run test first:

contextforge test ./my-server-mcp
# → Checks project structure & LLM connectivity

Contributing

We welcome contributions! Here's how:

  1. Fork the repo: https://github.com/CodewithEvilxd/ContextForge-CLI
  2. Clone locally:
    git clone https://github.com/CodewithEvilxd/ContextForge-CLI.git
    cd ContextForge-CLI
    npm install
  3. Create a feature branch:
    git checkout -b feature/your-feature
  4. Make changes & test:
    npm test
    node bin/contextforge.js create --help
  5. Commit & push:
    git commit -m "feat: add cool feature"
    git push origin feature/your-feature
  6. Open a Pull Request with clear description

License

MIT License © 2026 codewithevilxd

See LICENSE for full text.


🙌 Support & Contact


Made with ❤️ by codewithevilxd

⭐ If you find this useful, please star the repo!