# MCP X Server
What can you do with MCP X Server? Give it a sentence or a topic, and it will help you write and refine a tweet, then publish it to X.

## Build image
```shell
docker build -t mcp-x-server:latest .
```

## How to run with STDIO

### Local
```json
{
    "mcpServices": {
        "x-mcp": {
            "command": "uv",
            "args": [
                "run",
                "--with",
                "fastmcp",
                "--with",
                "pydantic-ai",
                "--with",
                "pydantic-ai-slim[duckduckgo,openai]",
                "--with",
                "dotenv",
                "--with",
                "python-twitter-v2",
                "fastmcp",
                "run",
                "/Users/wenyanglu/Workspace/ai/mcp_x_server/server.py"
            ],
            "env": {
                "CONSUMER_KEY": "*******************",,
                "CONSUMER_SECRET": "*******************",
                "ACCESS_TOKEN": "*******************",
                "ACCESS_SECRET": "*******************",
                "DEEPSEEK_API_KEY": "*******************"
            }
        }
    }
}
```

### Docker
```shell
docker run -i \
  -e CONSUMER_KEY="your-consumer-key" \
  -e CONSUMER_SECRET="your-consumer-secret" \
  -e ACCESS_TOKEN="your-access-token" \
  -e ACCESS_SECRET="your-access-secret" \
  -e DEEPSEEK_API_KEY="your-deepseek-key" \
  mcp-x-server:latest
```

## Run with SSE
```shell
fastmcp run --transport sse server.py
```
---
Upload

First step: Generating distribution archives
```shell
python3 -m pip install --upgrade build
```
> uv pip install --upgrade build

```shell
python3 -m build
```

Second step: Uploading the distribution archives
```shell
python3 -m pip install --upgrade twine
```
> uv pip install --upgrade twine

Once installed, run Twine to upload all of the archives under dist:
```shell
python3 -m twine upload --repository testpypi dist/*
```
Once uploaded, your package should be viewable on TestPyPI; for example: https://test.pypi.org/project/example_package_YOUR_USERNAME_HERE.


Use `twine upload dist/*` to upload your package and enter your credentials for the account you registered on the real PyPI. 

---
[setup.py template](https://github.com/kennethreitz/setup.py)