pixiv WebMCP
Browser tool configuration for pixiv
Tools (3)
pixiv_detail()
View illustration details (tags, stats, URLs)
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({}, params || {});
let data = null;
let __wbContextUrl = globalThis.location?.href || '';
let __wbContextDocument = globalThis.document || null;
const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);
const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');
const __wbGet = (value, path) => {
if (!path) return value;
return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);
};
const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || 'https://example.com/');
const __wbResolve = (target, base) => {
if (target == null) return '';
const text = String(target);
try {
return /^https?:/i.test(text) ? text : new URL(text, base || __wbBaseUrl()).toString();
} catch (_error) {
return text;
}
};
const __wbFetch = async (target, options) => {
const url = __wbResolve(target, __wbBaseUrl());
const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));
if (!resp.ok) {
throw new Error(`HTTP ${resp.status} for ${url}`);
}
const text = await resp.text();
try {
return { url, text, data: JSON.parse(text) };
} catch (_error) {
return { url, text, data: text };
}
};
return (async () => {
{
const __wbResp = await __wbFetch("https://www.pixiv.net");
__wbContextUrl = __wbResp.url;
__wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');
data = __wbContextDocument;
}
{
const document = __wbContextDocument || globalThis.document;
const location = new URL(__wbBaseUrl());
const window = { document, location };
const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));
data = await (((async () => {
const id = ((args.id));
const res = await fetch(
'https://www.pixiv.net/ajax/illust/' + id,
{ credentials: 'include' }
);
if (!res.ok) {
if (res.status === 401 || res.status === 403) throw new Error('Authentication required — please log in to Pixiv in Chrome');
if (res.status === 404) throw new Error('Illustration not found: ' + id);
throw new Error('Pixiv request failed (HTTP ' + res.status + ')');
}
const data = await res.json();
const b = data?.body;
if (!b) throw new Error('Illustration not found');
return [{
illust_id: b.illustId,
title: b.illustTitle,
author: b.userName,
user_id: b.userId,
type: b.illustType === 0 ? 'illust' : b.illustType === 1 ? 'manga' : b.illustType === 2 ? 'ugoira' : String(b.illustType),
pages: b.pageCount,
bookmarks: b.bookmarkCount,
likes: b.likeCount,
views: b.viewCount,
tags: (b.tags?.tags || []).map(t => t.tag).join(', '),
created: b.createDate?.split('T')[0] || '',
url: 'https://www.pixiv.net/artworks/' + b.illustId
}];
})())());
}
return data;
})();
}
pixiv_ranking()
Pixiv illustration rankings (daily/weekly/monthly)
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({"mode": "daily", "page": 1, "limit": 20}, params || {});
let data = null;
let __wbContextUrl = globalThis.location?.href || '';
let __wbContextDocument = globalThis.document || null;
const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);
const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');
const __wbGet = (value, path) => {
if (!path) return value;
return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);
};
const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || 'https://example.com/');
const __wbResolve = (target, base) => {
if (target == null) return '';
const text = String(target);
try {
return /^https?:/i.test(text) ? text : new URL(text, base || __wbBaseUrl()).toString();
} catch (_error) {
return text;
}
};
const __wbFetch = async (target, options) => {
const url = __wbResolve(target, __wbBaseUrl());
const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));
if (!resp.ok) {
throw new Error(`HTTP ${resp.status} for ${url}`);
}
const text = await resp.text();
try {
return { url, text, data: JSON.parse(text) };
} catch (_error) {
return { url, text, data: text };
}
};
return (async () => {
{
const __wbResp = await __wbFetch("https://www.pixiv.net");
__wbContextUrl = __wbResp.url;
__wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');
data = __wbContextDocument;
}
{
const document = __wbContextDocument || globalThis.document;
const location = new URL(__wbBaseUrl());
const window = { document, location };
const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));
data = await (((async () => {
const mode = ((args.mode));
const page = ((args.page));
const limit = ((args.limit));
const res = await fetch(
'https://www.pixiv.net/ranking.php?mode=' + mode + '&p=' + page + '&format=json',
{ credentials: 'include' }
);
if (!res.ok) {
if (res.status === 401 || res.status === 403) throw new Error('Authentication required — please log in to Pixiv in Chrome');
throw new Error('Pixiv request failed (HTTP ' + res.status + ')');
}
const data = await res.json();
const items = (data?.contents || []).slice(0, limit);
return items.map((item, i) => ({
rank: item.rank,
title: item.title,
author: item.user_name,
user_id: item.user_id,
illust_id: item.illust_id,
pages: item.illust_page_count,
bookmarks: item.illust_bookmark_count,
url: 'https://www.pixiv.net/artworks/' + item.illust_id
}));
})())());
}
return data;
})();
}
pixiv_user()
View Pixiv artist profile
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({}, params || {});
let data = null;
let __wbContextUrl = globalThis.location?.href || '';
let __wbContextDocument = globalThis.document || null;
const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);
const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');
const __wbGet = (value, path) => {
if (!path) return value;
return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);
};
const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || 'https://example.com/');
const __wbResolve = (target, base) => {
if (target == null) return '';
const text = String(target);
try {
return /^https?:/i.test(text) ? text : new URL(text, base || __wbBaseUrl()).toString();
} catch (_error) {
return text;
}
};
const __wbFetch = async (target, options) => {
const url = __wbResolve(target, __wbBaseUrl());
const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));
if (!resp.ok) {
throw new Error(`HTTP ${resp.status} for ${url}`);
}
const text = await resp.text();
try {
return { url, text, data: JSON.parse(text) };
} catch (_error) {
return { url, text, data: text };
}
};
return (async () => {
{
const __wbResp = await __wbFetch("https://www.pixiv.net");
__wbContextUrl = __wbResp.url;
__wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');
data = __wbContextDocument;
}
{
const document = __wbContextDocument || globalThis.document;
const location = new URL(__wbBaseUrl());
const window = { document, location };
const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));
data = await (((async () => {
const uid = ((args.uid));
const res = await fetch(
'https://www.pixiv.net/ajax/user/' + uid + '?full=1',
{ credentials: 'include' }
);
if (!res.ok) {
if (res.status === 401 || res.status === 403) throw new Error('Authentication required — please log in to Pixiv in Chrome');
if (res.status === 404) throw new Error('User not found: ' + uid);
throw new Error('Pixiv request failed (HTTP ' + res.status + ')');
}
const data = await res.json();
const b = data?.body;
if (!b) throw new Error('User not found');
return [{
user_id: uid,
name: b.name,
premium: b.premium ? 'Yes' : 'No',
following: b.following,
illusts: typeof b.illusts === 'object' ? Object.keys(b.illusts).length : (b.illusts || 0),
manga: typeof b.manga === 'object' ? Object.keys(b.manga).length : (b.manga || 0),
novels: typeof b.novels === 'object' ? Object.keys(b.novels).length : (b.novels || 0),
comment: (b.comment || '').slice(0, 80),
url: 'https://www.pixiv.net/users/' + uid
}];
})())());
}
return data;
})();
}
🔌 Chrome MCP Server Extension
Use these tools with Claude, ChatGPT, and other AI assistants.
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.pixiv.com/...