### MCP Installation URL Generation (JavaScript)
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/llmtext/index.html
Generates a URL for installing an MCP (Master Control Program) based on a given hostname. It constructs the URL using a predefined pattern that includes the MCP name derived from the hostname. This is used to guide users to the installation page.
```javascript
function getInstallMcpUrl(hostname) { const mcpName = getMcpName(hostname); return `https://installthismcp.com/${mcpName}?url=https://mcp.llmtext.com/${hostname}/mcp`; }
```
--------------------------------
### llms.txt File Structure Example (Markdown)
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/drafts/llms-txt-spec-draft.md
An example of the llms.txt file format, demonstrating the required title, optional summary, additional details, and a file list section.
```markdown
# Project Name
> Brief project summary with essential context
Additional details about the project and usage guidelines.
## Core Documentation
- [Quick Start](https://example.com/quickstart.html.md): Getting started guide
- [API Reference](https://example.com/api.html.md): Complete API documentation
## Optional
- [Advanced Topics](https://example.com/advanced.html.md): In-depth coverage
```
--------------------------------
### GitHub Actions CI/CD for Documentation Extraction
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/extract-from-sitemap/README.md
This GitHub Actions workflow automates the extraction of documentation daily or on demand. It installs the necessary tool, extracts content, and commits changes back to the repository. Requires the PARALLEL_API_KEY secret.
```yaml
name: Extract Documentation
on:
schedule:
- cron: "0 0 * * *" # Daily at midnight UTC
workflow_dispatch: # Allow manual trigger
jobs:
extract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Extract documentation
env:
PARALLEL_API_KEY: ${{ secrets.PARALLEL_API_KEY }}
run: |
npm install -g extract-from-sitemap
npx extract-from-sitemap
- name: Commit changes
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
git diff --quiet && git diff --staged --quiet || \
(git commit -m "Update docs [skip ci]" && git push)
```
--------------------------------
### GitHub Actions CI/CD for llms.txt Generation
Source: https://context7.com/janwilmake/llmtext-mcp/llms.txt
This workflow automates the generation and deployment of llms.txt. It checks out code, sets up Node.js, installs dependencies, creates a configuration file, extracts documentation content, generates an asset manifest, deploys the output to GitHub Pages, and validates the generated llms.txt file.
```yaml
name: Generate llms.txt
on:
push:
branches: [main]
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: |
npm install extract-from-sitemap
npm install llms-txt-generate
npm install getassetmanifest
- name: Create configuration
run: |
cat > llmtext.json << 'EOF'
{
"title": "${{ github.repository }}",
"description": "Documentation for ${{ github.repository }}",
"outDir": "./docs-output",
"sources": [
{
"title": "Main Documentation",
"origin": "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}",
"outDir": "./docs-output/main"
}
]
}
EOF
- name: Extract documentation
env:
PARALLEL_API_KEY: ${{ secrets.PARALLEL_API_KEY }}
run: npx extract-from-sitemap
- name: Generate asset manifest (if using static files)
run: npx getassetmanifest
- name: Deploy llms.txt
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs-output
destination_dir: docs
- name: Validate llms.txt
run: |
sleep 10 # Wait for deployment
curl "https://check.llmtext.com/check?url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/docs/llms.txt" \
| jq '.valid'
```
--------------------------------
### GitLab CI for Documentation Extraction
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/extract-from-sitemap/README.md
This GitLab CI configuration sets up a pipeline to extract documentation. It uses a Node.js Docker image, installs the extraction tool, runs the extraction process, and commits the updated documentation. Requires PARALLEL_API_KEY as a CI/CD variable.
```yaml
extract-docs:
image: node:20
script:
- npm install -g extract-from-sitemap
- npx extract-from-sitemap
- |
git config user.email "gitlab-ci@gitlab.com"
git config user.name "GitLab CI"
git add docs/
git diff --quiet && git diff --staged --quiet || \
(git commit -m "Update docs [skip ci]" && git push https://oauth2:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git HEAD:${CI_COMMIT_REF_NAME})
only:
- schedules
- web
```
--------------------------------
### Install parse-llms-txt via npm
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/parse-llms-txt/README.md
Installs the parse-llms-txt package using npm. This is the first step to using the library in your Node.js or browser projects.
```bash
npm install parse-llms-txt
```
--------------------------------
### NPM Script for Sitemap Extraction
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/extract-from-sitemap/README.md
This command installs the 'extract-from-sitemap' package globally and then executes it to generate markdown bundles. It's typically added to `package.json` scripts for easy execution.
```bash
npm install -g extract-from-sitemap
npx extract-from-sitemap
```
--------------------------------
### Fetch Webpage Content as Markdown using JavaScript
Source: https://context7.com/janwilmake/llmtext-mcp/llms.txt
Provides a JavaScript example for fetching Markdown content from a webpage using the llmtext.reader service. It includes URL encoding and demonstrates handling the text response. Dependencies include the fetch API.
```javascript
const url = "https://blog.example.com/article";
const encodedUrl = encodeURIComponent(url).replace(/^https?:/+/, "");
// Fetch as markdown
const mdResponse = await fetch(`https://reader.llmtext.com/md/${encodedUrl}`);
const markdown = await mdResponse.text();
console.log(markdown);
```
--------------------------------
### GET /leaderboard[/{hostname}]
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/llmtext.mcp/SPEC.md
Fetches a public leaderboard showing top users and MCP servers by usage count. Results are cached for 1 hour.
```APIDOC
## GET /leaderboard[/{hostname}]
### Description
Provides a public leaderboard displaying the top users (by total count) and top MCP servers (by total usage count). Results are cached for a maximum of 1 hour.
### Method
GET
### Endpoint
`/leaderboard` or `/leaderboard/{hostname}`
### Parameters
#### Path Parameters
- **hostname** (string) - Optional - Filters the leaderboard to a specific hostname.
#### Query Parameters
None
### Request Example
`GET /leaderboard`
`GET /leaderboard/example.com`
### Response
#### Success Response (200)
- **leaderboard** (object) - Contains leaderboard information:
- **top_users** (array) - An array of users ranked by their total usage count:
- **username** (string) - The user's identifier (e.g., X/Twitter username).
- **total_count** (integer) - The total usage count for the user.
- **top_mcp_servers** (array) - An array of MCP servers ranked by their total usage count:
- **server_hostname** (string) - The hostname of the MCP server.
- **total_usage_count** (integer) - The total usage count across all users for this server.
#### Response Example
```json
{
"leaderboard": {
"top_users": [
{
"username": "user123",
"total_count": 1500
},
{
"username": "ai_enthusiast",
"total_count": 1200
}
],
"top_mcp_servers": [
{
"server_hostname": "mcp.example.com",
"total_usage_count": 5000
},
{
"server_hostname": "another-mcp.ai",
"total_usage_count": 3000
}
]
}
}
```
```
--------------------------------
### Example llms.txt to JSON Conversion
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/parse-llms-txt/README.md
Provides a concrete example of an llms.txt markdown content and its corresponding JSON output after being parsed by the `parse-llms-txt` tool. This helps visualize the transformation process.
```markdown
# FastHTML
> FastHTML is a python library for creating server-rendered hypermedia applications.
Important notes about compatibility and usage.
## Documentation
- [Quick Start](https://fastht.ml/docs/quickstart.html.md): A brief overview
- [HTMX Reference](https://github.com/bigskysoftware/htmx/blob/master/www/content/reference.md): HTMX documentation
## Optional
- [Full Documentation](https://fastht.ml/docs/full.md): Complete documentation
```
```json
{
"title": "FastHTML",
"description": "FastHTML is a python library for creating server-rendered hypermedia applications.",
"details": "Important notes about compatibility and usage.",
"sections": [
{
"name": "Documentation",
"files": [
{
"name": "Quick Start",
"url": "https://fastht.ml/docs/quickstart.html.md",
"notes": "A brief overview"
},
{
"name": "HTMX Reference",
"url": "https://github.com/bigskysoftware/htmx/blob/master/www/content/reference.md",
"notes": "HTMX documentation"
}
]
},
{
"name": "Optional",
"files": [
{
"name": "Full Documentation",
"url": "https://fastht.ml/docs/full.md",
"notes": "Complete documentation"
}
]
}
]
}
```
--------------------------------
### HTML Structure and JavaScript for Check Tab Functionality
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/llmtext/CONTEXT.md
This HTML and JavaScript code provides a complete implementation for the index.html file. It includes the necessary structure for the 'check' tab, handles URL parameter parsing to trigger immediate API checks, enhances form submission to use the 'check' URL, and dynamically renders API response data in a user-friendly table format with actionable suggestions based on provided recommendations. The 'Install this MCP' button's visibility and state are managed according to the API check results.
```html
LLM Text MCP Checker
LLM Text MCP Checker
Check Results
```
--------------------------------
### Enhanced llms.txt Implementation with Subpath Linking (HTTP)
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/drafts/SEP-001-discovery.md
This example illustrates an enhanced HTTP interaction where a request for an HTML page includes a 'Link' header pointing to a context-specific llms.txt file located in a subpath. This showcases the preferred method for linking to secondary llms.txt locations.
```http
GET /docs/api/endpoint-guide.html HTTP/1.1
Host: example.com
HTTP/1.1 200 OK
Content-Type: text/html
Link: ; rel="llms-txt"
```
--------------------------------
### GET /get/{url}
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/llmtext.mcp/SPEC.md
Fetches the text content from a given URL. It stores fetch history and provides warnings for non-plaintext or overly large responses.
```APIDOC
## GET /get/{url}
### Description
Fetches the text content from a given URL. This endpoint is designed to retrieve plaintext content and includes safeguards against non-plaintext or excessively large responses.
### Method
GET
### Endpoint
`/get/{url}`
### Parameters
#### Path Parameters
- **url** (string) - Required - The URL from which to fetch content.
#### Query Parameters
None
### Request Example
`GET /get/https://example.com/document.txt`
### Response
#### Success Response (200)
- **content** (string) - The text content fetched from the URL.
- **message** (string) - Informational message, e.g., warning about content type or size.
#### Response Example
```json
{
"content": "This is the text content from the URL.",
"message": "URL content fetched successfully."
}
```
#### Error Response (400)
- **error** (string) - Description of the error (e.g., "Invalid URL", "Content is not plaintext", "Content too large").
#### Response Example
```json
{
"error": "Content is not plaintext"
}
```
```
--------------------------------
### URL and Domain Utility Functions (JavaScript)
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/llmtext/index.html
Provides utility functions for web development, including extracting the apex domain from a given domain, generating favicon URLs, formatting domain names for MCP installation, and extracting hostnames from URLs. These functions are crucial for dynamic URL manipulation and asset retrieval.
```javascript
function extractApexDomain(domain) { const parts = domain.split('.'); if (parts.length < 2) return domain; return parts.slice(-2).join('.'); }
function getFaviconUrl(domain) { return `https://www.google.com/s2/favicons?domain=${extractApexDomain(domain)}&sz=32`; }
function getMcpName(domain) { return domain.replace(/\./g, '-'); }
function extractHostname(url) { try { const urlObj = new URL(url); return urlObj.hostname; } catch (e) { return null; } }
```
--------------------------------
### Rendering Validation Results (JavaScript)
Source: https://github.com/janwilmake/llmtext-mcp/blob/main/llmtext/index.html
Renders the validation results in the UI, dynamically creating HTML based on the validation status (`valid` or `invalid`), errors, warnings, and metadata received from the API. It also provides a suggestion to recreate the llms.txt file and a button to install the MCP if validation passes.
```javascript
function renderValidationResult(data, url) { const resultDiv = document.getElementById('validation-result'); const validClass = data.valid ? 'valid' : 'invalid'; const icon = data.valid ? '✓' : '✗'; const title = data.valid ? 'VALID llms.txt' : 'INVALID llms.txt'; const hostname = extractHostname(url); const installUrl = hostname ? getInstallMcpUrl(hostname) : '#'; const installDisabled = !data.valid ? 'disabled' : ''; let html = `
${icon} ${title}
`; if (data.errors && data.errors.length > 0) { html += '
ERRORS:
'; html += '
'; data.errors.forEach(error => { html += `
${error}
`; }); html += '
'; } if (data.warnings && data.warnings.length > 0) { html += '
WARNINGS:
'; html += '
'; data.warnings.forEach(warning => { html += `
${warning}
`; }); html += '
'; } if (data.metadata) { html += '
METADATA
'; for (const [key, value] of Object.entries(data.metadata)) { if (value !== null && value !== undefined) { const displayValue = typeof value === 'object' ? JSON.stringify(value, null, 2) : value; html += `
${key}
${displayValue}
`; } } html += '
'; } if (!data.valid) { html += `
💡 SUGGESTION
Fix your llms.txt by recreating it with our library.