WORLDBOOK

Worldbooks | WebMCP | Search | Submit WebMCP

qidian WebMCP

Browser tool configuration for qidian

URL Pattern: ^https?://(www\.)?qidian\.com(/.*)?$
Allowed Extra Domains: book.qidian.com, qidian.com

Tools (4)

qidian_get_current_book()

Extract book metadata from the current Qidian detail page

Parameters

No parameters

JavaScript Handler

() => {
  const title = document.querySelector('.book-info h1 em, .book-information h1 em, h1 em')?.textContent?.trim() || document.title;
  const author = document.querySelector('.book-info h1 a.writer, .book-information .writer, a.writer')?.textContent?.trim() || '';
  const intro = document.querySelector('.book-intro p, .book-intro-detail, .intro')?.textContent?.replace(/\s+/g, ' ').trim() || '';
  const category = Array.from(document.querySelectorAll('.tag span, .book-info .tag a, .book-information .tag a')).map((node) => node.textContent?.trim()).filter(Boolean);
  return {
    success: true,
    book: {
      title,
      author,
      intro,
      category,
      url: window.location.href
    }
  };
}

qidian_open_book()

Open a Qidian book detail page by book ID

Parameters

bookId string required - Qidian book ID

JavaScript Handler

(params) => {
  window.location.href = 'https://book.qidian.com/info/' + params.bookId + '/';
  return { success: true, message: 'Opening book detail...', bookId: params.bookId };
}

qidian_search()

起点中文网小说搜索

Parameters

query string required - Search keyword (e.g. 仙侠, 系统流)
page string - Page number (default 1)

JavaScript Handler

qidian_search_books()

Search novels on Qidian and return structured results

Parameters

query string required - Search keyword
page number - Page number, default 1
limit number - Maximum results to return, default 10

JavaScript Handler

(params) => {
  if (!params.query) {
    return { success: false, message: 'query is required' };
  }
  const page = Number(params.page || 1) || 1;
  const kw = encodeURIComponent(params.query);
  const url = 'https://www.qidian.com/so/' + kw + '.html' + (page > 1 ? '?page=' + page : '');
  return fetch(url, { credentials: 'include' })
    .then((resp) => resp.ok ? resp.text() : Promise.reject(new Error('HTTP ' + resp.status)))
    .then((html) => {
      const parser = new DOMParser();
      const doc = parser.parseFromString(html, 'text/html');
      const books = [];
      const seen = new Set();
      doc.querySelectorAll('.res-book-item, .book-result-item, li[data-bid], .search-result-page .book-img-text li').forEach((el) => {
        const titleEl = el.querySelector('h2 a, h3 a, h4 a, [class*="title"] a');
        const title = titleEl ? titleEl.textContent.trim() : '';
        if (!title) return;
        const href = titleEl ? (titleEl.getAttribute('href') || '') : '';
        const idMatch = href.match(/\/(?:info|book)\/(\d+)/);
        const bookId = idMatch ? idMatch[1] : (el.getAttribute('data-bid') || null);
        if (bookId && seen.has(bookId)) return;
        if (bookId) seen.add(bookId);
        const text = (el.textContent || '').replace(/\s+/g, ' ').trim();
        const metaMatch = text.match(/([^\s|]{2,})\s*\|([^|]+)\|(\S+)/);
        const wordCountMatch = text.match(/([\d,.]+)\s*万(?:总字数|字)/);
        books.push({
          rank: books.length + 1,
          bookId,
          title,
          author: metaMatch ? metaMatch[1].trim() : '',
          category: metaMatch ? metaMatch[2].trim() : '',
          status: metaMatch ? metaMatch[3].trim() : null,
          wordCount: wordCountMatch ? wordCountMatch[1] + '万字' : null,
          url: bookId ? 'https://book.qidian.com/info/' + bookId + '/' : (href.startsWith('http') ? href : 'https://www.qidian.com' + href)
        });
      });
      return { success: true, query: params.query, page, count: books.length, books: books.slice(0, Number(params.limit || 10) || 10) };
    })
    .catch((error) => ({ success: false, message: error.message }));
}

🔌 Chrome MCP Server Extension

Use these tools with Claude, ChatGPT, and other AI assistants.

Get Extension →

How to Use WebMCP

WebMCP tools are designed for browser extensions or automation frameworks. The browser extension matches the current URL against the pattern and executes the JavaScript handler when the tool is invoked.

API Endpoint:

GET /api/webmcp/match?url=https://www.qidian.com/...