twitter WebMCP
Browser tool configuration for twitter
Tools (2)
post_tweet()
Insert content into Twitter/X tweet composer
Parameters
JavaScript Handler
(params) => {
const editor = document.querySelector('[data-testid="tweetTextarea_0"]') || document.querySelector('[role="textbox"]') || document.querySelector('.public-DraftEditor-content');
if (!editor) {
return { success: false, message: 'Tweet composer not found. Click the compose button first.' };
}
editor.focus();
// Use clipboard paste method
const dataTransfer = new DataTransfer();
dataTransfer.setData('text/plain', params.content);
const pasteEvent = new ClipboardEvent('paste', { bubbles: true, cancelable: true, clipboardData: dataTransfer });
editor.dispatchEvent(pasteEvent);
const charCount = params.content.length;
const warning = charCount > 280 ? ' (exceeds 280 char limit!)' : '';
return { success: true, message: 'Content inserted (' + charCount + '/280 chars)' + warning };
}
open_compose()
Open the tweet compose dialog
Parameters
No parameters
JavaScript Handler
() => {
const composeBtn = document.querySelector('[data-testid="SideNav_NewTweet_Button"]') || document.querySelector('a[href="/compose/tweet"]');
if (composeBtn) {
composeBtn.click();
return { success: true, message: 'Opening compose dialog...' };
}
window.location.href = 'https://twitter.com/compose/tweet';
return { success: true, message: 'Navigating to compose page...' };
}
WebMCP clients
Use mcp-chrome, or fetch the same tools from the public API in your own browser automation runtime.
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.twitter.com/...
Third-party clients can use the same endpoint as mcp-chrome. Execute the returned JavaScript handler in your own browser page context.