# Repository Briefing: xdevplatform/xmcp
> Source: https://repoforai.com/repo/xdevplatform/xmcp (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/xdevplatform/xmcp
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: Python
- **License**: See repository
- **Engineering Health**: C (34/100 · Maintenance 6/35 · Adoption 16/25 · Releases 6/20 · License 6/20)
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: MCP, Self-Hosted, CLI, API
- **Momentum**: 873 ★ total (+1 24h / +1 7d) · 122 forks
- **When to Use**: Best for: Developers with an X Developer Platform app and an MCP client who want to expose a small set of X operations for local integration or controlled internal use. Skip if: You need offline access, streaming or webhook delivery, a stable versioned tool contract, or unattended remote operation without building and validating additional authentication controls.

## Overview
```text
### Architecture & Core Mechanics
xmcp is a Python bridge from MCP clients to the X API. On startup, server.py fetches https://api.twitter.com/2/openapi.json and uses FastMCP to expose eligible OpenAPI operations as tools. The HTTP endpoint defaults to http://127.0.0.1:8000/mcp, and X API calls default to https://api.x.com. This keeps tool registration schema-driven rather than requiring a separate wrapper for every operation.

The dependency list includes fastmcp, httpx, python-dotenv, requests-oauthlib, xdk, and xai-sdk. The service is configured through environment variables, including those loaded from a local .env file. Its startup flow opens a browser for OAuth1 consent and waits on a local callback; obtained tokens stay in process memory. The optional test_grok_mcp.py client exercises the MCP endpoint through xAI and is separate from the server runtime path.

### Key Capabilities & Differentiators
The tool catalog spans user lookup, recent post search, post analytics, lists, bookmarks, and direct messages, and includes writes such as createPosts and deletePosts. X_API_TOOL_ALLOWLIST takes comma-separated OpenAPI operation IDs, so a deployment can expose only getUsersByUsername and searchPostsRecent, for example. Filtering happens when the schema is loaded, so changing the list requires a restart.

Streaming and webhook coverage is deliberately excluded: matching paths containing /stream or /webhooks, operations tagged Stream or Webhooks, and operations marked x-twitter-streaming: true are filtered out. Tool registration does not guarantee authorization at X, and an allowlist controls what MCP exposes rather than changing what the app or user token is authorized to do.

### Trade-offs & Limitations
The schema-driven design saves wrapper maintenance and gives an existing MCP client broad X API reach, but it also ties startup and tool registration to a live upstream specification. Upstream operation or schema changes can affect the available tools after a restart. The dependencies in requirements.txt are unpinned, so a deployment that needs reproducible builds should validate and lock a working set.

Direct API integration is a better fit for a fixed application that needs explicit request handling or streaming and webhooks; a hand-written MCP adapter can keep a small tool contract stable at the cost of more maintenance. Here, browser consent and process-only OAuth1 storage mean restarts need planning for unattended use. Before wider deployment, restrict the tool surface, verify how clients are authenticated, and resolve the unspecified license before redistribution or commercial bundling.

### Hardware & Deployment Guide
The local setup calls for Python 3.9+, a virtual environment, dependencies installed from requirements.txt, and an X Developer Platform app. Copy env.example to .env and set X_OAUTH_CONSUMER_KEY, X_OAUTH_CONSUMER_SECRET, and X_BEARER_TOKEN; the bearer token remains required in this setup even when using OAuth1. Register the callback URL, which defaults to http://127.0.0.1:8976/oauth/callback, then start the service with python server.py and complete browser consent.

This is a self-hosted bridge, not an offline X backend: startup needs the remote spec and tool calls go to X. The optional Grok client also needs an xAI API key. A remote client can reach /mcp through a tunnel, but verify client access controls before exposing an account-backed service. X_API_DEBUG defaults to 1, so review log handling and leave credential-printing options disabled in normal operation. No container manifest or published release is listed, and the optional OAuth2 helper generate_authtoken.py is not in the supplied root tree; verify its availability before relying on that path.
```

## Key Capabilities
```text
- Schema-driven registration: FastMCP builds tools from the X OpenAPI document fetched from api.twitter.com at startup.
- Explicit exclusions: Path, tag, and x-twitter-streaming rules keep streaming and webhook operations out of the tool catalog.
- Startup allowlist: X_API_TOOL_ALLOWLIST selects operation IDs such as getUsersByUsername and searchPostsRecent; changes require a restart.
- Write access deserves review: createPosts and deletePosts are listed tool IDs, so a read-only deployment should explicitly omit them.
- Credential lifecycle: OAuth1 uses browser consent and a local callback, with tokens kept in memory for the server process lifetime.
- Integration check: test_grok_mcp.py exercises the MCP endpoint via xAI; the default server endpoint is http://127.0.0.1:8000/mcp.
```

## Quick Start / Clone
```bash
http://<X_OAUTH_CALLBACK_HOST>:<X_OAUTH_CALLBACK_PORT><X_OAUTH_CALLBACK_PATH>
```
