x_mcp_server/lib.rs
1//! X (Twitter) MCP Server
2//!
3//! A Model Context Protocol (MCP) server that provides access to X (Twitter) API
4//! for basic utilities like posting tweets, getting user information, and more.
5//!
6//! ## Features
7//!
8//! - **User Information**: Get user profiles by username or ID
9//! - **Tweet Operations**: Post tweets, reply to tweets, get specific tweets
10//! - **Search**: Search for tweets with various filters
11//! - **User Timeline**: Get a user's recent tweets
12//! - **OAuth 1.0a**: Secure authentication with X API
13//!
14//! ## Usage
15//!
16//! ```rust,no_run
17//! use x_mcp_server::XMcpServer;
18//!
19//! #[tokio::main]
20//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
21//! // Create and run server (requires X_BEARER_TOKEN env var)
22//! let server = XMcpServer::from_env()?;
23//! server.run_stdio().await?;
24//! Ok(())
25//! }
26//! ```
27
28pub mod client;
29pub mod error;
30pub mod server;
31pub mod types;
32
33pub use client::XClient;
34pub use error::{XError, XResult};
35pub use server::XMcpServer;
36
37/// Version of the X MCP Server
38pub const VERSION: &str = env!("CARGO_PKG_VERSION");
39
40#[cfg(test)]
41mod tests {
42 use super::*;
43
44 #[test]
45 fn test_version() {
46 assert!(!VERSION.is_empty());
47 assert!(VERSION.chars().next().unwrap().is_ascii_digit());
48 }
49}