Skip to main content
Glama
StripFeed

stripfeed-mcp-server

Official

fetch_url

Fetch any URL and convert it to clean, token-efficient Markdown by stripping ads, navigation, scripts, and noise. Supports CSS selectors, caching, and output formats like JSON, text, or HTML for AI agents.

Instructions

Convert any URL to clean, token-efficient Markdown. Strips ads, navigation, scripts, and noise. Returns clean content ready for LLM consumption.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to fetch and convert to Markdown
formatNoOutput format: markdown (default), json, text, html
selectorNoCSS selector to extract specific elements (e.g. 'article', '.content', '#main')
modelNoAI model ID for cost tracking (e.g. 'claude-sonnet-4-6', 'gpt-5')
cacheNoSet to false to bypass cache and force fresh fetch
ttlNoCache TTL in seconds (default 3600, max 86400)
max_tokensNoTruncate output to fit within this token budget

Implementation Reference

  • The core handler function that makes the HTTP call to the StripFeed API (/fetch) with the provided URL and optional parameters, processes the response (JSON or text), and returns clean content with metadata (tokens, cache, etc.).
    async function fetchUrl(params: FetchParams): Promise<{
      content: string;
      tokens: number;
      originalTokens: number;
      savingsPercent: string;
      cached: string;
      fetchMs: string;
      truncated: boolean;
      title?: string;
    }> {
      const apiKey = getApiKey();
      const searchParams = new URLSearchParams({ url: params.url });
    
      if (params.format) searchParams.set("format", params.format);
      if (params.selector) searchParams.set("selector", params.selector);
      if (params.model) searchParams.set("model", params.model);
      if (params.cache === false) searchParams.set("cache", "false");
      if (params.ttl !== undefined) searchParams.set("ttl", String(params.ttl));
      if (params.max_tokens !== undefined) searchParams.set("max_tokens", String(params.max_tokens));
    
      const response = await fetch(`${BASE_URL}/fetch?${searchParams}`, {
        headers: { Authorization: `Bearer ${apiKey}` },
      });
    
      if (!response.ok) {
        const body = await response.text();
        let message: string;
        try {
          message = JSON.parse(body).error;
        } catch {
          message = body;
        }
        throw new Error(`StripFeed API error ${response.status}: ${message}`);
      }
    
      const tokens = response.headers.get("X-StripFeed-Tokens") ?? "0";
      const originalTokens =
        response.headers.get("X-StripFeed-Original-Tokens") ?? "0";
      const savingsPercent =
        response.headers.get("X-StripFeed-Savings-Percent") ?? "0";
      const cached = response.headers.get("X-StripFeed-Cache") ?? "MISS";
      const fetchMs = response.headers.get("X-StripFeed-Fetch-Ms") ?? "0";
      const truncated = response.headers.get("X-StripFeed-Truncated") === "true";
    
      const contentType = response.headers.get("content-type") ?? "";
    
      if (contentType.includes("application/json")) {
        const json = await response.json();
        return {
          content: json.markdown,
          tokens: parseInt(tokens),
          originalTokens: parseInt(originalTokens),
          savingsPercent,
          cached,
          fetchMs,
          truncated,
          title: json.title,
        };
      }
    
      const content = await response.text();
      return {
        content,
        tokens: parseInt(tokens),
        originalTokens: parseInt(originalTokens),
        savingsPercent,
        cached,
        fetchMs,
        truncated,
      };
    }
  • TypeScript interface defining the input parameters for the fetch_url tool: url (required), format, selector, model, cache, ttl, and max_tokens (all optional).
    interface FetchParams {
      url: string;
      format?: string;
      selector?: string;
      model?: string;
      cache?: boolean;
      ttl?: number;
      max_tokens?: number;
    }
  • src/index.ts:107-160 (registration)
    Registers the 'fetch_url' tool with the MCP server using the SDK's server.tool() method, including the Zod schema for parameter validation and the async handler that calls fetchUrl() and formats the result.
    server.tool(
      "fetch_url",
      "Convert any URL to clean, token-efficient Markdown. Strips ads, navigation, scripts, and noise. Returns clean content ready for LLM consumption.",
      {
        url: z.string().url().describe("The URL to fetch and convert to Markdown"),
        format: z
          .enum(["markdown", "json", "text", "html"])
          .optional()
          .describe("Output format: markdown (default), json, text, html"),
        selector: z
          .string()
          .optional()
          .describe(
            "CSS selector to extract specific elements (e.g. 'article', '.content', '#main')"
          ),
        model: z
          .string()
          .optional()
          .describe(
            "AI model ID for cost tracking (e.g. 'claude-sonnet-4-6', 'gpt-5')"
          ),
        cache: z
          .boolean()
          .optional()
          .describe("Set to false to bypass cache and force fresh fetch"),
        ttl: z
          .number()
          .optional()
          .describe("Cache TTL in seconds (default 3600, max 86400)"),
        max_tokens: z
          .number()
          .int()
          .positive()
          .optional()
          .describe("Truncate output to fit within this token budget"),
      },
      async (params) => {
        const result = await fetchUrl(params);
    
        const meta = [
          `Tokens: ${result.tokens.toLocaleString()} (saved ${result.savingsPercent}% from ${result.originalTokens.toLocaleString()})`,
          `Cache: ${result.cached}`,
          `Fetch: ${result.fetchMs}ms`,
        ];
        if (result.title) meta.unshift(`Title: ${result.title}`);
        if (result.truncated) meta.push("Truncated: yes");
    
        return {
          content: [
            { type: "text" as const, text: `${meta.join(" | ")}\n\n---\n\n${result.content}` },
          ],
        };
      }
    );
  • Zod schema definitions for runtime validation of the fetch_url tool's input parameters, including url (required URL), format (enum), selector, model, cache (boolean), ttl (number), and max_tokens (positive integer).
    {
      url: z.string().url().describe("The URL to fetch and convert to Markdown"),
      format: z
        .enum(["markdown", "json", "text", "html"])
        .optional()
        .describe("Output format: markdown (default), json, text, html"),
      selector: z
        .string()
        .optional()
        .describe(
          "CSS selector to extract specific elements (e.g. 'article', '.content', '#main')"
        ),
      model: z
        .string()
        .optional()
        .describe(
          "AI model ID for cost tracking (e.g. 'claude-sonnet-4-6', 'gpt-5')"
        ),
      cache: z
        .boolean()
        .optional()
        .describe("Set to false to bypass cache and force fresh fetch"),
      ttl: z
        .number()
        .optional()
        .describe("Cache TTL in seconds (default 3600, max 86400)"),
      max_tokens: z
        .number()
        .int()
        .positive()
        .optional()
        .describe("Truncate output to fit within this token budget"),
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses that the tool strips ads/navigation/scripts and returns clean Markdown, but does not mention rate limits, authentication, error handling, or cost implications (despite a 'model' parameter for cost tracking).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences with no wasted words: first states purpose, second explains noise stripping, third describes output. Information is front-loaded and easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a fetch tool with 7 parameters, the description covers the main action and noise removal adequately. It lacks information on output type differences (markdown vs json vs text) and error behavior, but the schema handles parameter details. Sibling tools exist but no usage guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema covers all 7 parameters with descriptions (100% coverage), so baseline is 3. The description adds no parameter-specific context beyond the overall conversion and noise stripping; it does not explain how format or selector affect output.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool converts any URL to Markdown, stripping ads and noise, which distinguishes it from siblings like batch_fetch (batch operations) and check_usage (usage tracking).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains the tool's core function but provides no explicit guidance on when to use it over alternatives, nor does it mention when not to use it. The context is clear enough for a single-URL converter but lacks comparative advice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/StripFeed/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server