stackoverflow WebMCP
Browser tool configuration for stackoverflow
Tools (4)
stackoverflow_bounties()
Active bounties on Stack Overflow
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({"limit": 10}, 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://api.stackexchange.com/2.3/questions/featured?order=desc&sort=activity&site=stackoverflow");
data = __wbResp.data;
}
data = __wbGet(data, "items");
{
const source = Array.isArray(data) ? data : (data == null ? [] : [data]);
data = source.map((item, index) => ({
"title": item.title,
"bounty": item.bounty_amount,
"score": item.score,
"answers": item.answer_count,
"url": item.link,
}));
}
if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);
return data;
})();
}
stackoverflow_hot()
Hot Stack Overflow questions
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({"limit": 10}, 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://api.stackexchange.com/2.3/questions?order=desc&sort=hot&site=stackoverflow");
data = __wbResp.data;
}
data = __wbGet(data, "items");
{
const source = Array.isArray(data) ? data : (data == null ? [] : [data]);
data = source.map((item, index) => ({
"title": item.title,
"score": item.score,
"answers": item.answer_count,
"url": item.link,
}));
}
if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);
return data;
})();
}
stackoverflow_search()
Search Stack Overflow questions
Parameters
JavaScript Handler
(params) => {
const run = async function(args) {
if (!args.query) return {error: 'Missing argument: query', hint: 'Provide a search query string'};
const count = Math.min(parseInt(args.count) || 10, 50);
const url = 'https://api.stackexchange.com/2.3/search?order=desc&sort=relevance&intitle='
+ encodeURIComponent(args.query)
+ '&site=stackoverflow&pagesize=' + count;
const resp = await fetch(url);
if (!resp.ok) return {error: 'HTTP ' + resp.status};
const data = await resp.json();
if (data.error_id) return {error: data.error_name, message: data.error_message};
const items = data.items || [];
return {
query: args.query,
count: items.length,
has_more: data.has_more,
quota_remaining: data.quota_remaining,
questions: items.map(q => ({
id: q.question_id,
title: q.title,
url: q.link,
score: q.score,
answers: q.answer_count,
views: q.view_count,
tags: q.tags,
author: q.owner?.display_name,
is_answered: q.is_answered,
created: q.creation_date,
last_activity: q.last_activity_date
}))
};
};
return run(params || {});
}
stackoverflow_unanswered()
Top voted unanswered questions on Stack Overflow
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({"limit": 10}, 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://api.stackexchange.com/2.3/questions/unanswered?order=desc&sort=votes&site=stackoverflow");
data = __wbResp.data;
}
data = __wbGet(data, "items");
{
const source = Array.isArray(data) ? data : (data == null ? [] : [data]);
data = source.map((item, index) => ({
"title": item.title,
"score": item.score,
"answers": item.answer_count,
"url": item.link,
}));
}
if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);
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.stackoverflow.com/...