The OneLence MCP server works in coding agents as well as in chat apps. Connect it to Claude Code, Cursor or Codex and the agent can add OneLence tracking to your app, define the conversion events you care about and confirm that events arrive. It can also answer the same growth questions you would ask in Claude or ChatGPT, without leaving the editor.
Connect your agent
Claude Code
claude mcp add --transport http onelence https://mcp.onelence.com
Then run /mcp in Claude Code to sign in. For CI or scripts without a browser, pass a personal access token from Settings → Developer in OneLence:
claude mcp add --transport http onelence https://mcp.onelence.com --header "Authorization: Bearer olpat_..."
Cursor
Add a remote (Streamable HTTP) MCP server with the URL https://mcp.onelence.com. Clients that support MCP sign-in open the OneLence sign-in page; otherwise send a personal access token as the Authorization: Bearer header.
Codex
The OneLence plugin for Codex, with its setup steps, is in the public onelence-ai-plugins repository. The same repository has the plugins for Claude Code and Cursor.
Editors without remote MCP
Clients that can't connect to a remote server can use the OneLence command line as a local bridge. It signs you in through the browser on first run and forwards every message to the OneLence server:
{
"mcpServers": {
"onelence": {
"command": "npx",
"args": ["-y", "onelence", "mcp"]
}
}
}
What your agent can do
| Ask your agent | What happens |
|---|---|
| "Install OneLence on this site." | It reads the setup instructions for your stack, registers the site if needed and adds the tracking code |
| "Track demo bookings as a conversion." | It defines the conversion event, shows you a summary and saves it after you confirm |
| "Is tracking working? Did any signup events arrive in the last hour?" | It checks event and conversion counts for that hour and says what to look at when nothing arrived |
| "What should I focus on today?" | The same daily briefing you get in Claude or ChatGPT |
Registering a site or changing conversion events needs an Owner or Admin role in the OneLence workspace.
Keys stay out of chat and code
Secret keys are never returned through the MCP server, and agents are told to keep ONELENCE_SECRET_KEY in your server's environment variables. Every change your agent makes in OneLence is shown to you as a summary first and saved only after you confirm.
From the terminal
The onelence command line uses the same account and works in scripts:
npx onelence login # sign in, choose a workspace and approve
npx onelence briefing # today's priorities and recommendations
Every command takes --json. In CI, set ONELENCE_TOKEN to a personal access token instead of signing in.
Frequently asked questions
How do I add OneLence to Claude Code?
Run claude mcp add --transport http onelence https://mcp.onelence.com, then run /mcp in Claude Code to sign in.
Can I connect from CI or a script without a browser?
Yes. Create a personal access token in OneLence under Settings, then Developer, and send it as an Authorization: Bearer header. The onelence command line reads the same token from ONELENCE_TOKEN.
My editor doesn't support remote MCP servers. Can I still connect?
Yes. Run the OneLence command line as a local bridge with the command npx -y onelence mcp. It signs you in through the browser on first run and forwards every message to the OneLence server.
Will the agent put my secret key in the code?
No. Secret keys are never returned in chat, and agents are told to keep ONELENCE_SECRET_KEY in your server's environment variables.
