# Tines MCP Server for Claude Code
A Tines story that exposes 31 API tools via [MCP](https://modelcontextprotocol.io/) (Model Context Protocol), enabling Claude Code to build, manage, and document Tines workflows directly. Includes a Claude Code skill (`/tines`) with action type reference, formula docs, and workflow patterns.
## What's Here
| File | Purpose |
|------|---------|
| `generate_mcp.py` | Python script that generates the MCP server Tines story |
| `CLAUDE.md` | Claude Code project configuration (fill in your tenant details) |
| `.mcp.json.example` | MCP connection template |
| `skills/tines/SKILL.md` | Main skill — invoked via `/tines` in Claude Code |
| `skills/tines/action-types.md` | `options_json` schemas for each action type |
| `skills/tines/formulas.md` | Tines formula function reference |
| `skills/tines/mcp-reference.md` | MCP server deployment guide |
| `skills/tines/api-reference.md` | API endpoints not covered by MCP tools |
## Quick Start
### 1. Generate the MCP server story
Edit `TENANT_URL` at the top of `generate_mcp.py` to match your Tines tenant, then:
```bash
python3 generate_mcp.py
```
This produces `story_export.json` containing the full MCP server story.
### 2. Import into Tines
```bash
curl -X POST -H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
"$TENANT_URL/api/v1/stories/import" \
-d "{\"new_name\": \"claude-mcp\", \"team_id\": $TEAM_ID, \"data\": $(cat story_export.json)}"
```
Note the `id` from the response — this is your MCP story ID.
### 3. Create the API credential
Create a Tines credential named `tines_api_key` with your API key value. Add your tenant domain to `allowed_hosts` so the MCP tools can call the API.
### 4. Get MCP connection details
```bash
curl -s -H "Authorization: Bearer $API_KEY" \
"$TENANT_URL/api/v1/actions?story_id=$STORY_ID" | python3 -c "
import json, sys
for a in json.load(sys.stdin)['agents']:
if a['options'].get('mode') == 'mcp':
print(f'Path: {a[\"options\"][\"path\"]}')
print(f'Secret: {a[\"options\"][\"secret\"]}')
"
```
### 5. Connect Claude Code
```bash
claude mcp add -t http -s project tines \
-H "Authorization: Bearer $MCP_SECRET" \
"$TENANT_URL/mcp/$MCP_PATH"
```
Or copy `.mcp.json.example` to `.mcp.json` and fill in the values.
### 6. Install the skill
The `/tines` skill is automatically available when this repo is your working directory (via the symlink in `.claude/skills/tines`). Type `/tines` in Claude Code to invoke it.
## Tools (31)
| Category | Tools |
|----------|-------|
| **Stories** | list_stories, get_story, create_story, update_story, delete_story, export_story, import_story |
| **Actions** | list_actions, get_action, create_action, update_action, delete_action, list_action_events, delete_links |
| **Notes** | list_notes, get_note, create_note, update_note, delete_note |
| **Events** | list_story_events, get_event |
| **Resources** | list_resources, get_resource, create_resource, update_resource, delete_resource |
| **Discovery** | list_teams, list_credentials, list_folders |
| **Testing** | run_action, reemit_event |
## Customization
To add new tools, edit `generate_mcp.py`:
- **Simple tools** (GET/DELETE): Use `make_tool()` — see `list_notes` for an example
- **Complex tools** (POST/PUT/PATCH with assembled payloads): Use `make_tool_with_transform()` — see `create_note` for an example
Regenerate with `python3 generate_mcp.py` and reimport to deploy changes.
## Reference Docs
- **[SKILL.md](skills/tines/SKILL.md)** — Full MCP tools reference, action types, linking, layout, common patterns
- **[action-types.md](skills/tines/action-types.md)** — Detailed `options_json` schemas for Webhook, HTTP, Transform, Trigger, etc.
- **[formulas.md](skills/tines/formulas.md)** — Tines formula functions (logic, text, arrays, objects, dates, crypto)
- **[mcp-reference.md](skills/tines/mcp-reference.md)** — Deployment guide with troubleshooting
- **[api-reference.md](skills/tines/api-reference.md)** — API endpoints for operations not yet covered by MCP tools