Connect LangGraph 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 LangGraph 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: LangChain MCP reference.

The server

Tools

Copy-paste config

Install langchain[mcp] (1.4.0 or later). Pass the raw agent key as auth. The client sends Authorization: Bearer plus that key. Importing langchain.mcp warns once per process that the namespace is in beta.

from fastmcp.client import Client

Client(
    "https://p.didtheyopen.com/mcp",
    auth=os.environ["DIDTHEYOPEN_API_KEY"],
)

Code that already uses MultiServerMCPClient can keep this connection. The current transport name is http. streamable_http still works.

from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient(
    {
        "didtheyopen": {
            "transport": "http",
            "url": "https://p.didtheyopen.com/mcp",
            "headers": {
                "Authorization": f"Bearer {os.environ['DIDTHEYOPEN_API_KEY']}",
            },
        }
    }
)
tools = await client.get_tools()

Minimal example

create_agent builds a LangGraph agent from the tools MCPAdapter.list_tools() returns. Call it inside the adapter context while you load tools. The tools keep the client, so the agent can run after the context exits.

import asyncio
import os

from fastmcp.client import Client
from langchain.agents import create_agent
from langchain.mcp import MCPAdapter

async def main() -> None:
    async with MCPAdapter(
        Client(
            "https://p.didtheyopen.com/mcp",
            auth=os.environ["DIDTHEYOPEN_API_KEY"],
        )
    ) as adapter:
        tools = await adapter.list_tools()
        agent = create_agent(
            "openai:gpt-4.1",
            tools,
            system_prompt=(
                "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."
            ),
        )
        result = await agent.ainvoke(
            {"messages": [{"role": "user", "content": "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)

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 package loads the tools?

langchain[mcp] 1.4.0 or later. Pass the key as auth in MCPAdapter, or as an Authorization header in MultiServerMCPClient. create_agent returns a LangGraph agent.

I already use MultiServerMCPClient. Does that still connect?

Yes. Set transport to http (or streamable_http), the URL to https://p.didtheyopen.com/mcp, and headers to Authorization: Bearer plus the agent key. New code should use MCPAdapter.

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

Questions: support@didtheyopen.com.