Skip to content

feat: add configurable fetch pattern from template #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 56 commits into
base: main
Choose a base branch
from

Conversation

Mearman
Copy link
Owner

@Mearman Mearman commented Jun 5, 2025

Summary

  • Implements the configurable fetch pattern from mcp-template
  • Adds support for built-in fetch, memory cache, and disk cache backends
  • Updates existing HTTP utilities to use the new pattern

Changes

  • Added src/utils/fetch.ts with ConfigurableFetch class
  • Added comprehensive tests in src/utils/fetch.test.ts
  • Updated src/utils/http.ts to use configurableFetch instead of direct fetch
  • Added dependencies: node-fetch-cache, zod-to-json-schema
  • Updated http tests to mock configurableFetch

Benefits

  • Enables caching of HTTP requests to reduce load on Wayback Machine API
  • Allows runtime configuration of fetch backend
  • Supports per-request cache bypass
  • Maintains backward compatibility with existing code

Test Results

All tests passing with 75.55% coverage.

Mearman added 30 commits June 4, 2025 20:11
- Add comprehensive Node.js patterns
- Add TypeScript build artifacts (dist/, *.tsbuildinfo)
- Add Yarn 2+ specific patterns with proper exceptions
- Add testing coverage directories
- Add editor and OS-specific files
- Add environment and temporary file patterns
- Add .yarnrc.yml with node-modules linker configuration
- Add yarn.lock for dependency locking
- Switch from npm to Yarn for package management
- Add packageManager field to specify Yarn 4.9.1
- Ensures consistent Yarn version across all environments
- Enables Corepack to automatically use correct Yarn version
Remove exceptions for .vscode configuration files to ignore the entire directory
Updated the versions of dependencies and devDependencies in package.json to ensure compatibility and take advantage of the latest features and fixes.
Add bin field to package.json to allow the package to be executed
using npx mcp-wayback-machine after installation
- Add commitizen for interactive conventional commits
- Add standard-version for automated changelog and versioning
- Add commitlint with husky for commit message validation
- Add npm scripts for commit and release workflows
- Configure standard-version with .versionrc.json
- Add placeholder test to enable commits
- Add release workflow with NPM and GitHub Package Registry publishing
- Include build attestation and SBOM generation using SPDX format
- Add CI workflow for testing across Node.js 18, 20, and 22
- Configure package.json with publishing settings and repository info
- Add RELEASING.md documentation for release process
- Enable provenance generation for supply chain security
- Add Biome for linting and formatting with strict rules
- Configure EditorConfig for consistent coding styles
- Add npm scripts for linting, formatting, and checking
- Set up pre-commit hook to auto-format staged files
- Apply initial formatting to all project files
- Configure Biome and EditorConfig to use tabs
- Exclude YAML files from Biome formatting (spaces required)
- Update pre-commit hook to format all non-gitignored files
- Apply tab formatting to all project files
- Configure EditorConfig to use 2-space indentation for .md files
- Exclude markdown files from Biome formatting
- Ensures proper rendering of lists and code blocks in markdown
The bin field now uses object syntax to properly define the command name,
ensuring correct installation of the executable as 'mcp-wayback-machine'.
Updated files field to explicitly include JavaScript, TypeScript definitions,
and source maps while excluding test files from the published package.
Added basic MCP server implementation with:
- Server setup using stdio transport
- Tool schemas for save_url, get_archived_url, search_archives, check_archive_status
- Tool listing and request handling with placeholder implementations
- Proper error handling for unknown tools
Added semantic-release configuration to automate:
- Version bumping based on conventional commits
- CHANGELOG generation
- npm and GitHub releases
- Git tag creation
Created GitHub Actions workflow that:
- Runs on pushes to main branch
- Executes semantic-release for automated versioning
- Generates and attests build artifacts
- Publishes to both npm and GitHub Packages
Added initial CHANGELOG structure following Keep a Changelog format
to be automatically maintained by semantic-release.
Specifies [email protected] as the package manager to ensure CI environments
use the correct Yarn version and respect the lockfile format.
Added corepack enable step before yarn install in all workflows
to ensure the correct Yarn version is used as specified in packageManager.
Mearman and others added 26 commits June 4, 2025 23:55
# 1.0.0 (2025-06-04)

### Bug Fixes

* add packageManager field for Yarn 4 compatibility ([dc1de05](dc1de05))
* convert bin field to object format for npm compatibility ([9f5ee8a](9f5ee8a))
* resolve test failures and version compatibility issues ([6b682aa](6b682aa))
* resolve timeout test race condition ([8a6dea1](8a6dea1))
* resolve TypeScript errors in test files ([2877988](2877988))
* use space indentation for markdown files ([58b359b](58b359b))

### Features

* add bin field to enable npx invocation ([1c48881](1c48881))
* apply CC BY-NC-SA 4.0 license with full license file and README badge ([e8c9980](e8c9980))
* implement initial MCP server with tool definitions ([377b6e0](377b6e0))
* implement Wayback Machine API integration ([14d70c1](14d70c1))
* initial project setup with plan for Wayback Machine MCP server ([f265ed8](f265ed8))
The bin field needs to be an object to properly name the CLI command as 'mcp-wayback-machine'.
When bin is a string, npm uses the package name directly, which is correct in this case,
but using an object is more explicit and matches our tests.
## [1.0.1](v1.0.0...v1.0.1) (2025-06-04)

