# Initialize your Wrk Momentum project

Create your first project folder, or connect an existing one, for working on and
building Wrkflows with your AI agent. Your agent prepares the settings,
you add your API key locally, then reconnect or restart your app to verify.
The Wrk Momentum marketplace plugin supplies skills only; install it separately
from your workspace marketplace if available. The MCP works without the plugin.
The downloadable ZIP is a Codex plugin, not a Claude Code plugin package.
The instructions include Codex and Claude Code examples. For another agent, use
its own MCP configuration and credential handling; plugin packaging and MCP
connectivity are separate. Local folder initialization requires project-file
access. If the agent cannot access local files, leave folder initialization pending.

If the initialization skill is available to your agent, ask:

> Use the Initialize Wrkflow Project skill to initialize my first Wrk Momentum project folder, help me choose my Wrk environment, and guide me through local API-key entry, restart, and verification.

## Instructions for the setup agent

1. Establish the consuming folder and client. Reuse the intended open project, or
   ask for a new folder's name and parent location before creating it. Do not edit
   an unrelated open folder or configure the MCP server repository unless it is
   the intended project. No source checkout, Node installation, Git repository,
   or app scaffold is required. Explain how to open a new folder in the client.
   Detect the current agent; for another client, consult its current MCP docs for
   project scope, custom headers, credential storage, and reconnect instructions.
   Never assume that agent uses one of the example formats or timeout units.
   If required capabilities are missing, explain them and keep setup pending.
2. Reuse the user's selected environment and any working connection. For a new
   connection with no selection, ask Production (normal Wrk account, recommended)
   or Staging (staging account). These are existing platforms; setup does not
   create a Wrk account, platform environment, or Wrkflow. Never silently switch
   an existing connection's environment or replace a working credential.
3. Discover native tools and inspect existing MCP settings without printing
   credentials. Merge the named client's example or its documented equivalent,
   preserving unrelated settings and updating the existing wrk entry rather than
   creating duplicates. Preserve existing environment-managed credentials. Before
   local key entry, ignore the actual credential-bearing config and /.wrk/setup.md
   in the consuming folder's .gitignore. Codex uses /.codex/config.toml; Claude Code
   uses /.mcp.json. Other agents use their actual file or supported credential
   store; do not create one of these example files for them. Check tracking only
   in a Git repository; if the credential-bearing file is tracked, resolve secret
   storage before key entry. Claude Code supports "Authorization": "Api-Key ${WRK_API_KEY}"
   when the user already manages that environment variable.
4. Leave any key placeholder. Give the matching API-key page and the documented
   credential-entry UI or absolute config path and Authorization field. For the
   examples, ask the user to replace only <your-wrk-api-key> locally, keeping the
   Api-Key prefix and space, then save. Never ask for the key in chat or on this
   setup website, read it back, enter it through agent-controlled UI, load it into
   agent-written code, or commit it. A working connection needs no new key entry.
5. Before handing off, write .wrk/setup.md with only the client, environment, MCP
   URL, config path or location of connection settings, pending step, restart
   instructions, and a copyable resume prompt. No keys, header values,
   fingerprints, account details, or tool payloads.
   Report configuration prepared / waiting for local key entry and restart;
   editing a file is not connection verification. Give the user the resume prompt
   now so it remains available after restarting the app.
6. Codex: open/trust this folder, reconnect MCP, and start a new chat. If tools stay
   missing or show old context, fully quit and reopen the app in this folder.
   Claude Code: approve project MCP when prompted and check /mcp; restart the
   session if needed. For another agent, use its documented MCP reconnect/restart
   procedure. After the user returns, read .wrk/setup.md, reconcile its
   context with the current project/request, and invoke the
   native list_wrkflows tool. Missing tools mean setup is pending; diagnose client
   loading. A curl/Python or raw JSON-RPC probe does not verify the client's MCP
   connection.
7. Report native connectivity and intended-account confirmation separately.
   Before writes, compare a known account-specific Wrkflow (using its UUID when
   available) with what the user expects in Wrk. A successful call, empty list,
   matching name, or shared catalog metadata alone does not establish identity.
   If ambiguous, ask the user to confirm the account in Wrk and keep account
   confirmation pending. If old context persists, stop before writes. Update the
   note's pending step without copying business data. Offer to design the first
   Wrkflow once ready; do not create, change, or launch a Wrkflow to test setup.

