Connect the OpenAI Agents SDK to didtheyopen
Updated 24 November 2026
Open tracking for the email your agent already sends from your Gmail or Outlook.
This page shows how to connect the hosted MCP server com.didtheyopen/mcp so
an agent built with OpenAI Agents SDK can track opens on the email it already sends from
Gmail or Outlook. The server is https://p.didtheyopen.com/mcp. Nothing from
didtheyopen is installed on the agent. The agent key goes in the Authorization header,
never in the URL.
Client reference: OpenAI Agents SDK MCP reference.
The server
- Registry name:
com.didtheyopen/mcp - URL:
https://p.didtheyopen.com/mcp -
Transport: Streamable HTTP, one JSON-RPC message per POST. Send
Accept: application/json, text/event-stream. GET and DELETE return 405. -
Auth:
Authorization: Bearer <agent key>. A key in the URL is rejected with400 credential_in_url. -
With no key,
initialize,tools/listanddidtheyopen_signupwork. The other four tools need the agent key.
Tools
-
didtheyopen_signup: create an account. No email. Keys are shown once. -
didtheyopen_track_email: one email.client_refis required (letters, digits and . _ : -, 1 to 128). Optionallabelis a display name, never an email address. Optionalsender_labelispersonalorwork. Optionallinksare the hrefs in the HTML, up to 50. -
didtheyopen_check_email: opens so far for oneclient_ref. -
didtheyopen_new_opens: what changed since an ISO-8601 time or the cursor from the previous call. Run it every 10 to 15 minutes. -
didtheyopen_account: plan, trial emails left, whether new emails can be tracked, and today's usage.
Copy-paste config
Install openai-agents, then construct the server with the URL and the bearer
header. Leave headers out until didtheyopen_signup has returned
a key.
from agents.mcp import MCPServerStreamableHttp
MCPServerStreamableHttp(
name="didtheyopen",
params={
"url": "https://p.didtheyopen.com/mcp",
"headers": {"Authorization": f"Bearer {os.environ['DIDTHEYOPEN_API_KEY']}"},
"timeout": 20,
},
cache_tools_list=True,
)
Minimal example
The agent already knows how to send mail. This run asks it to track one proposal. The key
is read from DIDTHEYOPEN_API_KEY.
import asyncio
import os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
async def main() -> None:
async with MCPServerStreamableHttp(
name="didtheyopen",
params={
"url": "https://p.didtheyopen.com/mcp",
"headers": {
"Authorization": f"Bearer {os.environ['DIDTHEYOPEN_API_KEY']}",
},
"timeout": 20,
},
cache_tools_list=True,
) as server:
agent = Agent(
name="Mail",
instructions=(
"You already send this owner's email from Gmail or Outlook. "
"When asked to track an email, call didtheyopen_track_email, "
"insert the returned img tag at the end of the HTML body, then send. "
"Say opened, never read."
),
mcp_servers=[server],
)
result = await Runner.run(agent, "Track the proposal I am sending to Dana. Use client_ref proposal-dana-1 and label Dana Levi. Call didtheyopen_track_email, put the img tag at the end of the HTML body, then send the email from my Gmail or Outlook.")
print(result.final_output)
if __name__ == "__main__":
asyncio.run(main())
What the agent sees
Tool results are text. A successful didtheyopen_track_email call for
client_ref proposal-dana-1, label Dana Levi, and one https link
looks like this. The pixel address is new for each message. The sample below uses a
stand-in for that address.
Tracking ready for client_ref "proposal-dana-1" (expires 2026-12-18T16:00:00Z). Insert this tag at the end of the HTML body, right before </body>, then send the email normally. Do not change anything else; leave a plain-text part untouched. One pixel per email; for several recipients send one copy each with its own client_ref. <img src="https://p.didtheyopen.com/p/….gif" alt="" width="1" height="1" border="0" style="display:block;width:1px;height:1px;border:0;overflow:hidden"> In the HTML part only, replace each link address (href) below with its tracked address. Leave the visible link text, the plain-text part and every other link as they are: https://example.com/offer -> https://p.didtheyopen.com/c/m_…/0/…
After the mail app loads the image, didtheyopen_new_opens returns text like
this. The cursor after since= is an r plus a row id. Pass that
value back on the next call. Only the line whose reason is a first open, a click, a new
device, or a return after a pause is worth telling the owner. The headline says who, how
many times, and on what. The agent adds, from its own mailbox, the time in the owner's
zone and whether a reply has arrived.
1 new open(s) among 1 new load(s). Tell the owner now, unprompted, one short message per email: who opened it, when (in the owner's time) and on what device, as in the line below. Nothing technical. You may add whether a reply has arrived (check your own mailbox) and offer a next step: - Dana Levi: opened 1 time. Latest on an iPhone or iPad. (first open; 1 new) [client_ref proposal-dana-1] Next time pass since="r1". Keep watching without being asked: one permanent recurring job (your scheduler or heartbeat) calls this every 10 to 15 minutes, even when no tracked email is waiting. Save the cursor in durable notes; if the job or the cursor is lost after a restart, recreate the job and start again from an ISO time just before your last check. didtheyopen guide version 7. If you follow an older version, fetch https://didtheyopen.com/agent.md?v=7 and follow it. An open means the tracking image was loaded. It is not proof that a person read the email; say "opened", never "read".
Questions
Which class connects to the server?
MCPServerStreamableHttp from agents.mcp. The URL is
https://p.didtheyopen.com/mcp and the header is
Authorization: Bearer plus the agent key. Install with
pip install openai-agents.
Where does the agent key go?
In the headers dict of MCPServerStreamableHttp, read from
DIDTHEYOPEN_API_KEY. The server rejects a key in the URL with
400 credential_in_url.
What if there is no agent key yet?
Connect without the header and ask the agent to call didtheyopen_signup.
That tool works with no key and returns the agent key once. Save it, add the header,
and reconnect. Do not call signup again once a key is set. A lost key cannot be
recovered. Write to
support@didtheyopen.com if you are locked
out of the dashboard.
What counts as an open?
Only a load labeled opened, including a person's click on a tracked link.
Apple Mail loading the image by itself (mpp_unknown), security software
(prefetch_likely) and unidentified loads (unknown) are
labeled and are not opens. Say "opened", never "read".
Does didtheyopen send the email?
No. The agent keeps sending from the Gmail or Outlook path it already uses.
didtheyopen_track_email returns an img tag (and tracked link addresses
when you pass links). The agent inserts that tag and sends the message itself.
Other frameworks
- LangGraph
- n8n
- Claude
- Cursor
- All framework setup guides
- MCP server guide
- API docs
- Agent guide
- Sending from Gmail
- Sending from Outlook
Questions: support@didtheyopen.com.