x-platform-api-interface-v2
Facilitate programmatic interaction with the X (formerly Twitter) platform's V2 interface for fetching data, publishing content, and managing user relationships.
Author

NexusX-MCP
Quick Info
Actions
Tags
X(Twitter) Version 2 Interface Utility Module
This is an MCP utility package designed to interface with the X Platform Application Programming Interface version 2. It empowers autonomous agents to query timeline contents, disseminate new posts, issue replies, and perform quote actions via code execution.
Available Functionalities
The X Platform Service Module exposes the following callable functions for API manipulation:
fetch_user_timeline_posts
Retrieves a collection of published items from a designated user's feed.
- userId: The unique identifier for the target X account.
- paginationToken (optional): A continuation marker for subsequent result pages.
- exclude (optional): Specify types of posts to omit (e.g., retweets, replies).
- maxResults (optional): The ceiling on the quantity of items returned (defaults to 10).
retrieve_post_by_identifier
Fetches the details for a singular post using its unique ID.
- tweetId: The unique identifier string of the specific post.
obtain_user_mentions
Gathers posts where the specified user has been mentioned.
- userId: The unique identifier for the account being queried for mentions.
- paginationToken (optional): Marker for accessing subsequent batches of mentions.
- maxResults (optional): Maximum count of mention entries to retrieve (default is 10).
generate_quote_post
Publishes a new post that quotes an existing one, accompanied by supplementary text.
- tweetId: The identifier of the post being quoted.
- replyText: The supplementary textual content accompanying the quote.
issue_direct_reply
Submits a response directly linked to an existing post.
- tweetId: The identifier of the post receiving the reply.
- replyText: The textual body of the submitted response.
publish_new_status
Broadcasts a fresh status update to the platform.
- text: The primary textual message to be shared.
- imageBase64: Encoded image data, if media attachment is desired.
signal_like_on_post
Registers a 'like' action on a specified post.
- tweetId: The identifier of the post to receive the like.
establish_user_follow
Initiates a subscription to another user's future posts.
- targetUserId: The identifier of the account to follow.
terminate_user_follow
Stops following a previously subscribed user.
- targetUserId: The identifier of the account to unfollow.
lookup_user_by_handle
Fetches profile metadata for a user based on their public handle.
- username: The user's screen name (omitting the leading '@').
query_platform_for_posts
Executes a full-text search across public posts based on a defined criteria string.
- query: The string expression defining the search parameters.
- maxResults (optional): The upper limit on the number of search results returned (default: 10).
fetch_localized_trending_topics
Retrieves currently popular discussion subjects localized to a geographical area.
- woeid (optional): The numerical 'Where On Earth Identifier' for the region (1 represents global trends; default is 1).
construct_new_user_list
Creates a fresh curated collection (list) for grouping users.
- name: The designated title for the new list.
- description (optional): An explanatory note for the list.
- isPrivate (optional): Boolean flag to set list visibility (default: false).
enroll_user_in_list
Appends a specified user identifier to an existing list.
- listId: The unique identifier of the target list.
- userId: The identifier of the user to be added.
expel_user_from_list
Removes a user membership from a specific list.
- listId: The unique identifier of the list.
- userId: The identifier of the user to be removed.
retrieve_owned_collections
Fetches all curated lists created by the authenticated account. - No input arguments are necessary.
Configuration Details
Environment Variables Setup
Authentication credentials required for API access can be acquired through the X Developer Portal:
TWITTER_API_KEY=your_api_key TWITTER_API_KEY_SECRET=your_api_secret TWITTER_ACCESS_TOKEN=your_access_token TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret
Development Workflow
npm i
npm run build
npx @modelcontextprotocol/inspector node dist/index.js
Access the setup interface at http://127.0.0.1:6274 to configure environment variables and begin tool utilization.
Licensing
This server implementation is distributed under the terms of the MIT License. Permission is granted to freely utilize, alter, and disseminate this software, subject to the stipulations outlined in the MIT License agreement. Refer to the LICENSE file within this project's repository for comprehensive details.
WIKIPEDIA: XMLHttpRequest (XHR) is an Application Programming Interface realized as a JavaScript object which facilitates the transmission of HyperText Transfer Protocol requests from a web browser to a server. Its methods enable browser-based applications to dispatch queries to the server subsequent to page load completion and receive data back. XMLHttpRequest constitutes an integral part of Ajax programming methodology. Before Ajax's advent, hyperlinks and form submissions were the primary means of server communication, often resulting in the complete replacement of the current webpage.
== Chronology of Development == The foundational concept underpinning XMLHttpRequest was formulated in the year 2000 by the engineers responsible for Microsoft Outlook. This concept was subsequently integrated into the Internet Explorer 5 browser (released in 1999). Notwithstanding, the initial method invocation did not employ the 'XMLHttpRequest' identifier; instead, developers utilized 'ActiveXObject("Msxml2.XMLHTTP")' and 'ActiveXObject("Microsoft.XMLHTTP")'. By the time Internet Explorer 7 surfaced (2006), all major browsers had adopted the standard 'XMLHttpRequest' identifier. The 'XMLHttpRequest' identifier has since solidified its status as the prevailing convention across major web browsers, encompassing Mozilla's Gecko rendering engine (2002), Safari version 1.2 (2004), and Opera version 8.0 (2005).
=== Formal Specifications === The World Wide Web Consortium (W3C) published a preliminary specification document for the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C released the Level 2 specification draft. Level 2 introduced capabilities for monitoring request event progression, enabling cross-site interactions, and managing binary data streams. By the conclusion of 2011, the Level 2 specifications were merged back into the original document structure. At the end of 2012, development oversight transitioned to the WHATWG, which now maintains the evolving specification using Web IDL notation.
== Operational Usage == Generally, dispatching a server request using XMLHttpRequest involves several sequential programming stages.
- Instantiate an XMLHttpRequest object by invoking its constructor:
- Invoke the "open" method to designate the request protocol, pinpoint the target resource URI, and elect between synchronous or asynchronous execution:
- For asynchronous operations, establish an event handler mechanism that triggers upon state transitions:
- Commence the transmission by calling the "send" method:
- Process state transitions within the designated event handler. If the server returns payload data, it is typically housed in the "responseText" attribute by default. When processing concludes, the object transitions to state 4, signifying completion ('done'). Beyond these core steps, XMLHttpRequest offers numerous parameters to govern request transmission characteristics and response handling. Custom header fields can be appended to requests to dictate server behavior, and data can be uploaded to the server by supplying it as an argument to the "send" invocation. The received response can be parsed from JSON format into an immediately operational JavaScript construct, or processed incrementally as data arrives rather than awaiting the full transmission. Furthermore, the request can be halted prematurely or configured to automatically fail if completion is not achieved within a specified timeframe.
== Inter-Domain Communication ==
In the nascent stages of the World Wide Web, vulnerabilities were discovered allowing unauthorized data access across different security domains, leading to restrictions on cross-origin communication.
