-
Notifications
You must be signed in to change notification settings - Fork 1
docs: canonicalize AGENTS.md as the agent guide and freshen against code #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jack-arturo
wants to merge
3
commits into
main
Choose a base branch
from
docs/agents-md-canonical
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # AGENTS.md | ||
|
|
||
| Development guidance for coding agents (Claude Code, Cursor, Codex, and others) when working on mcp-edd. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| MCP server for the Easy Digital Downloads REST API. Registers 16 tools for accessing EDD store data including products, sales, customers, statistics, discounts, and download logs, plus a connection validator. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| src/ | ||
| ├── index.ts # MCP server entry, tool registrations | ||
| ├── edd-client.ts # EDD REST API client with retry logic | ||
| ├── types.ts # Zod schemas and TypeScript types | ||
| ├── env.ts # Environment loading + validation | ||
| └── stdio.ts # Redirects console.log/info/debug to stderr so they can't corrupt the stdio protocol stream | ||
| ``` | ||
|
|
||
| `src/stdio.ts` is imported first thing in `src/index.ts:2` so the console patch is applied before anything can write to stdout. | ||
|
|
||
| ## Tools | ||
|
|
||
| All 16 tools are registered via `server.registerTool(...)` in `src/index.ts`: | ||
|
|
||
| - `edd_list_products`, `edd_get_product` | ||
| - `edd_list_sales`, `edd_get_sale` | ||
| - `edd_list_customers`, `edd_get_customer` | ||
| - `edd_get_stats`, `edd_get_stats_by_date`, `edd_get_stats_by_product`, `edd_get_stats_by_preset` | ||
| - `edd_list_discounts`, `edd_get_discount`, `edd_get_discount_by_code`, `edd_list_active_discounts` | ||
| - `edd_get_download_logs` | ||
| - `edd_validate_connection` | ||
|
|
||
| ## Common Commands | ||
|
|
||
| ```bash | ||
| npm run build # Compile TypeScript (tsc) + chmod +x dist/index.js | ||
| npm run dev # Watch mode (tsx watch src/index.ts) | ||
| npm start # Run compiled server (node dist/index.js) | ||
| npm test # Unit tests only | ||
| npm run test:integration # Integration tests (needs credentials) | ||
| npm run test:all # All tests | ||
| npm run lint # ESLint over src/ | ||
| npm run format # Prettier write over src/ | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| Unit tests use Jest with mocked fetch (`tests/unit/`). Integration tests (`tests/integration/`) require environment variables: | ||
|
|
||
| ```bash | ||
| EDD_API_URL=https://example.com/edd-api/ | ||
| EDD_API_KEY=your-key | ||
| EDD_API_TOKEN=your-token | ||
| ``` | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| Validated in `src/env.ts:81` (`validateEnv`); all three are required: | ||
|
|
||
| - `EDD_API_URL` — EDD store API base URL (normalized to `.../edd-api/` form) | ||
| - `EDD_API_KEY` — EDD API public key | ||
| - `EDD_API_TOKEN` — EDD API token | ||
|
|
||
| `loadEnv` (`src/env.ts:9`) also reads a `.env` file, searching `./.env`, `$HOME/.mcp-edd.env`, and `$HOME/.config/mcp-edd/.env`. | ||
|
|
||
| ## Key Patterns | ||
|
|
||
| - Uses the modern `McpServer` class from the MCP SDK 1.x (`src/index.ts:3`). | ||
| - Zod schemas for input validation. | ||
| - Exponential backoff retry, 3 attempts by default (`src/edd-client.ts:147`). | ||
| - The V2 products endpoint is public (no auth required for public products); all other endpoints require auth (`src/edd-client.ts:231`). | ||
|
|
||
| ## EDD API Notes | ||
|
|
||
| - Auth via query params: `?key=xxx&token=xxx`. | ||
| - Stats endpoint returns data directly (not wrapped in a `stats` object); the client normalizes the flat response. | ||
| - Date format for ranges: YYYYMMDD. | ||
| - Product and date filters are issued via separate client methods (`getStatsByProduct` vs `getStatsByDateRange`) and are not combined in a single stats request. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1 @@ | ||
| # CLAUDE.md | ||
|
|
||
| Development guidance for Claude Code when working on mcp-edd. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| MCP server for Easy Digital Downloads REST API. Provides 12 tools for accessing EDD store data including sales, customers, products, discounts, and statistics. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| src/ | ||
| ├── index.ts # MCP server entry, tool definitions | ||
| ├── edd-client.ts # EDD REST API client with retry logic | ||
| ├── types.ts # Zod schemas and TypeScript types | ||
| └── env.ts # Environment variable validation | ||
| ``` | ||
|
|
||
| ## Common Commands | ||
|
|
||
| ```bash | ||
| npm run build # Compile TypeScript | ||
| npm run dev # Watch mode development | ||
| npm test # Unit tests only | ||
| npm run test:integration # Integration tests (needs credentials) | ||
| npm run test:all # All tests | ||
| npm run lint # ESLint | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| Unit tests use Jest with mocked fetch. Integration tests require environment variables: | ||
|
|
||
| ```bash | ||
| EDD_API_URL=https://example.com/edd-api/ | ||
| EDD_API_KEY=your-key | ||
| EDD_API_TOKEN=your-token | ||
| ``` | ||
|
|
||
| ## Key Patterns | ||
|
|
||
| - Uses modern McpServer class from SDK 1.x | ||
| - Zod schemas for input validation | ||
| - Exponential backoff retry (3 attempts) | ||
| - Products endpoint is public (no auth), all others require auth | ||
|
|
||
| ## EDD API Notes | ||
|
|
||
| - Auth via query params: `?key=xxx&token=xxx` | ||
| - Stats endpoint returns data directly (not wrapped in `stats` object) | ||
| - Date format for ranges: YYYYMMDD | ||
| - Product and date filters cannot be combined on stats endpoint | ||
| @AGENTS.md |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.