-
-
Notifications
You must be signed in to change notification settings - Fork 1
docs: Add AGENTS.md files for OpenAI Codex compatibility #86
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8890533
docs: Add AGENTS.md files for OpenAI Codex compatibility
claude acddc28
docs: Add mandatory Learnings section to package AGENTS.md files
claude 0304716
docs: Mark root Learnings section as mandatory
claude c706b4f
style: Format AGENTS.md files with prettier
claude 2b38fdc
docs(core): Correct barrel file architecture in AGENTS.md
claude 9afb1ec
docs: Replace AGENTS.md symlink with regular file
claude 71e5fad
fix(testing): Add epsilon tolerance for flaky float bounds test
claude 5262a2f
docs: Simplify AGENTS.md to reference CLAUDE.md
claude 8f85411
docs: Remove vendor-specific mention from AGENTS.md
claude 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,5 @@ | ||
| # AGENTS.md | ||
|
|
||
| **MANDATORY: Read `CLAUDE.md` before starting any task.** | ||
|
|
||
| All project instructions are in `CLAUDE.md`. |
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
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,50 @@ | ||
| # @mcp-apps-kit/core | ||
|
|
||
| Server-side framework for MCP applications. Handles tool definitions, UI resources, adapters, middleware, and Express server setup. | ||
|
|
||
| ## Quick Commands | ||
|
|
||
| ```bash | ||
| pnpm -C packages/core test # Run tests | ||
| pnpm -C packages/core typecheck # Type check only | ||
| pnpm -C packages/core lint # Lint only | ||
| ``` | ||
|
|
||
| ## Key Exports | ||
|
|
||
| - `createApp` - Main entry point for creating an MCP app | ||
| - `defineTool` - Type-safe tool definition helper | ||
| - `defineUI` - UI resource definition helper | ||
| - `createPlugin` - Plugin system for extending apps | ||
|
|
||
| ## Patterns | ||
|
|
||
| Use `defineTool` and `defineUI` for type inference instead of inline objects. | ||
|
|
||
| Middleware is Koa-style: always `await next()` or the chain breaks. | ||
|
|
||
| Exports are centralized through `src/index.ts`, which re-exports from barrel files (`index.ts`) in subdirectories: `adapters/`, `debug/`, `events/`, `middleware/`, `plugins/`, `server/`, and `server/oauth/`. Subdirectory barrel files are local re-exports only - all public API goes through the root `src/index.ts`. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - Express 5 (async error handling differs from v4) | ||
| - Zod 4 (breaking changes from v3) | ||
| - @modelcontextprotocol/sdk | ||
|
|
||
| ## Common Mistakes | ||
|
|
||
| - Forgetting to `await next()` in middleware | ||
| - Using Zod 3 APIs that changed in v4 (check migration guide) | ||
| - Adding exports outside `index.ts` | ||
|
|
||
| --- | ||
|
|
||
| ## Learnings | ||
|
|
||
| <!-- MANDATORY: Document failures here to prevent repeated mistakes --> | ||
| <!-- Format: what went wrong → what to do instead --> | ||
|
|
||
| <!-- Example: | ||
| - Type error in handler because input wasn't validated → Always use Zod schema, never trust raw input | ||
| - Middleware chain broke silently → Add logging middleware first to debug chain issues | ||
| --> | ||
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,52 @@ | ||
| # @mcp-apps-kit/create-app | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| CLI tool for scaffolding MCP applications. Creates new projects with React or vanilla JS templates. | ||
|
|
||
| ## Quick Commands | ||
|
|
||
| ```bash | ||
| pnpm -C packages/create-app test # Run tests | ||
| pnpm -C packages/create-app typecheck # Type check only | ||
| pnpm -C packages/create-app lint # Lint only | ||
| ``` | ||
|
|
||
| ## Key Exports | ||
|
|
||
| - `scaffoldProject` - Programmatic project creation | ||
| - CLI binary: `create-mcp-apps-kit` | ||
|
|
||
| ## Templates | ||
|
|
||
| - `react` - React + Vite + @mcp-apps-kit/ui-react | ||
| - `vanilla` - Vanilla JS + Vite + @mcp-apps-kit/ui | ||
|
|
||
| Both include: | ||
|
|
||
| - Server with example tool | ||
| - UI with theming | ||
| - Integration tests | ||
| - Optional Vercel deployment config | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - commander (CLI framework) | ||
| - @inquirer/prompts (interactive prompts) | ||
| - figlet, chalk (CLI styling) | ||
|
|
||
| ## Common Mistakes | ||
|
|
||
| - Running in non-empty directory (fails) | ||
| - Fetches latest package versions from npm at runtime | ||
| - Generated projects use npm (not pnpm) to avoid workspace conflicts | ||
|
|
||
| --- | ||
|
|
||
| ## Learnings | ||
|
|
||
| <!-- MANDATORY: Document failures here to prevent repeated mistakes --> | ||
| <!-- Format: what went wrong → what to do instead --> | ||
|
|
||
| <!-- Example: | ||
| - Template file had wrong path → Use path.join() not string concatenation for cross-platform | ||
| - npm install failed in generated project → Check if package versions are valid on npm registry | ||
| --> | ||
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,52 @@ | ||
| # @mcp-apps-kit/testing | ||
|
|
||
| Comprehensive testing library for MCP applications. Supports unit, integration, behavior, property, and LLM evaluation testing. | ||
|
|
||
| ## Quick Commands | ||
|
|
||
| ```bash | ||
| pnpm -C packages/testing test # Run tests | ||
| pnpm -C packages/testing typecheck # Type check only | ||
| pnpm -C packages/testing lint # Lint only | ||
| ``` | ||
|
|
||
| ## Key Exports | ||
|
|
||
| - `createTestEnvironment` - Full test setup with server and client | ||
| - `startTestServer` / `createTestClient` - Individual components | ||
| - `expectToolResult` - Fluent assertions for tool results | ||
| - `createMCPEval` / `describeEval` - LLM-based evaluation | ||
| - Framework adapters: `@mcp-apps-kit/testing/vitest`, `@mcp-apps-kit/testing/jest` | ||
|
|
||
| ## Patterns | ||
|
|
||
| ```typescript | ||
| const env = await createTestEnvironment({ app }); | ||
| const result = await env.client.callTool("greet", { name: "Alice" }); | ||
| expectToolResult(result).toMatchObject({ message: "Hello, Alice!" }); | ||
| await env.cleanup(); | ||
| ``` | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - @modelcontextprotocol/sdk | ||
| - Zod 4 | ||
| - Optional: vitest, jest, fast-check, openai, @anthropic-ai/sdk | ||
|
|
||
| ## Common Mistakes | ||
|
|
||
| - Forgetting `await env.cleanup()` (leaves server running) | ||
| - Not setting up vitest/jest matchers in setup file | ||
| - Missing optional peer deps for LLM eval features | ||
|
|
||
| --- | ||
|
|
||
| ## Learnings | ||
|
|
||
| <!-- MANDATORY: Document failures here to prevent repeated mistakes --> | ||
| <!-- Format: what went wrong → what to do instead --> | ||
|
|
||
| <!-- Example: | ||
| - Tests hung indefinitely → Server wasn't cleaned up from previous run, use port: 0 for random port | ||
| - Matcher not found error → Import setupVitestMatchers in setup file before tests run | ||
| --> |
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
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,54 @@ | ||
| # @mcp-apps-kit/ui-react-builder | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix Prettier formatting error (likely missing trailing newline). The Prettier check is failing. Ensure proper line ending and newline at EOF. 🔧 Proposed fixAdd a newline at the end of the file after line 54: <!-- Example:
- Build succeeded but component didn't render → Check if all imports are included in bundle
- esbuild error about JSX → Ensure .tsx extension and jsx: 'automatic' in config
--->
+-->
🤖 Prompt for AI Agents |
||
|
|
||
| Build tool for React-based MCP application UIs. Bundles React components into self-contained HTML. | ||
|
|
||
| ## Quick Commands | ||
|
|
||
| ```bash | ||
| pnpm -C packages/ui-react-builder test # Run tests | ||
| pnpm -C packages/ui-react-builder typecheck # Type check only | ||
| pnpm -C packages/ui-react-builder lint # Lint only | ||
| ``` | ||
|
|
||
| ## Key Exports | ||
|
|
||
| - `defineReactUI` - Define UI with React component | ||
| - `buildReactUIs` / `buildReactUI` - Build to HTML | ||
| - `buildAndTransform` - Build and convert to core UIDefs in one step | ||
| - Vite plugin available via `@mcp-apps-kit/ui-react-builder/vite` | ||
|
|
||
| ## Patterns | ||
|
|
||
| ```typescript | ||
| const widgetUI = defineReactUI({ | ||
| component: MyWidget, | ||
| name: "My Widget", | ||
| prefersBorder: true, | ||
| }); | ||
|
|
||
| const uis = await buildAndTransform({ "my-widget": widgetUI }); | ||
| ``` | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - esbuild (bundling) | ||
| - @typescript-eslint/typescript-estree (AST parsing) | ||
| - Peer deps: @mcp-apps-kit/core, @mcp-apps-kit/ui-react, react, react-dom, vite (optional) | ||
|
|
||
| ## Common Mistakes | ||
|
|
||
| - Forgetting to rebuild after component changes | ||
| - Not including component dependencies in build | ||
| - Missing vite peer dep when using vite plugin | ||
|
|
||
| --- | ||
|
|
||
| ## Learnings | ||
|
|
||
| <!-- MANDATORY: Document failures here to prevent repeated mistakes --> | ||
| <!-- Format: what went wrong → what to do instead --> | ||
|
|
||
| <!-- Example: | ||
| - Build succeeded but component didn't render → Check if all imports are included in bundle | ||
| - esbuild error about JSX → Ensure .tsx extension and jsx: 'automatic' in config | ||
| --> | ||
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,56 @@ | ||
| # @mcp-apps-kit/ui-react | ||
|
|
||
| React bindings for MCP applications. Provides hooks and context for building UIs. | ||
|
|
||
| ## Quick Commands | ||
|
|
||
| ```bash | ||
| pnpm -C packages/ui-react test # Run tests | ||
| pnpm -C packages/ui-react typecheck # Type check only | ||
| pnpm -C packages/ui-react lint # Lint only | ||
| ``` | ||
|
|
||
| ## Key Exports | ||
|
|
||
| - `AppsProvider` - Context provider (wrap your app) | ||
| - `useAppsClient` - Get client instance | ||
| - `useToolResult` - Get current tool result | ||
| - `useHostContext` - Get host context (theme, locale, etc.) | ||
| - `useDocumentTheme` / `useHostStyleVariables` - Auto-apply theming | ||
|
|
||
| ## Patterns | ||
|
|
||
| ```tsx | ||
| <AppsProvider> | ||
| <App /> | ||
| </AppsProvider>; | ||
|
|
||
| function App() { | ||
| const result = useToolResult<ToolOutputs>(); | ||
| useDocumentTheme("light", "dark"); | ||
| // ... | ||
| } | ||
| ``` | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - @mcp-apps-kit/ui (re-exports many types) | ||
| - React 18 or 19 | ||
|
|
||
| ## Common Mistakes | ||
|
|
||
| - Forgetting `AppsProvider` wrapper | ||
| - Not typing `useToolResult<T>()` generic | ||
| - Using hooks outside provider context | ||
|
|
||
| --- | ||
|
|
||
| ## Learnings | ||
|
|
||
| <!-- MANDATORY: Document failures here to prevent repeated mistakes --> | ||
| <!-- Format: what went wrong → what to do instead --> | ||
|
|
||
| <!-- Example: | ||
| - Hook returned undefined unexpectedly → Ensure component is wrapped in AppsProvider | ||
| - Re-renders caused infinite loop → Check useEffect dependencies, avoid object literals in deps | ||
| --> |
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,49 @@ | ||
| # @mcp-apps-kit/ui | ||
|
|
||
| Client-side SDK for MCP applications (vanilla JavaScript). Auto-detects host platform (MCP Apps vs ChatGPT) and provides unified API. | ||
|
|
||
| ## Quick Commands | ||
|
|
||
| ```bash | ||
| pnpm -C packages/ui test # Run tests | ||
| pnpm -C packages/ui typecheck # Type check only | ||
| pnpm -C packages/ui lint # Lint only | ||
| ``` | ||
|
|
||
| ## Key Exports | ||
|
|
||
| - `createClient` - Main entry point, auto-detects platform | ||
| - `detectProtocol` - Manual platform detection | ||
| - `McpAdapter` / `OpenAIAdapter` / `MockAdapter` - Protocol adapters | ||
| - Theme/style utilities: `applyDocumentTheme`, `applyHostStyleVariables` | ||
|
|
||
| ## Patterns | ||
|
|
||
| ```typescript | ||
| const client = await createClient<typeof app.tools>(); | ||
| const result = await client.callTool("greet", { name: "Alice" }); | ||
| ``` | ||
|
|
||
| Subscribe to events with `onHostContextChange`, `onToolResult`. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - @modelcontextprotocol/ext-apps | ||
|
|
||
| ## Common Mistakes | ||
|
|
||
| - Forgetting to await `createClient()` (it's async) | ||
| - Not handling both MCP and OpenAI response formats | ||
| - Missing type parameter for typed tool calls | ||
|
|
||
| --- | ||
|
|
||
| ## Learnings | ||
|
|
||
| <!-- MANDATORY: Document failures here to prevent repeated mistakes --> | ||
| <!-- Format: what went wrong → what to do instead --> | ||
|
|
||
| <!-- Example: | ||
| - Client connected but no events fired → Check if adapter.connect() was awaited | ||
| - Theme not applying → Verify onHostContextChange subscription is set up before first render | ||
| --> |
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.