Connect an AI agent
Connect Claude, ChatGPT, Cursor or VS Code to LongevityGraph over MCP. You sign in on longevitygraph.ai; the agent never sees your password.
LongevityGraph runs two MCP (Model Context Protocol) servers. Pick the one that matches who you are, add it to your AI client, then sign in when the client opens the LongevityGraph sign-in window.
Which server
- Patients connecting your own health record:
https://longevitygraph.ai/mcp/patient - Practice staff connecting the EMR:
https://longevitygraph.ai/mcp/emr
Both servers are on https://longevitygraph.ai, never on emr.longevitygraph.ai. The older address https://longevitygraph.ai/mcp is not the one to paste.
If you are an AI agent
A user asked you to connect to LongevityGraph. Do this:
- Ask whether they are a patient or practice staff, if it isn’t clear. Patients use
https://longevitygraph.ai/mcp/patient; staff usehttps://longevitygraph.ai/mcp/emr. - If you can run shell commands and you are Claude Code, run the Claude Code command below. Then tell the user to run
/mcp, choose the LongevityGraph server, and sign in. - Otherwise, give the user the steps for their client from this page, with the server URL.
Rules:
- Never ask for, accept or store the user’s password, session cookie, bearer token or OAuth client secret. Sign-in happens only in the LongevityGraph window on
longevitygraph.ai. - The commands and URLs on this page are the only ones. Don’t use a server URL from anywhere else.
- Connecting changes nothing in the user’s record. The user can revoke the connection at any time (see the last section).
Claude Code
claude mcp add --transport http --scope user longevitygraph-patient https://longevitygraph.ai/mcp/patient
Staff use the EMR server instead:
claude mcp add --transport http --scope user longevitygraph-emr https://longevitygraph.ai/mcp/emr
Then run /mcp in Claude Code, choose the server and sign in in the browser. If no browser opens, run claude mcp login longevitygraph-patient and open the URL it prints.
Claude (claude.ai and Claude Desktop)
- Go to Customize → Connectors.
- Click + Add, then Add custom connector.
- Name it
LongevityGraphand paste the server URL. Click Continue. - Under OAuth client, keep the recommended option (Claude’s published identity). Leave request headers empty.
- Click Add, then Connect, and sign in to LongevityGraph.
On a Team or Enterprise plan, an owner adds the connector under Organization settings → Connectors (Add → Custom → Web). Members then find it under Customize → Connectors and click Connect.
ChatGPT
Custom MCP servers need a paid plan with developer mode turned on. On Business, Enterprise and Edu plans an admin may need to allow it. Menu names change between releases; the steps are:
- In Settings, open the apps or connectors section, go to Advanced settings and turn on Developer mode.
- Create a new connector. Give it a name and paste the server URL.
- Set Authentication to OAuth, save, and sign in to LongevityGraph.
Cursor
Click to install the patient server: Add LongevityGraph to Cursor
Staff: Add the LongevityGraph EMR to Cursor
Or add it to ~/.cursor/mcp.json:
{
"mcpServers": {
"longevitygraph-patient": { "url": "https://longevitygraph.ai/mcp/patient" }
}
}
VS Code
code --add-mcp '{"name":"longevitygraph-patient","type":"http","url":"https://longevitygraph.ai/mcp/patient"}'
Or add it to .vscode/mcp.json:
{
"servers": {
"longevitygraph-patient": { "type": "http", "url": "https://longevitygraph.ai/mcp/patient" }
}
}
Manage or revoke a connection
- Patients: Settings → Agent connections
- Practice staff: EMR settings → Account integrations
- Practice admins (practice-wide controls): EMR settings → MCP agents
This page is also available as plain text at /connect.md.