@devries-cameron20 / composio Mirror · read-only / commits / b521f890f
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 13:15 UTC

feat(docs): add MCP class to SDK reference documentation

- Add MCP to TypeScript SDK docs (remove from INTERNAL_CLASSES exclusion) - Add MCP to Python SDK docs (add to EXPECTED_CLASSES and CLASS_MODULES) - Fix acronym handling in TS generator (MCP -> mcp, not mCP) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 26, 2026 at 20:16 UTC b521f890fbfde08e2c38bade0f670cb247b739e4
8 files changed +84 -35
.github/workflows/generate-sdk-docs.yml
+2 -6
@@ -24,9 +24,7 @@ jobs:
24
25 - run: pnpm install --frozen-lockfile
26
27 - - name: Generate TypeScript SDK docs
28 - working-directory: docs
29 - run: bun run generate:sdk-reference:ts
27 + - run: pnpm --filter @composio/core generate:docs
28
29 - name: Create Pull Request
30 uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
@@ -51,9 +49,7 @@ jobs:
49 - name: Setup Python with UV
50 uses: ./.github/actions/setup-python-uv
51
54 - - name: Generate Python SDK docs
55 - working-directory: docs
56 - run: uv run --with griffe python scripts/sdk-reference/generate-python.py
52 + - run: cd python && uv run --with griffe python scripts/generate-docs.py
53
54 - name: Create Pull Request
55 uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
docs/CLAUDE.md
+4 -7
@@ -21,18 +21,15 @@ Auto-generated SDK documentation from source code.
21
22 ### TypeScript SDK
23 - **Source**: `ts/packages/core/src/models/*.ts` (JSDoc comments)
24 -- **Generator**: `scripts/sdk-reference/generate-typescript.ts`
24 +- **Generator**: `ts/packages/core/scripts/generate-docs.ts`
25 - **Output**: `content/reference/sdk-reference/typescript/`
26 -- **Regenerate**: `bun run generate:sdk-reference:ts`
26 +- **Regenerate**: `pnpm --filter @composio/core generate:docs`
27
28 ### Python SDK
29 - **Source**: `python/composio/**/*.py` (docstrings)
30 -- **Generator**: `scripts/sdk-reference/generate-python.py` (uses griffe)
30 +- **Generator**: `python/scripts/generate-docs.py` (uses griffe)
31 - **Output**: `content/reference/sdk-reference/python/`
32 -- **Regenerate**: `bun run generate:sdk-reference:py`
33 -
34 -### Both SDKs
35 -- **Regenerate all**: `bun run generate:sdk-reference`
32 +- **Regenerate**: `cd python && uv run --with griffe python scripts/generate-docs.py`
33
34 CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**` via `.github/workflows/generate-sdk-docs.yml`.
35
docs/package.json
+1 -5
@@ -10,10 +10,7 @@
10 "postinstall": "fumadocs-mdx",
11 "lint": "eslint",
12 "lint:links": "bun scripts/validate-links.ts",
13 - "generate:toolkits": "bun scripts/generate-toolkits.ts",
14 - "generate:sdk-reference:ts": "bun scripts/sdk-reference/generate-typescript.ts",
15 - "generate:sdk-reference:py": "uv run --with griffe python scripts/sdk-reference/generate-python.py",
16 - "generate:sdk-reference": "bun run generate:sdk-reference:ts && bun run generate:sdk-reference:py"
13 + "generate:toolkits": "bun scripts/generate-toolkits.ts"
14 },
15 "dependencies": {
16 "@radix-ui/react-tabs": "^1.1.13",
@@ -33,7 +30,6 @@
30 "tailwind-merge": "^3.4.0"
31 },
32 "devDependencies": {
36 - "typedoc": "^0.28.5",
33 "@ai-sdk/anthropic": "^3.0.11",
34 "@ai-sdk/mcp": "^1.0.6",
35 "@ai-sdk/openai": "^3.0.9",
python/scripts/README.md new
+26
@@ -0,0 +1,26 @@
1 +# SDK Documentation Generator
2 +
3 +Generates MDX reference docs from Python source using griffe.
4 +
5 +## Usage
6 +
7 +```bash
8 +cd python
9 +uv run --with griffe python scripts/generate-docs.py
10 +```
11 +
12 +## How it works
13 +
14 +1. griffe extracts docstrings from `composio/**/*.py` → structured data
15 +2. `generate-docs.py` transforms data → MDX files
16 +3. Output written to `docs/content/reference/sdk-reference/python/`
17 +
18 +## Configuration
19 +
20 +- **Expected classes**: `EXPECTED_CLASSES` dict maps class name → Composio property
21 +- **Modules to search**: `CLASS_MODULES` list
22 +- **Decorators**: `DECORATORS_TO_DOCUMENT` list
23 +
24 +## CI
25 +
26 +`.github/workflows/generate-sdk-docs.yml` triggers on changes to `python/composio/**` and opens a PR with updated docs.
python/scripts/generate-docs.py renamed
+13 -7
@@ -5,7 +5,7 @@ Python SDK Documentation Generator
5 Generates MDX documentation from Python source code using griffe.
6 Output is written to the docs content directory.
7
8 -Run from docs/: uv run --with griffe python scripts/sdk-reference/generate-python.py
8 +Run: cd python && uv run --with griffe python scripts/generate-docs.py
9 """
10
11 from __future__ import annotations
@@ -22,11 +22,17 @@ except ImportError:
22 print("Error: griffe not installed. Run: pip install griffe")
23 raise SystemExit(1)
24
25 -# Paths (relative to docs/scripts/sdk-reference/)
25 +# Paths
26 SCRIPT_DIR = Path(__file__).parent
27 -DOCS_DIR = SCRIPT_DIR.parent.parent
28 -PY_SDK_DIR = DOCS_DIR.parent / "python"
29 -OUTPUT_DIR = DOCS_DIR / "content" / "reference" / "sdk-reference" / "python"
27 +PACKAGE_DIR = SCRIPT_DIR.parent
28 +OUTPUT_DIR = (
29 + PACKAGE_DIR.parent
30 + / "docs"
31 + / "content"
32 + / "reference"
33 + / "sdk-reference"
34 + / "python"
35 +)
36
37 # GitHub base URL for source links
38 GITHUB_BASE = "https://github.com/composiohq/composio/blob/next/python"
@@ -88,7 +94,7 @@ def get_source_link(obj: griffe.Object) -> str | None:
94 resolved_path = raw_filepath
95 if not resolved_path:
96 return None
91 - rel_path = resolved_path.relative_to(PY_SDK_DIR)
97 + rel_path = resolved_path.relative_to(PACKAGE_DIR)
98 except ValueError:
99 return None
100 line = obj.lineno if hasattr(obj, "lineno") and obj.lineno else 1
@@ -455,7 +461,7 @@ def main():
461 # Load package
462 print("Loading composio package...")
463 try:
458 - package = griffe.load("composio", search_paths=[str(PY_SDK_DIR)])
464 + package = griffe.load("composio", search_paths=[str(PACKAGE_DIR)])
465 except Exception as e:
466 print(f"Error: {e}")
467 raise SystemExit(1)
ts/packages/core/package.json
+2 -1
@@ -119,7 +119,8 @@
119 "clean": "git clean -xdf node_modules",
120 "build": "bun run --bun tsdown",
121 "test": "vitest run",
122 - "typecheck": "tsc --noEmit --skipLibCheck && tsc --noEmit --skipLibCheck -p tsconfig.type-tests.json"
122 + "typecheck": "tsc --noEmit --skipLibCheck && tsc --noEmit --skipLibCheck -p tsconfig.type-tests.json",
123 + "generate:docs": "tsx scripts/generate-docs.ts"
124 },
125 "keywords": [],
126 "author": "",
ts/packages/core/scripts/README.md new
+25
@@ -0,0 +1,25 @@
1 +# SDK Documentation Generator
2 +
3 +Generates MDX reference docs from TypeScript source using TypeDoc.
4 +
5 +## Usage
6 +
7 +```bash
8 +pnpm generate:docs
9 +```
10 +
11 +## How it works
12 +
13 +1. TypeDoc extracts JSDoc from `src/models/*.ts` → JSON AST
14 +2. `generate-docs.ts` transforms AST → MDX files
15 +3. Output written to `docs/content/reference/sdk-reference/typescript/`
16 +
17 +## Configuration
18 +
19 +- **Entry points**: Auto-discovered from `src/models/*.ts`
20 +- **Excluded classes**: `INTERNAL_CLASSES` set in script
21 +- **User-instantiated classes**: `USER_INSTANTIATED_CLASSES` (shows constructor)
22 +
23 +## CI
24 +
25 +`.github/workflows/generate-sdk-docs.yml` triggers on changes to `ts/packages/core/src/**` and opens a PR with updated docs.
ts/packages/core/scripts/generate-docs.ts renamed
+11 -9
@@ -4,7 +4,7 @@
4 * Generates MDX documentation from TypeScript source code using TypeDoc.
5 * Output is written to the docs content directory.
6 *
7 - * Run from docs/: bun scripts/sdk-reference/generate-typescript.ts
7 + * Run: pnpm --filter @composio/core generate:docs
8 */
9
10 import { mkdir, writeFile, rm, readdir, readFile } from 'fs/promises';
@@ -12,13 +12,15 @@ import { join, dirname } from 'path';
12 import { execSync } from 'child_process';
13 import { fileURLToPath } from 'url';
14
15 -// Paths (relative to docs/scripts/sdk-reference/)
15 +// Paths (relative to ts/packages/core)
16 const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
17 -const DOCS_DIR = join(SCRIPT_DIR, '../..');
18 -const TS_SDK_DIR = join(DOCS_DIR, '../ts/packages/core');
19 -const MODELS_DIR = join(TS_SDK_DIR, 'src/models');
20 -const OUTPUT_DIR = join(DOCS_DIR, 'content/reference/sdk-reference/typescript');
21 -const TEMP_JSON = join(TS_SDK_DIR, '.typedoc-output.json');
17 +const PACKAGE_DIR = join(SCRIPT_DIR, '..');
18 +const MODELS_DIR = join(PACKAGE_DIR, 'src/models');
19 +const OUTPUT_DIR = join(
20 + PACKAGE_DIR,
21 + '../../../docs/content/reference/sdk-reference/typescript'
22 +);
23 +const TEMP_JSON = join(PACKAGE_DIR, '.typedoc-output.json');
24
25 // Internal classes that should NOT be documented (accessed via other APIs)
26 const INTERNAL_CLASSES = new Set([
@@ -723,7 +725,7 @@ async function runTypeDoc(): Promise<TypeDocProject> {
725 ].join(' ');
726
727 try {
726 - execSync(cmd, { stdio: 'pipe', cwd: TS_SDK_DIR });
728 + execSync(cmd, { stdio: 'pipe', cwd: PACKAGE_DIR });
729 } catch (error) {
730 console.error('TypeDoc failed:', error);
731 throw error;
@@ -735,7 +737,7 @@ async function runTypeDoc(): Promise<TypeDocProject> {
737
738 async function main() {
739 console.log('Starting TypeScript SDK documentation generation...\n');
738 - console.log(`Package dir: ${TS_SDK_DIR}`);
740 + console.log(`Package dir: ${PACKAGE_DIR}`);
741 console.log(`Output dir: ${OUTPUT_DIR}\n`);
742
743 // Clean output directory