Metadata-Version: 2.4
Name: thodr-mcp
Version: 0.1.2
Summary: MCP server for creating and managing Thodr mock API projects and routes from an AI IDE
Project-URL: Homepage, https://thodr.com
Project-URL: Documentation, https://thodr.com/docs/getting-started
Project-URL: Repository, https://github.com/thodr-hq/thodr-examples
Project-URL: Bug Tracker, https://github.com/thodr-hq/thodr-examples/issues
Author: Thodr
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Testing :: Mocking
Requires-Python: >=3.12
Requires-Dist: httpx>=0.27.0
Requires-Dist: mcp>=1.2.0
Description-Content-Type: text/markdown

# thodr-mcp

Create live mock API endpoints from your AI editor. Ask Cursor, Claude
Desktop, or Copilot to "spin up a mock for the users API" and get back a real,
shareable HTTPS URL in seconds — no dashboard, no curl, no context switch.

`thodr-mcp` is an [MCP](https://modelcontextprotocol.io) server that connects
your AI assistant to [Thodr](https://thodr.com), the hosted mock API platform.
Your editor drives it; it turns the request into real projects and endpoints
on your Thodr account.

## Quick start

**1. Get a token.** In the Thodr web app, open **Settings → Access Tokens**,
create one, and copy it (`thodr_pat_…`, shown once).

**2. Add it to your editor's MCP config:**

```json
{
  "mcpServers": {
    "thodr": {
      "command": "uvx",
      "args": ["thodr-mcp"],
      "env": {
        "THODR_API_URL": "https://thodr.com/api",
        "THODR_TOKEN": "thodr_pat_xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
```

(`uvx` runs it on demand — no manual install. Prefer pip? `pip install
thodr-mcp`. Not sure where the config file lives? Check your editor's MCP
docs — Cursor and Claude Desktop both have a settings page for it.)

**3. Ask your assistant:**

> Create a Thodr project called "orders-api" with a `GET /orders/{id}` endpoint
> that returns a sample order.

You'll get back a live URL like `https://thodr.com/mock/orders-api-a1b2c3/orders/42`
that you can hit immediately, share with a teammate, or point your app at.

## Tools

| Tool | What it does |
|---|---|
| `create_project` | Create a mock project; returns its slug and base mock URL. |
| `list_projects` | List your projects with their mock URLs and route counts. |
| `add_endpoint` | Add an endpoint (method, path, status, body, headers, delay); returns its live URL. |
| `list_endpoints` | List a project's endpoints and their URLs. |
| `get_mock_url` | Build the live URL for a project + path. |

Read and create only — delete projects or endpoints from the web app.

## Good to know

- **Your token is yours.** It acts as you, with your plan's limits, and never
  grants admin. Revoke it anytime from **Settings → Access Tokens**. It's sent
  only to your `THODR_API_URL` and is never logged.
- **It's free to run.** The server makes plain API calls; your editor supplies
  the model, so there's no inference cost here.
- **Self-hosting Thodr?** Point `THODR_API_URL` at your instance (e.g.
  `http://localhost/api`).

Prefer to script the token instead of clicking? While logged in:

```bash
curl -X POST https://thodr.com/api/auth/tokens \
  -H "Authorization: Bearer <your-session-jwt>" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-ide"}'
```

## Development

```bash
cd mcp-server
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest -v
python -m thodr_mcp   # runs the stdio server locally
```
