# Connect Hark — Your own agents, scripts, and workflows (headless)

Use a personal access token (create one on the Connections page). Send it as a Bearer header — no browser sign-in needed.

curl smoke test:

```
curl -X POST https://harkstudio.io/mcp \
  -H "Authorization: Bearer hark_pat_..." \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

TypeScript — @modelcontextprotocol/sdk:

```
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(new URL("https://harkstudio.io/mcp"), {
  requestInit: { headers: { Authorization: `Bearer ${process.env.HARK_PAT}` } },
});

const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);

console.log(await client.listTools());
console.log(await client.callTool({ name: "list_workspaces", arguments: {} }));
```

Python — mcp:

```
import os, asyncio
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

async def main():
    headers = {"Authorization": f"Bearer {os.environ['HARK_PAT']}"}
    async with streamablehttp_client("https://harkstudio.io/mcp", headers=headers) as (read, write, _):
        async with ClientSession(read, write) as session:
            await session.initialize()
            print(await session.list_tools())
            print(await session.call_tool("list_workspaces", {}))

asyncio.run(main())
```

n8n / Make / Zapier: use the MCP client node (or a plain HTTP request to https://harkstudio.io/mcp) with the token as a Bearer header.

[Features: Personal access tokens](https://harkstudio.io/features#personal-access-tokens)

## Recommended tool flow for agents

- list_workspaces
- search_ventures / get_venture_context
- create_venture or fork_venture
- update docs (update_venture_business, update_claude_md)
- move_stage
- add_journal_entry

Every write is attributed in the activity log — token calls show up as the token's name.

## Verify it works

Ask your client: "List my Hark workspaces." Expected: your workspace names.

Then: "Create a project called Connection test in <workspace>." Expected: a new V-### appears in the app and the activity log shows the source ("via Claude Code", "via Codex", etc.). Delete the test venture afterward.

## Troubleshooting

- "Unauthorized request origin" — the client origin isn't allowlisted; retry from the latest app version, or email hello@harkstudio.io.
- Consent screen loops / stale token — remove the connector in the client, sign out of Hark, sign back in, re-add the connector.
- Tools list is empty — the connector isn't enabled for this chat (Claude and ChatGPT require enabling it per conversation).
- Plan cap error — you've hit the monthly agent-call cap for this workspace; see billing.
- Old endpoint — anything pointing at a lovable.app URL must be updated to harkstudio.io/mcp.