### Bug Fixes

* restore bin field as object for proper CLI naming ([ab966b2](ab966b2))
The workflow now properly detects when semantic-release creates a new version
and publishes to GitHub Packages as a secondary registry.
## [1.0.2](v1.0.1...v1.0.2) (2025-06-04)

### Bug Fixes

* add version detection for GitHub Packages publishing ([4298868](4298868))
The integration tests fail when package name is changed to @Mearman scope.
Using --ignore-scripts flag to skip tests during GitHub Packages publish
since the package was already tested and built during the npm publish.
## [1.0.3](v1.0.2...v1.0.3) (2025-06-04)

### Bug Fixes

* skip prepublishOnly script for GitHub Packages publish ([25c3c3f](25c3c3f))
- Package names in npm must be lowercase, changed @Mearman to @Mearman
- Explicitly set registry to npm.pkg.github.com for GitHub Packages publish
- This ensures the scoped package is published to the correct registry
## [1.0.4](v1.0.3...v1.0.4) (2025-06-04)

### Bug Fixes

* use lowercase package name and correct registry for GitHub Packages ([0a3b4ba](0a3b4ba))
- Added CLI interface using commander, chalk, and ora
- Tool can now be used with npx or global installation
- Supports all four main operations: save, get, search, status
- Automatically detects CLI vs MCP server mode based on TTY and arguments
- Added wayback command alias for easier CLI usage
- Updated README with CLI documentation and examples
- Added comprehensive CLI tests

Users can now run:
  npx mcp-wayback-machine save https://example.com
  wayback get https://example.com --timestamp latest
  wayback search https://example.com --from 2023-01-01
  wayback status https://example.com

BREAKING CHANGE: The tool now checks for CLI arguments and will run in CLI mode if any are provided
GitHub's license detection doesn't recognise Creative Commons licenses,
causing the automatic badge to fail. Replaced with shields.io badge
specifically for CC BY-NC-SA 4.0.
# [2.0.0](v1.0.4...v2.0.0) (2025-06-05)

### Bug Fixes

* replace GitHub license badge with CC BY-NC-SA 4.0 badge ([feda5a0](feda5a0))

### Features

* add CLI support for direct command-line usage ([94a1bf8](94a1bf8))

### BREAKING CHANGES

* The tool now checks for CLI arguments and will run in CLI mode if any are provided
- Added Build Status section with CI build and test badges
- Added Release Status section with semantic-release and publish badges
- Added npm downloads badge
- Added codecov badge placeholder for coverage tracking
- Organized badges into logical sections for better readability
- Replace any types with proper type annotations
- Convert forEach loops to for...of loops
- Add interface for API response types
# 1.0.0 (2025-06-05)

### Bug Fixes

* add packageManager field for Yarn 4 compatibility ([dc1de05](dc1de05))
* add version detection for GitHub Packages publishing ([9eecb8b](9eecb8b))
* convert bin field to object format for npm compatibility ([9f5ee8a](9f5ee8a))
* replace GitHub license badge with CC BY-NC-SA 4.0 badge ([87a8c91](87a8c91))
* resolve all linting issues ([f2fa7c2](f2fa7c2))
* resolve test failures and version compatibility issues ([660663d](660663d))
* resolve timeout test race condition ([8a6dea1](8a6dea1))
* resolve TypeScript errors in test files ([8e0b7fc](8e0b7fc))
* restore bin field as object for proper CLI naming ([14a3c69](14a3c69))
* skip prepublishOnly script for GitHub Packages publish ([9e4513b](9e4513b))
* use lowercase package name and correct registry for GitHub Packages ([8a8d353](8a8d353))
* use space indentation for markdown files ([58b359b](58b359b))

### Features

* add bin field to enable npx invocation ([1c48881](1c48881))
* add CLI support for direct command-line usage ([cf7ab50](cf7ab50))
* apply CC BY-NC-SA 4.0 license with full license file and README badge ([e8c9980](e8c9980))
* implement initial MCP server with tool definitions ([377b6e0](377b6e0))
* implement Wayback Machine API integration ([14d70c1](14d70c1))
* initial project setup with plan for Wayback Machine MCP server ([f265ed8](f265ed8))

### BREAKING CHANGES

* The tool now checks for CLI arguments and will run in CLI mode if any are provided
- Add @biomejs/biome to enable linting in CI pipeline
- Add husky for Git hooks support
- Update prepare script to use husky instead of build
- Add link to MCP template at the top
- Add emoji icons to features for better readability
- Include Claude Desktop usage examples
- Add CLI script examples for automation
- Add troubleshooting section with common issues
- Expand development commands documentation
- Add community resources and forum links
- Document debug mode for both CLI and MCP server
- Add configurableFetch utility with support for built-in fetch, memory cache, and disk cache
- Update http.ts to use configurableFetch instead of direct fetch
- Add node-fetch-cache and zod-to-json-schema dependencies
- Update tests to mock configurableFetch
- All tests passing with 75.55% coverage
Mearman added a commit that referenced this pull request Jun 5, 2025
feat: add CLI functionality and configurable fetch pattern
Mearman added a commit that referenced this pull request Jun 5, 2025
feat: add CLI functionality and configurable fetch pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants