MCP Webpage Timestamps

MCP Webpage Timestamps

A Model Context Protocol server that extracts webpage creation, modification, and publication timestamps from various sources including HTML meta tags, HTTP headers, and structured data.

Category
访问服务器

README

MCP Webpage Timestamps

npm version License: MIT Node.js Version smithery badge

A powerful Model Context Protocol (MCP) server for extracting webpage creation, modification, and publication timestamps. This tool is designed for content freshness evaluation, web scraping, and temporal analysis of web content.

Features

  • Comprehensive Timestamp Extraction: Extracts creation, modification, and publication timestamps from webpages
  • Multiple Data Sources: Supports HTML meta tags, HTTP headers, JSON-LD, microdata, OpenGraph, Twitter cards, and heuristic analysis
  • Confidence Scoring: Provides confidence levels (high/medium/low) for extracted timestamps
  • Batch Processing: Extract timestamps from multiple URLs simultaneously
  • Configurable: Customizable timeout, user agent, redirect handling, and heuristic options
  • Production Ready: Robust error handling, comprehensive logging, and TypeScript support

Installation

Quick Install

npm install -g mcp-webpage-timestamps

Usage with npx

npx mcp-webpage-timestamps

Installing via Smithery

To install mcp-webpage-timestamps for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @Fabien-desablens/mcp-webpage-timestamps --client claude

Prerequisites

  • Node.js 18.0.0 or higher
  • npm or yarn

Development Install

git clone https://github.com/Fabien-desablens/mcp-webpage-timestamps.git
cd mcp-webpage-timestamps
npm install
npm run build

Usage

As MCP Server

The server can be used with any MCP-compatible client. Here's how to configure it:

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "webpage-timestamps": {
      "command": "npx",
      "args": ["mcp-webpage-timestamps"],
      "env": {}
    }
  }
}

Cline Configuration

Add to your MCP settings:

{
  "mcpServers": {
    "webpage-timestamps": {
      "command": "npx",
      "args": ["mcp-webpage-timestamps"]
    }
  }
}

Direct Usage

# Start the server
npm start

# Or run in development mode
npm run dev

API Reference

Tools

extract_timestamps

Extract timestamps from a single webpage.

Parameters:

  • url (string, required): The URL of the webpage to extract timestamps from
  • config (object, optional): Configuration options

Configuration Options:

  • timeout (number): Request timeout in milliseconds (default: 10000)
  • userAgent (string): User agent string for requests
  • followRedirects (boolean): Whether to follow HTTP redirects (default: true)
  • maxRedirects (number): Maximum number of redirects to follow (default: 5)
  • enableHeuristics (boolean): Enable heuristic timestamp detection (default: true)

Example:

{
  "name": "extract_timestamps",
  "arguments": {
    "url": "https://example.com/article",
    "config": {
      "timeout": 15000,
      "enableHeuristics": true
    }
  }
}

batch_extract_timestamps

Extract timestamps from multiple webpages in batch.

Parameters:

  • urls (array of strings, required): Array of URLs to extract timestamps from
  • config (object, optional): Same configuration options as extract_timestamps

Example:

{
  "name": "batch_extract_timestamps",
  "arguments": {
    "urls": [
      "https://example.com/article1",
      "https://example.com/article2",
      "https://example.com/article3"
    ],
    "config": {
      "timeout": 10000
    }
  }
}

Response Format

Both tools return a JSON object with the following structure:

{
  url: string;
  createdAt?: Date;
  modifiedAt?: Date;
  publishedAt?: Date;
  sources: TimestampSource[];
  confidence: 'high' | 'medium' | 'low';
  errors?: string[];
}

TimestampSource:

{
  type: 'html-meta' | 'http-header' | 'json-ld' | 'microdata' | 'opengraph' | 'twitter' | 'heuristic';
  field: string;
  value: string;
  confidence: 'high' | 'medium' | 'low';
}

Supported Timestamp Sources

HTML Meta Tags

  • article:published_time
  • article:modified_time
  • date
  • pubdate
  • publishdate
  • last-modified
  • dc.date.created
  • dc.date.modified
  • dcterms.created
  • dcterms.modified

HTTP Headers

  • Last-Modified
  • Date

JSON-LD Structured Data

  • datePublished
  • dateModified
  • dateCreated

Microdata

  • datePublished
  • dateModified

OpenGraph

  • og:article:published_time
  • og:article:modified_time
  • og:updated_time

Twitter Cards

  • twitter:data1 (when containing date information)

Heuristic Analysis

  • Time elements with datetime attributes
  • Common date patterns in text
  • Date-related CSS classes

Development

Scripts

# Development with hot reload
npm run dev

# Build the project
npm run build

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

# Format code
npm run format

Testing

The project includes comprehensive tests:

# Run all tests
npm test

# Run tests with coverage
npm test -- --coverage

# Run specific test file
npm test -- extractor.test.ts

Code Quality

  • TypeScript: Full TypeScript support with strict type checking
  • ESLint: Code linting with recommended rules
  • Prettier: Code formatting
  • Jest: Unit and integration testing
  • 95%+ Test Coverage: Comprehensive test suite

Examples

Basic Usage

import { TimestampExtractor } from './src/extractor.js';

const extractor = new TimestampExtractor();
const result = await extractor.extractTimestamps('https://example.com/article');

console.log('Published:', result.publishedAt);
console.log('Modified:', result.modifiedAt);
console.log('Confidence:', result.confidence);
console.log('Sources:', result.sources.length);

Custom Configuration

const extractor = new TimestampExtractor({
  timeout: 15000,
  userAgent: 'MyBot/1.0',
  enableHeuristics: false,
  maxRedirects: 3
});

const result = await extractor.extractTimestamps('https://example.com');

Batch Processing

const urls = [
  'https://example.com/article1',
  'https://example.com/article2',
  'https://example.com/article3'
];

const results = await Promise.all(
  urls.map(url => extractor.extractTimestamps(url))
);

Use Cases

  • Content Freshness Analysis: Evaluate how recent web content is
  • Web Scraping: Extract temporal metadata from scraped pages
  • SEO Analysis: Analyze publication and modification patterns
  • Research: Study temporal aspects of web content
  • Content Management: Track content lifecycle and updates

Error Handling

The extractor handles various error conditions gracefully:

  • Network Errors: Timeout, connection refused, DNS resolution failures
  • HTTP Errors: 404, 500, and other HTTP status codes
  • Parsing Errors: Invalid HTML, malformed JSON-LD, unparseable dates
  • Configuration Errors: Invalid URLs, timeout values, etc.

All errors are captured in the errors array of the response, allowing for robust error handling and debugging.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/Fabien-desablens/mcp-webpage-timestamps.git
  3. Install dependencies: npm install
  4. Create a branch: git checkout -b feature/your-feature
  5. Make your changes
  6. Run tests: npm test
  7. Commit your changes: git commit -m 'Add some feature'
  8. Push to the branch: git push origin feature/your-feature
  9. Submit a pull request

Code Style

  • Follow the existing code style
  • Use TypeScript for all new code
  • Add tests for new functionality
  • Update documentation as needed

License

MIT License - see the LICENSE file for details.

Support

Changelog

See CHANGELOG.md for a detailed history of changes.

Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选