Skip to content

Commit d99bc4a

Browse files
committed
feat(plugin): OAuth-default MCP, health check, npm run check
- Default mcp.json: http + hosted URL only (no headers) for Cursor OAuth - Add verify-mcp-health.mjs and npm run check (validate + health) - CI: single check step; README/SUBMISSION/PR template aligned - Docs: optional API-key fallback; rule + install script messaging - Bump to 0.1.4 Made-with: Cursor
1 parent 4efd3aa commit d99bc4a

File tree

12 files changed

+108
-67
lines changed

12 files changed

+108
-67
lines changed

.cursor-plugin/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "leadmagic",
33
"displayName": "LeadMagic",
4-
"version": "0.1.3",
5-
"description": "Official LeadMagic plugin for Cursor with hosted MCP: emails, mobile, LinkedIn-to-email, job changes, company research, competitors, technographics, and credits.",
4+
"version": "0.1.4",
5+
"description": "Official LeadMagic plugin for Cursor with hosted MCP (OAuth by default): emails, mobile, LinkedIn-to-email, job changes, company research, competitors, technographics, and credits.",
66
"author": {
77
"name": "LeadMagic",
88
"email": "plugins@leadmagic.io"

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
## Validation
1616

17-
- [ ] Ran `npm run validate`
17+
- [ ] Ran `npm run validate` (or `npm run check` to include hosted health)
1818
- [ ] Checked that copy matches the current hosted MCP surface
1919
- [ ] Verified no secrets or hardcoded API keys were added
2020

2121
## Alignment Checklist
2222

2323
- [ ] `mcp.json` still points to `https://mcp.leadmagic.io/mcp`
24-
- [ ] Auth still uses `x-leadmagic-key`
24+
- [ ] Default `mcp.json` stays OAuth-only (no headers); API-key fallback documented in README if needed
2525
- [ ] Repo copy does not imply MCP support for tools outside the current MCP surface
2626
- [ ] README and submission copy stay consistent
2727

.github/workflows/validate-plugin.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ on:
1717
- "rules/**"
1818
- "schemas/**"
1919
- "scripts/**"
20+
- "CHANGELOG.md"
2021
- "skills/**"
2122

2223
jobs:
@@ -38,25 +39,9 @@ jobs:
3839
- name: Install dependencies
3940
run: npm ci
4041

41-
- name: Validate plugin package
42-
run: npm run validate
43-
44-
- name: Check hosted MCP endpoint
45-
run: |
46-
node <<'EOF'
47-
const fs = require('node:fs');
48-
const data = JSON.parse(fs.readFileSync('mcp.json', 'utf8'));
49-
const server = data.mcpServers?.leadmagic;
50-
51-
if (!server || server.type !== 'http' || server.url !== 'https://mcp.leadmagic.io/mcp') {
52-
throw new Error('mcp.json must point to the hosted LeadMagic MCP endpoint with explicit HTTP transport');
53-
}
54-
55-
if (!server.headers || server.headers['x-leadmagic-key'] !== '${LEADMAGIC_API_KEY}') {
56-
throw new Error('mcp.json must use LEADMAGIC_API_KEY interpolation');
57-
}
58-
EOF
42+
- name: Validate plugin and hosted health
43+
run: npm run check
5944

6045
- name: Check README references
6146
run: |
62-
node -e "const fs=require('node:fs');const text=fs.readFileSync('README.md','utf8');for(const value of ['https://mcp.leadmagic.io/mcp','leadmagic://docs','LeadMagic MCP Tools']){if(!text.includes(value)){throw new Error('README.md is missing required reference: '+value)}}"
47+
node -e "const fs=require('node:fs');const text=fs.readFileSync('README.md','utf8');for(const value of ['https://mcp.leadmagic.io/mcp','leadmagic://docs','LeadMagic MCP Tools','OAuth']){if(!text.includes(value)){throw new Error('README.md is missing required reference: '+value)}}"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to the LeadMagic Cursor plugin package are documented here.
44

5+
## 0.1.4
6+
7+
- **Auth:** Default `mcp.json` uses OAuth only (no headers); Cursor signs in with LeadMagic. README documents optional `x-leadmagic-key` + `${LEADMAGIC_API_KEY}` for API-key mode.
8+
- **CI:** `npm run check` runs validate plus `verify:health` against `https://mcp.leadmagic.io/health`; redundant `mcp.json` inline checks removed (covered by validate).
9+
510
## 0.1.3
611

712
- **MCP:** Hosted server at `https://mcp.leadmagic.io/mcp` — 10 tools, shared docs resource `leadmagic://docs`, prompts `account_research` and `contact_lookup`.

README.md

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,31 @@ Use this plugin when you want Cursor to help with:
3131

3232
## Data and privacy
3333

34-
MCP tool calls send the parameters you or the agent provide (for example emails, names, company names or domains, profile URLs) to LeadMagic's hosted service using your `LEADMAGIC_API_KEY`. See [Privacy](https://leadmagic.io/privacy) and [Terms](https://leadmagic.io/legal/terms). Support: [leadmagic.io/docs/support](https://leadmagic.io/docs/support).
34+
MCP tool calls send the parameters you or the agent provide (for example emails, names, company names or domains, profile URLs) to LeadMagic's hosted service. By default Cursor authenticates with LeadMagic using **OAuth** (browser sign-in) tied to your account. If you use the optional API-key setup, requests include your key from `LEADMAGIC_API_KEY`. See [Privacy](https://leadmagic.io/privacy) and [Terms](https://leadmagic.io/legal/terms). Support: [leadmagic.io/docs/support](https://leadmagic.io/docs/support).
3535

3636
## Hosted MCP Configuration
3737

3838
The plugin points Cursor at LeadMagic's hosted MCP endpoint:
3939

4040
- MCP endpoint: `https://mcp.leadmagic.io/mcp`
4141
- MCP transport: `http`
42-
- Auth header: `x-leadmagic-key`
43-
44-
Users provide their API key through the `LEADMAGIC_API_KEY` environment variable. The plugin forwards that key to the hosted MCP server at runtime.
42+
- **Default auth:** OAuth sign-in in Cursor when you enable or first use the LeadMagic MCP server (no API key in `mcp.json`)
43+
44+
**Optional API-key auth:** Advanced setups can add a static header so Cursor sends your key instead of OAuth. Merge or replace the server entry like this (environment variable must be visible to Cursor):
45+
46+
```json
47+
{
48+
"mcpServers": {
49+
"leadmagic": {
50+
"type": "http",
51+
"url": "https://mcp.leadmagic.io/mcp",
52+
"headers": {
53+
"x-leadmagic-key": "${LEADMAGIC_API_KEY}"
54+
}
55+
}
56+
}
57+
}
58+
```
4559

4660
## What The MCP Supports Today
4761

@@ -76,13 +90,7 @@ For private team distribution in Cursor:
7690

7791
### Install locally for testing
7892

79-
#### 1. Set your API key
80-
81-
```bash
82-
export LEADMAGIC_API_KEY="your_api_key_here"
83-
```
84-
85-
#### 2. Link the repository into Cursor
93+
#### 1. Link the repository into Cursor
8694

8795
If you are using this repository locally:
8896

@@ -95,7 +103,15 @@ This creates a symlink at `~/.cursor/plugins/local/leadmagic` pointing to this r
95103

96104
Then reload Cursor with `Developer: Reload Window`.
97105

98-
#### 3. Verify the connection
106+
#### 2. Sign in with LeadMagic (OAuth)
107+
108+
When Cursor connects to the LeadMagic MCP server, complete the browser OAuth flow if prompted. You do not need `LEADMAGIC_API_KEY` for the default configuration.
109+
110+
#### 3. Optional: use an API key instead of OAuth
111+
112+
If you cannot use OAuth, set `LEADMAGIC_API_KEY` in an environment Cursor inherits and add the `headers` block shown under [Hosted MCP Configuration](#hosted-mcp-configuration).
113+
114+
#### 4. Verify the connection
99115

100116
Ask Cursor one of these:
101117

@@ -105,13 +121,15 @@ Ask Cursor one of these:
105121

106122
## Local Development
107123

108-
From the repository root, install dependencies and validate the package:
124+
From the repository root, install dependencies and run the full check:
109125

110126
```bash
111127
npm ci
112-
npm run validate
128+
npm run check
113129
```
114130

131+
If you cannot reach the network, use `npm run validate` instead of `check`.
132+
115133
To link the plugin into Cursor locally:
116134

117135
```bash
@@ -126,21 +144,25 @@ npm run uninstall:local
126144

127145
## Troubleshooting
128146

129-
### Cursor cannot see `LEADMAGIC_API_KEY`
147+
### OAuth or MCP sign-in fails
130148

131-
On macOS, if Cursor was launched from the dock or Finder, it may not inherit your shell environment. If `LEADMAGIC_API_KEY` is set in your terminal but LeadMagic still fails inside Cursor, launch Cursor from the same shell session or reload it after exporting the variable in an environment Cursor can see.
149+
Retry the LeadMagic sign-in flow from Cursor's MCP settings. Confirm the server URL is `https://mcp.leadmagic.io/mcp` and that no stale custom `mcp.json` override is forcing invalid headers. If OAuth is blocked in your environment, switch to the API-key configuration in [Hosted MCP Configuration](#hosted-mcp-configuration).
132150

133-
### Authentication fails
151+
### Cursor cannot see `LEADMAGIC_API_KEY` (API-key mode only)
152+
153+
On macOS, if Cursor was launched from the dock or Finder, it may not inherit your shell environment. If you use the API-key header and `LEADMAGIC_API_KEY` is set in your terminal but LeadMagic still fails inside Cursor, launch Cursor from the same shell session or reload it after exporting the variable in an environment Cursor can see.
154+
155+
### Authentication fails (API-key mode)
134156

135157
Confirm that:
136158

137159
- `LEADMAGIC_API_KEY` is set in the environment visible to Cursor
160+
- your merged MCP config includes `x-leadmagic-key` with `${LEADMAGIC_API_KEY}`
138161
- the plugin is using `https://mcp.leadmagic.io/mcp`
139-
- the request header is `x-leadmagic-key`
140162

141163
### Hosted MCP reachability
142164

143-
`GET https://mcp.leadmagic.io/health` should return **200** when the service is up. Unauthenticated requests to `/mcp` may return **401** until a valid API key is sent— that is expected.
165+
`GET https://mcp.leadmagic.io/health` should return **200** when the service is up. Unauthenticated requests to `/mcp` may return **401** until OAuth completes or a valid API key is sent—that is expected.
144166

145167
### You need exact tool details
146168

@@ -173,6 +195,7 @@ rules/leadmagic-usage.mdc
173195
skills/*/SKILL.md
174196
scripts/install-local-plugin.mjs
175197
scripts/validate-plugin.mjs
198+
scripts/verify-mcp-health.mjs
176199
README.md
177200
SUBMISSION.md
178201
CHANGELOG.md
@@ -181,13 +204,14 @@ CHANGELOG.md
181204
## Validation
182205

183206
```bash
184-
npm run validate
207+
npm run check
185208
```
186209

210+
That runs `npm run validate` plus `npm run verify:health` (hosted `/health` smoke check—same idea as CI). Use `npm run validate` alone when you are offline.
211+
187212
The validator checks this package against a vendored snapshot of Cursor's official `plugin.schema.json` and then applies LeadMagic-specific assertions for:
188213

189-
- the hosted MCP endpoint
190-
- `LEADMAGIC_API_KEY` interpolation
214+
- the hosted MCP endpoint and OAuth-default `mcp.json` (no auth headers)
191215
- the canonical logo asset and submission logo URL
192216
- skills and rules metadata
193217
- repository and submission copy consistency

SUBMISSION.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins@leadmagic.io
2020
https://raw.githubusercontent.com/LeadMagic/leadmagic-cursor-plugin/main/assets/logo.svg
2121

2222
**Description**
23-
Official LeadMagic plugin for Cursor. Gives agents direct access to LeadMagic's hosted MCP surface for work email validation and discovery, mobile lookup, LinkedIn profile to work email, job-change detection, account research, competitor and technographics lists, people-by-role search, and credit balance—all using your API key with credit-aware usage.
23+
Official LeadMagic plugin for Cursor. Gives agents direct access to LeadMagic's hosted MCP surface for work email validation and discovery, mobile lookup, LinkedIn profile to work email, job-change detection, account research, competitor and technographics lists, people-by-role search, and credit balance—authenticated by default with OAuth in Cursor, with an optional API-key path for advanced setups.
2424

2525
**GitHub repository**
2626
https://github.com/LeadMagic/leadmagic-cursor-plugin
@@ -37,12 +37,12 @@ Before submitting:
3737
3. Confirm the public logo URL resolves:
3838
`https://raw.githubusercontent.com/LeadMagic/leadmagic-cursor-plugin/main/assets/logo.svg`
3939
4. Run `npm ci`.
40-
5. Run `npm run validate`.
40+
5. Run `npm run check` (or `npm run validate` if you are offline).
4141
6. If you want to test the package in Cursor first, run `npm run install:local` and reload Cursor with `Developer: Reload Window`.
4242

4343
## Suggested reviewer note
4444

45-
LeadMagic is an API-first B2B enrichment platform for AI agents and GTM engineers. This plugin packages our hosted MCP integration (10 tools, `leadmagic://docs`, two prompts) into a Cursor-native repo with focused skills, safe default guidance, and `LEADMAGIC_API_KEY` for auth. Tool calls are processed per LeadMagic privacy and terms at leadmagic.io.
45+
LeadMagic is an API-first B2B enrichment platform for AI agents and GTM engineers. This plugin packages our hosted MCP integration (10 tools, `leadmagic://docs`, two prompts) into a Cursor-native repo with focused skills, safe default guidance, and OAuth-first MCP auth (optional `LEADMAGIC_API_KEY` header for environments that need it). Tool calls are processed per LeadMagic privacy and terms at leadmagic.io.
4646

4747
## Short marketplace blurb alternatives
4848

@@ -53,4 +53,4 @@ Official LeadMagic plugin for Cursor. Validate and find work emails, look up mob
5353
B2B enrichment for Cursor agents via LeadMagic's hosted MCP: emails, mobile, profiles, job changes, account intel, competitors, technographics, role search, and credit-aware usage.
5454

5555
### Option C
56-
Connect Cursor to LeadMagic for agent-native contact and account workflows backed by LeadMagic's hosted MCP and your own API key.
56+
Connect Cursor to LeadMagic for agent-native contact and account workflows backed by LeadMagic's hosted MCP and OAuth sign-in (API key optional).

mcp.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
2-
"mcpServers": {
3-
"leadmagic": {
4-
"type": "http",
5-
"url": "https://mcp.leadmagic.io/mcp",
6-
"headers": {
7-
"x-leadmagic-key": "${LEADMAGIC_API_KEY}"
8-
}
9-
}
10-
}
2+
"mcpServers": {
3+
"leadmagic": {
4+
"type": "http",
5+
"url": "https://mcp.leadmagic.io/mcp"
6+
}
7+
}
118
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "leadmagic-cursor-plugin",
33
"private": true,
4-
"version": "0.1.3",
4+
"version": "0.1.4",
55
"description": "Submission package for the LeadMagic Cursor plugin",
66
"license": "MIT",
77
"scripts": {
88
"validate": "node scripts/validate-plugin.mjs",
9-
"validate:strict": "node scripts/validate-plugin.mjs",
9+
"verify:health": "node scripts/verify-mcp-health.mjs",
10+
"check": "npm run validate && npm run verify:health",
1011
"install:local": "node scripts/install-local-plugin.mjs",
1112
"uninstall:local": "node scripts/install-local-plugin.mjs --unlink"
1213
},

rules/leadmagic-usage.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ When this plugin is available:
2424
- and any obvious next best step.
2525
6. For email validation, summarize only what appears in the tool output (including the stated result line). Do not speculate about “missing” deliverability details, catch-all behavior, or fields the response does not include.
2626
7. If parameter requirements, supported inputs, or pricing are unclear, consult the shared MCP docs resource `leadmagic://docs` before guessing.
27-
8. If the API key is missing or authentication fails, tell the user they need to set `LEADMAGIC_API_KEY`.
27+
8. If authentication fails, tell the user to finish LeadMagic sign-in for MCP in Cursor (OAuth), or use the API-key fallback in the plugin README (`LEADMAGIC_API_KEY` + `x-leadmagic-key` header) if OAuth is not available.

scripts/install-local-plugin.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
import fs from "node:fs";
3-
import path from "node:path";
43
import os from "node:os";
4+
import path from "node:path";
55

66
const pluginRoot = process.cwd();
77
const manifestPath = path.join(pluginRoot, ".cursor-plugin", "plugin.json");
@@ -48,7 +48,7 @@ try {
4848
console.log(`Linked plugin to ${linkPath}`);
4949
console.log("Next step: reload Cursor with 'Developer: Reload Window'.");
5050
console.log(
51-
"Important: make sure LEADMAGIC_API_KEY is available to the Cursor process before reloading.",
51+
"After reload: complete LeadMagic OAuth when Cursor connects to MCP, or configure LEADMAGIC_API_KEY + headers per README if you use API-key mode.",
5252
);
5353
} catch (error) {
5454
console.error(error instanceof Error ? error.message : String(error));

0 commit comments

Comments
 (0)