## Resume after adding your key and restarting

Open the same project folder and paste:

> Read https://wrk-platform-mcp.vercel.app/setup.md and resume this project's Wrkflow initialization from .wrk/setup.md. I added the API key locally and reconnected or restarted the client. Verify the native connection and intended account without creating, changing, or launching a Wrkflow.

The handoff note contains no credentials. It records what remains to be verified;
its presence does not prove that the active client loaded the connection.

## Choose the Wrk platform

The MCP URL stays https://wrk-platform-mcp.vercel.app/mcp for both environments.
Set X-Wrk-Environment on every request:

| Header | Wrk Public API | API key page |
| --- | --- | --- |
| prod (default) | https://api.wrk.com/v1 | https://account.wrk.com/v2/api-key |
| stag | https://api.stag.wrk.com/v1 | https://account.stag.wrk.com/v2/api-key |

Omitting the header uses prod. Other values are rejected before contacting Wrk.
The selection is scoped to the request, including nested calls and polling.
Use the matching environment's key. Changing the header changes the platform
target for reads and writes; reconnect the client after changing it.

## Codex: project .codex/config.toml

Production:

```toml
[mcp_servers.wrk]
url = "https://wrk-platform-mcp.vercel.app/mcp"
tool_timeout_sec = 800

[mcp_servers.wrk.http_headers]
Authorization = "Api-Key <your-wrk-api-key>"
X-Wrk-Environment = "prod"
```

Staging:

```toml
[mcp_servers.wrk]
url = "https://wrk-platform-mcp.vercel.app/mcp"
tool_timeout_sec = 800

[mcp_servers.wrk.http_headers]
Authorization = "Api-Key <your-wrk-api-key>"
X-Wrk-Environment = "stag"
```

No user-level config is required. A .codex/.env file is not automatically loaded.
The skills-only plugin does not need a plugin-scoped mcp_servers disable block.
If an older installed Wrk plugin still bundles an MCP, update or disable that
older connection so only the intended project connection remains enabled.

## Claude Code: project .mcp.json

Claude Code uses JSON for MCP settings, not config.toml. These examples are for
Claude Code, not Claude Desktop or a Claude web connector.

Production:

```json
{
  "mcpServers": {
    "wrk": {
      "type": "http",
      "url": "https://wrk-platform-mcp.vercel.app/mcp",
      "timeout": 800000,
      "headers": {
        "Authorization": "Api-Key <your-wrk-api-key>",
        "X-Wrk-Environment": "prod"
      }
    }
  }
}
```

Staging:

```json
{
  "mcpServers": {
    "wrk": {
      "type": "http",
      "url": "https://wrk-platform-mcp.vercel.app/mcp",
      "timeout": 800000,
      "headers": {
        "Authorization": "Api-Key <your-wrk-api-key>",
        "X-Wrk-Environment": "stag"
      }
    }
  }
}
```

Claude Code's timeout is in milliseconds; Codex's tool_timeout_sec is in seconds.
Use current client versions. These settings do not extend the hosting deadline.
Prefer asynchronous submission and later inspection when a deadline is shorter.

## Other MCP-compatible agents

Use your agent's documented MCP connection settings with these values:

- MCP URL: https://wrk-platform-mcp.vercel.app/mcp
- Authorization header: Api-Key <your-wrk-api-key>
- X-Wrk-Environment header: prod or stag

Your agent should identify its actual config path or supported credential-entry
UI, guide you to enter the key there yourself, and explain how to reconnect.
Do not copy a Codex or Claude Code config into a different agent unless its
documentation explicitly supports that format. If custom headers or project-file
access are unavailable, explain that limitation and leave the affected step pending.

## Troubleshooting

- MCP HTTP 401: the Authorization header is missing or malformed. It must be
  Api-Key followed by a space and the key. No MCP OAuth sign-in is required.
- Upstream 403: check the selected environment, key validity, and Wrk permissions.
- INVALID_ENVIRONMENT: use exactly prod or stag.
- Third-party Connected Accounts are separate from MCP authentication.
- The server uses the caller's key on every request; it has no shared Wrk key.

Client documentation:
- https://learn.chatgpt.com/docs/extend/mcp
- https://code.claude.com/docs/en/mcp
