Package Exports
- website-to-markdown-mcp
- website-to-markdown-mcp/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (website-to-markdown-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
π Website to Markdown MCP Server
Language: English | ηΉι«δΈζ
A powerful Model Context Protocol (MCP) server designed for fetching website content and converting it to Markdown format, making it easier for AI to understand and process website information.
β¨ Key Features
| π Core Functions | π OpenAPI Support | βοΈ Flexible Configuration | π― Smart Extraction |
|---|---|---|---|
| Website to Markdown | OpenAPI 3.x/Swagger 2.0 | Multiple config methods | Smart content detection |
| Auto cleanup elements | Professional validation | Environment variables | Main content area detection |
| Batch configuration | Structured API parsing | Real-time config updates | Multi-format support |
π Quick Start
π¦ Installation
Install the package globally via npm:
npm install -g website-to-markdown-mcpOr use it directly with npx:
npx website-to-markdown-mcpπ― One-Click Configuration (Recommended)
π‘ Best Practice: Use external configuration files for easier management!
Step 1: Create Configuration File π
Create a my-websites.json file:
{
"websites": [
{
"name": "your_website",
"url": "https://your-website.com",
"description": "Your Project Website"
},
{
"name": "api_docs",
"url": "https://api.example.com/openapi.json",
"description": "Your API Specification"
}
]
}Step 2: Configure MCP Server βοΈ
Add to .cursor/mcp.json:
{
"mcpServers": {
"website-to-markdown": {
"command": "npx",
"args": ["-y", "website-to-markdown-mcp"],
"disabled": false,
"env": {
"WEBSITES_CONFIG_PATH": "./my-websites.json"
}
}
}
}Alternative: Local Installation
If you prefer to install locally:
{
"mcpServers": {
"website-to-markdown": {
"command": "node",
"args": ["./node_modules/website-to-markdown-mcp/dist/cli.js"],
"disabled": false,
"env": {
"WEBSITES_CONFIG_PATH": "./my-websites.json"
}
}
}
}Step 3: Restart and Test π
- Restart Cursor
- Open Chat and use Agent mode
- Test command:
Please list all configured websites
π Done! You can now start using it!
π Complete OpenAPI/Swagger Support
π₯ New Feature Highlights
| Feature | OpenAPI 3.x | Swagger 2.0 | Description |
|---|---|---|---|
| π Auto Detection | β | β | Support JSON/YAML formats |
| β Professional Validation | β | β | Using @readme/openapi-parser |
| π Structured Parsing | β | β | Endpoints, parameters, responses |
| π Reference Resolution | β | β | Auto handle $ref references |
| π Smart Summary | β | β | Generate API overview |
| π Formatted Output | β | β | Readable Markdown |
π Pre-configured Example Websites
{
"websites": [
{
"name": "petstore_openapi",
"url": "https://petstore3.swagger.io/api/v3/openapi.json",
"description": "π Swagger Petstore OpenAPI 3.0 Spec (Demo)"
},
{
"name": "petstore_swagger",
"url": "https://petstore.swagger.io/v2/swagger.json",
"description": "π± Swagger Petstore Swagger 2.0 Spec (Demo)"
},
{
"name": "github_api",
"url": "https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json",
"description": "π GitHub REST API OpenAPI Spec"
}
]
}π¦ Installation & Setup
π οΈ System Requirements
- Node.js 18+
- npm or yarn
- Cursor Editor
β‘ Quick Installation
Option 1: Global Installation (Recommended)
# Install globally
npm install -g website-to-markdown-mcp
# Verify installation
website-to-markdown-mcp --helpOption 2: Project-specific Installation
# In your project directory
npm install website-to-markdown-mcp
# Use via npx
npx website-to-markdown-mcpOption 3: Development Setup
# Clone the repository
git clone https://github.com/your-repo/website-to-markdown-mcp.git
cd website-to-markdown-mcp
# Install dependencies
npm install
# Build project
npm run build
# Run locally
npm startποΈ Advanced Configuration Options
Configuration Priority Order
graph TD
A[π Check Environment Variable<br/>WEBSITES_CONFIG_PATH] --> B{File exists?}
B -->|Yes| C[β
Load External Config File]
B -->|No| D[π Check Environment Variable<br/>WEBSITES_CONFIG]
D --> E{Valid JSON?}
E -->|Yes| F[β
Load Embedded Config]
E -->|No| G[π Check config.json]
G --> H{File exists?}
H -->|Yes| I[β
Load Local Config]
H -->|No| J[π§ Use Default Config]π¨ Configuration Method Details
π Method 1: External Configuration File (π Recommended)
π‘ Advantages: Easy to edit, syntax highlighting, version control friendly
π§ Detailed Setup Steps
Create Configuration File
# Can be placed anywhere touch my-api-configs.json
Edit Configuration Content
{
"websites": [
{
"name": "my_docs",
"url": "https://docs.example.com",
"description": "π My Documentation Website"
}
]
}- Set Environment Variable
{
"env": {
"WEBSITES_CONFIG_PATH": "./my-api-configs.json"
}
}π Method 2: NPX with Configuration
π§ NPX Configuration Example
{
"mcpServers": {
"website-to-markdown": {
"command": "npx",
"args": ["-y", "website-to-markdown-mcp"],
"disabled": false,
"env": {
"WEBSITES_CONFIG": "{\"websites\":[{\"name\":\"example\",\"url\":\"https://example.com\",\"description\":\"Example Website\"}]}"
}
}
}
}π Method 3: Global Installation
π§ Global Installation Configuration
After installing globally:
{
"mcpServers": {
"website-to-markdown": {
"command": "website-to-markdown-mcp",
"disabled": false,
"env": {
"WEBSITES_CONFIG_PATH": "./my-websites.json"
}
}
}
}π§ Available Tools
π General Tools
| Tool Name | Function | Parameters | Example |
|---|---|---|---|
fetch_website |
Fetch any website | url: Website URL |
Fetch OpenAPI spec files |
list_configured_websites |
List configured websites | None | View all available websites |
search_websites |
Search configured websites | query: Search term |
Find relevant content |
π― Dedicated Tools
Each configured website automatically generates corresponding dedicated tools:
fetch_petstore_openapi- Fetch Petstore OpenAPI 3.0 specfetch_petstore_swagger- Fetch Petstore Swagger 2.0 specfetch_github_api- Fetch GitHub API specfetch_tailwind_css- Fetch Tailwind CSS documentation
π Output Format Examples
π General Website Content
# Website Title
**Source**: https://example.com
**Website**: example_site - Example Website
---
[Converted Markdown content...]π OpenAPI 3.x Specification File
# π Example API (v2.1.0)
**Source**: https://api.example.com/openapi.json
**OpenAPI Version**: 3.0.3
**Validation Status**: β
Valid
---
## π API Basic Information
- **API Name**: Example API
- **Version**: 2.1.0
- **OpenAPI Version**: 3.0.3
- **Description**: A powerful example API
## π Servers
1. **https://api.example.com**
- π’ Production server
2. **https://staging-api.example.com**
- π§ͺ Testing server
## π οΈ API Endpoints
Total of **15** endpoints:
### π₯ `/users`
- **GET**: Get user list
- **POST**: Create new user
### π `/users/{id}`
- **GET**: Get specific user
- **PUT**: Update user information
- **DELETE**: Delete user
## π§© Components
- **Schemas**: 8 data models
- **Parameters**: 5 reusable parameters
- **Responses**: 12 reusable responses
- **Security Schemes**: 2 security mechanismsπ― Usage Examples
π» Basic Usage
Please fetch the content from https://docs.example.com and convert to markdownπ OpenAPI Specification Fetching
Please use the fetch_petstore_openapi tool to fetch Petstore OpenAPI specificationπ Documentation Website Fetching
Please fetch React official documentation contentπ Search Functionality
Please search for "authentication" in all configured websitesπ¨ Troubleshooting
β Common Issues
π§ Installation Related Issues
Q: Command not found after global installation?
- β Ensure npm global bin directory is in PATH
- β
Try
npm config get prefixto check npm prefix - β
Use
npx website-to-markdown-mcpas alternative
Q: Permission errors during installation?
- π οΈ Use
sudo npm install -g website-to-markdown-mcp(Linux/Mac) - π οΈ Run PowerShell as Administrator (Windows)
- π οΈ Configure npm to use a different directory
π§ Configuration Related Issues
Q: Configuration changes not taking effect?
- β Confirm JSON format is correct
- β Restart Cursor
- β Check environment variable names
Q: JSON format errors?
- π οΈ Use JSON Validator
- π οΈ Confirm using double quotes
- π οΈ Check for extra commas
π Website Fetching Issues
Q: Cannot fetch certain websites?
- π Check if website is normally accessible
- π Some websites have anti-crawling mechanisms
- π Confirm network connection
Q: OpenAPI parsing failed?
- β Confirm URL points to valid JSON/YAML
- β Check specification syntax correctness
- β View detailed error messages
π Debug Mode
Detailed logs are output to stderr at startup:
# View debug messages (global installation)
website-to-markdown-mcp 2> debug.log
# View debug messages (npx)
npx website-to-markdown-mcp 2> debug.logπ Performance & Optimization
β‘ Performance Tips
- π Batch Fetching: Configure multiple websites at once
- πΎ Caching Mechanism: Repeated requests are faster
- π― Precise Selectors: Improve content extraction accuracy
π‘οΈ Security Considerations
- π HTTPS websites only (recommended)
- π οΈ Auto filter malicious scripts
- π Limit output content length
π¦ Dependencies
| Package | Version | Purpose |
|---|---|---|
@modelcontextprotocol/sdk |
^1.0.0 | MCP Core Framework |
@readme/openapi-parser |
^4.1.0 | Professional OpenAPI Parsing |
axios |
^1.6.0 | HTTP Request Handling |
cheerio |
^1.0.0 | HTML Parsing Engine |
turndown |
^7.1.2 | HTML to Markdown |
yaml |
^2.8.0 | YAML Format Support |
zod |
^3.22.0 | Data Validation Framework |
π Changelog
π v1.0.1 (Latest)
π NPM Package Release
- π¦ Published to NPM registry
- β¨ Added Global CLI command support
- β¨ Added NPX support for easy usage
- π§ Improved Installation and setup process
- π Updated Documentation with installation methods
π v1.1.0
π Major Feature Updates
- β¨ Added Full OpenAPI 3.x/Swagger 2.0 support
- β¨ Added JSON/YAML format auto-detection
- β¨ Added Professional-grade spec validation and reference resolution
- β¨ Added Version auto-adaptation mechanism
- β¨ Added Structured API documentation summary
- π§ Pre-configured Multiple OpenAPI/Swagger examples
π― v1.0.0 (Stable)
- π Initial Release
- π Basic Functions Website content fetching
- π Core Functions Markdown conversion
- βοΈ Configuration Support Multi-website management
π€ Contributing
π‘ How to Contribute
- π΄ Fork this project
- π Create feature branch (
git checkout -b feature/AmazingFeature) - π Commit changes (
git commit -m 'Add some AmazingFeature') - π€ Push to branch (
git push origin feature/AmazingFeature) - π Open Pull Request
π Issue Reporting
Report issues on the Issues page, please include:
- π Issue Description
- π Reproduction Steps
- π» Environment Information
- πΈ Screenshots or Logs
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π If this project helps you, please give it a Star!
π¬ Have questions or suggestions? Feel free to open an Issue!
Made by Sun β€οΈ for the Developer Community