@portel/photon 1.4.1 โ 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +326 -1177
- package/dist/auto-ui/beam.d.ts +14 -0
- package/dist/auto-ui/beam.d.ts.map +1 -0
- package/dist/auto-ui/beam.js +3057 -0
- package/dist/auto-ui/beam.js.map +1 -0
- package/dist/auto-ui/bridge/index.d.ts +37 -0
- package/dist/auto-ui/bridge/index.d.ts.map +1 -0
- package/dist/auto-ui/bridge/index.js +555 -0
- package/dist/auto-ui/bridge/index.js.map +1 -0
- package/dist/auto-ui/bridge/openai-shim.d.ts +20 -0
- package/dist/auto-ui/bridge/openai-shim.d.ts.map +1 -0
- package/dist/auto-ui/bridge/openai-shim.js +231 -0
- package/dist/auto-ui/bridge/openai-shim.js.map +1 -0
- package/dist/auto-ui/bridge/photon-app.d.ts +162 -0
- package/dist/auto-ui/bridge/photon-app.d.ts.map +1 -0
- package/dist/auto-ui/bridge/photon-app.js +460 -0
- package/dist/auto-ui/bridge/photon-app.js.map +1 -0
- package/dist/auto-ui/bridge/types.d.ts +128 -0
- package/dist/auto-ui/bridge/types.d.ts.map +1 -0
- package/dist/auto-ui/bridge/types.js +7 -0
- package/dist/auto-ui/bridge/types.js.map +1 -0
- package/dist/auto-ui/components/card.d.ts +13 -0
- package/dist/auto-ui/components/card.d.ts.map +1 -0
- package/dist/auto-ui/components/card.js +64 -0
- package/dist/auto-ui/components/card.js.map +1 -0
- package/dist/auto-ui/components/form.d.ts +15 -0
- package/dist/auto-ui/components/form.d.ts.map +1 -0
- package/dist/auto-ui/components/form.js +72 -0
- package/dist/auto-ui/components/form.js.map +1 -0
- package/dist/auto-ui/components/list.d.ts +13 -0
- package/dist/auto-ui/components/list.d.ts.map +1 -0
- package/dist/auto-ui/components/list.js +58 -0
- package/dist/auto-ui/components/list.js.map +1 -0
- package/dist/auto-ui/components/progress.d.ts +18 -0
- package/dist/auto-ui/components/progress.d.ts.map +1 -0
- package/dist/auto-ui/components/progress.js +125 -0
- package/dist/auto-ui/components/progress.js.map +1 -0
- package/dist/auto-ui/components/table.d.ts +13 -0
- package/dist/auto-ui/components/table.d.ts.map +1 -0
- package/dist/auto-ui/components/table.js +82 -0
- package/dist/auto-ui/components/table.js.map +1 -0
- package/dist/auto-ui/components/tree.d.ts +13 -0
- package/dist/auto-ui/components/tree.d.ts.map +1 -0
- package/dist/auto-ui/components/tree.js +61 -0
- package/dist/auto-ui/components/tree.js.map +1 -0
- package/dist/auto-ui/daemon-tools.d.ts +45 -0
- package/dist/auto-ui/daemon-tools.d.ts.map +1 -0
- package/dist/auto-ui/daemon-tools.js +580 -0
- package/dist/auto-ui/daemon-tools.js.map +1 -0
- package/dist/auto-ui/design-system/index.d.ts +21 -0
- package/dist/auto-ui/design-system/index.d.ts.map +1 -0
- package/dist/auto-ui/design-system/index.js +27 -0
- package/dist/auto-ui/design-system/index.js.map +1 -0
- package/dist/auto-ui/design-system/tokens.d.ts +9 -0
- package/dist/auto-ui/design-system/tokens.d.ts.map +1 -0
- package/dist/auto-ui/design-system/tokens.js +27 -0
- package/dist/auto-ui/design-system/tokens.js.map +1 -0
- package/dist/auto-ui/design-system/transaction-ui.d.ts +70 -0
- package/dist/auto-ui/design-system/transaction-ui.d.ts.map +1 -0
- package/dist/auto-ui/design-system/transaction-ui.js +982 -0
- package/dist/auto-ui/design-system/transaction-ui.js.map +1 -0
- package/dist/auto-ui/frontend/index.html +84 -0
- package/dist/auto-ui/index.d.ts +23 -0
- package/dist/auto-ui/index.d.ts.map +1 -0
- package/dist/auto-ui/index.js +28 -0
- package/dist/auto-ui/index.js.map +1 -0
- package/dist/auto-ui/openapi-generator.d.ts +71 -0
- package/dist/auto-ui/openapi-generator.d.ts.map +1 -0
- package/dist/auto-ui/openapi-generator.js +223 -0
- package/dist/auto-ui/openapi-generator.js.map +1 -0
- package/dist/auto-ui/photon-bridge.d.ts +159 -0
- package/dist/auto-ui/photon-bridge.d.ts.map +1 -0
- package/dist/auto-ui/photon-bridge.js +262 -0
- package/dist/auto-ui/photon-bridge.js.map +1 -0
- package/dist/auto-ui/photon-host.d.ts +113 -0
- package/dist/auto-ui/photon-host.d.ts.map +1 -0
- package/dist/auto-ui/photon-host.js +284 -0
- package/dist/auto-ui/photon-host.js.map +1 -0
- package/dist/auto-ui/platform-compat.d.ts +71 -0
- package/dist/auto-ui/platform-compat.d.ts.map +1 -0
- package/dist/auto-ui/platform-compat.js +628 -0
- package/dist/auto-ui/platform-compat.js.map +1 -0
- package/dist/auto-ui/playground-html.d.ts +15 -0
- package/dist/auto-ui/playground-html.d.ts.map +1 -0
- package/dist/auto-ui/playground-html.js +1113 -0
- package/dist/auto-ui/playground-html.js.map +1 -0
- package/dist/auto-ui/playground-server.d.ts +7 -0
- package/dist/auto-ui/playground-server.d.ts.map +1 -0
- package/dist/auto-ui/playground-server.js +840 -0
- package/dist/auto-ui/playground-server.js.map +1 -0
- package/dist/auto-ui/registry.d.ts +13 -0
- package/dist/auto-ui/registry.d.ts.map +1 -0
- package/dist/auto-ui/registry.js +62 -0
- package/dist/auto-ui/registry.js.map +1 -0
- package/dist/auto-ui/renderer.d.ts +14 -0
- package/dist/auto-ui/renderer.d.ts.map +1 -0
- package/dist/auto-ui/renderer.js +88 -0
- package/dist/auto-ui/renderer.js.map +1 -0
- package/dist/auto-ui/rendering/components.d.ts +29 -0
- package/dist/auto-ui/rendering/components.d.ts.map +1 -0
- package/dist/auto-ui/rendering/components.js +773 -0
- package/dist/auto-ui/rendering/components.js.map +1 -0
- package/dist/auto-ui/rendering/field-analyzer.d.ts +48 -0
- package/dist/auto-ui/rendering/field-analyzer.d.ts.map +1 -0
- package/dist/auto-ui/rendering/field-analyzer.js +270 -0
- package/dist/auto-ui/rendering/field-analyzer.js.map +1 -0
- package/dist/auto-ui/rendering/field-renderers.d.ts +64 -0
- package/dist/auto-ui/rendering/field-renderers.d.ts.map +1 -0
- package/dist/auto-ui/rendering/field-renderers.js +317 -0
- package/dist/auto-ui/rendering/field-renderers.js.map +1 -0
- package/dist/auto-ui/rendering/index.d.ts +28 -0
- package/dist/auto-ui/rendering/index.d.ts.map +1 -0
- package/dist/auto-ui/rendering/index.js +60 -0
- package/dist/auto-ui/rendering/index.js.map +1 -0
- package/dist/auto-ui/rendering/layout-selector.d.ts +48 -0
- package/dist/auto-ui/rendering/layout-selector.d.ts.map +1 -0
- package/dist/auto-ui/rendering/layout-selector.js +352 -0
- package/dist/auto-ui/rendering/layout-selector.js.map +1 -0
- package/dist/auto-ui/rendering/template-engine.d.ts +41 -0
- package/dist/auto-ui/rendering/template-engine.d.ts.map +1 -0
- package/dist/auto-ui/rendering/template-engine.js +238 -0
- package/dist/auto-ui/rendering/template-engine.js.map +1 -0
- package/dist/auto-ui/streamable-http-transport.d.ts +103 -0
- package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -0
- package/dist/auto-ui/streamable-http-transport.js +1875 -0
- package/dist/auto-ui/streamable-http-transport.js.map +1 -0
- package/dist/auto-ui/types.d.ts +384 -0
- package/dist/auto-ui/types.d.ts.map +1 -0
- package/dist/auto-ui/types.js +92 -0
- package/dist/auto-ui/types.js.map +1 -0
- package/dist/beam.bundle.js +63137 -0
- package/dist/beam.bundle.js.map +7 -0
- package/dist/claude-code-plugin.d.ts.map +1 -1
- package/dist/claude-code-plugin.js +30 -30
- package/dist/claude-code-plugin.js.map +1 -1
- package/dist/cli/commands/info.d.ts +11 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +313 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/marketplace.d.ts +11 -0
- package/dist/cli/commands/marketplace.d.ts.map +1 -0
- package/dist/cli/commands/marketplace.js +198 -0
- package/dist/cli/commands/marketplace.js.map +1 -0
- package/dist/cli/commands/package-app.d.ts +9 -0
- package/dist/cli/commands/package-app.d.ts.map +1 -0
- package/dist/cli/commands/package-app.js +191 -0
- package/dist/cli/commands/package-app.js.map +1 -0
- package/dist/cli/commands/package.d.ts +11 -0
- package/dist/cli/commands/package.d.ts.map +1 -0
- package/dist/cli/commands/package.js +573 -0
- package/dist/cli/commands/package.js.map +1 -0
- package/dist/cli-alias.d.ts.map +1 -1
- package/dist/cli-alias.js +30 -28
- package/dist/cli-alias.js.map +1 -1
- package/dist/cli-formatter.d.ts +8 -24
- package/dist/cli-formatter.d.ts.map +1 -1
- package/dist/cli-formatter.js +8 -325
- package/dist/cli-formatter.js.map +1 -1
- package/dist/cli.d.ts +15 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1166 -1131
- package/dist/cli.js.map +1 -1
- package/dist/daemon/client.d.ts +84 -3
- package/dist/daemon/client.d.ts.map +1 -1
- package/dist/daemon/client.js +561 -11
- package/dist/daemon/client.js.map +1 -1
- package/dist/daemon/manager.d.ts +51 -12
- package/dist/daemon/manager.d.ts.map +1 -1
- package/dist/daemon/manager.js +122 -61
- package/dist/daemon/manager.js.map +1 -1
- package/dist/daemon/protocol.d.ts +62 -6
- package/dist/daemon/protocol.d.ts.map +1 -1
- package/dist/daemon/protocol.js +76 -1
- package/dist/daemon/protocol.js.map +1 -1
- package/dist/daemon/server.d.ts +6 -6
- package/dist/daemon/server.js +743 -133
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/session-manager.d.ts +8 -1
- package/dist/daemon/session-manager.d.ts.map +1 -1
- package/dist/daemon/session-manager.js +32 -9
- package/dist/daemon/session-manager.js.map +1 -1
- package/dist/deploy/cloudflare.d.ts +12 -0
- package/dist/deploy/cloudflare.d.ts.map +1 -0
- package/dist/deploy/cloudflare.js +216 -0
- package/dist/deploy/cloudflare.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +191 -21
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +1186 -319
- package/dist/loader.js.map +1 -1
- package/dist/markdown-utils.d.ts +8 -0
- package/dist/markdown-utils.d.ts.map +1 -0
- package/dist/markdown-utils.js +63 -0
- package/dist/markdown-utils.js.map +1 -0
- package/dist/marketplace-manager.d.ts +10 -0
- package/dist/marketplace-manager.d.ts.map +1 -1
- package/dist/marketplace-manager.js +112 -28
- package/dist/marketplace-manager.js.map +1 -1
- package/dist/mcp-client.d.ts +9 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +11 -0
- package/dist/mcp-client.js.map +1 -0
- package/dist/mcp-elicitation.d.ts +32 -0
- package/dist/mcp-elicitation.d.ts.map +1 -0
- package/dist/mcp-elicitation.js +26 -0
- package/dist/mcp-elicitation.js.map +1 -0
- package/dist/path-resolver.d.ts +9 -12
- package/dist/path-resolver.d.ts.map +1 -1
- package/dist/path-resolver.js +13 -43
- package/dist/path-resolver.js.map +1 -1
- package/dist/photon-cli-runner.d.ts.map +1 -1
- package/dist/photon-cli-runner.js +204 -77
- package/dist/photon-cli-runner.js.map +1 -1
- package/dist/photon-doc-extractor.d.ts +89 -0
- package/dist/photon-doc-extractor.d.ts.map +1 -1
- package/dist/photon-doc-extractor.js +560 -32
- package/dist/photon-doc-extractor.js.map +1 -1
- package/dist/photons/maker.photon.d.ts +182 -0
- package/dist/photons/maker.photon.d.ts.map +1 -0
- package/dist/photons/maker.photon.js +504 -0
- package/dist/photons/maker.photon.js.map +1 -0
- package/dist/photons/maker.photon.ts +626 -0
- package/dist/photons/marketplace.photon.d.ts +110 -0
- package/dist/photons/marketplace.photon.d.ts.map +1 -0
- package/dist/photons/marketplace.photon.js +260 -0
- package/dist/photons/marketplace.photon.js.map +1 -0
- package/dist/photons/marketplace.photon.ts +378 -0
- package/dist/photons/tunnel.photon.d.ts +80 -0
- package/dist/photons/tunnel.photon.d.ts.map +1 -0
- package/dist/photons/tunnel.photon.js +269 -0
- package/dist/photons/tunnel.photon.js.map +1 -0
- package/dist/photons/tunnel.photon.ts +345 -0
- package/dist/security-scanner.d.ts.map +1 -1
- package/dist/security-scanner.js +18 -15
- package/dist/security-scanner.js.map +1 -1
- package/dist/serv/auth/jwt.d.ts +89 -0
- package/dist/serv/auth/jwt.d.ts.map +1 -0
- package/dist/serv/auth/jwt.js +239 -0
- package/dist/serv/auth/jwt.js.map +1 -0
- package/dist/serv/auth/oauth.d.ts +117 -0
- package/dist/serv/auth/oauth.d.ts.map +1 -0
- package/dist/serv/auth/oauth.js +395 -0
- package/dist/serv/auth/oauth.js.map +1 -0
- package/dist/serv/auth/well-known.d.ts +60 -0
- package/dist/serv/auth/well-known.d.ts.map +1 -0
- package/dist/serv/auth/well-known.js +154 -0
- package/dist/serv/auth/well-known.js.map +1 -0
- package/dist/serv/db/d1-client.d.ts +65 -0
- package/dist/serv/db/d1-client.d.ts.map +1 -0
- package/dist/serv/db/d1-client.js +137 -0
- package/dist/serv/db/d1-client.js.map +1 -0
- package/dist/serv/db/d1-stores.d.ts +62 -0
- package/dist/serv/db/d1-stores.d.ts.map +1 -0
- package/dist/serv/db/d1-stores.js +307 -0
- package/dist/serv/db/d1-stores.js.map +1 -0
- package/dist/serv/index.d.ts +114 -0
- package/dist/serv/index.d.ts.map +1 -0
- package/dist/serv/index.js +172 -0
- package/dist/serv/index.js.map +1 -0
- package/dist/serv/local.d.ts +118 -0
- package/dist/serv/local.d.ts.map +1 -0
- package/dist/serv/local.js +392 -0
- package/dist/serv/local.js.map +1 -0
- package/dist/serv/middleware/auth.d.ts +66 -0
- package/dist/serv/middleware/auth.d.ts.map +1 -0
- package/dist/serv/middleware/auth.js +178 -0
- package/dist/serv/middleware/auth.js.map +1 -0
- package/dist/serv/middleware/tenant.d.ts +94 -0
- package/dist/serv/middleware/tenant.d.ts.map +1 -0
- package/dist/serv/middleware/tenant.js +152 -0
- package/dist/serv/middleware/tenant.js.map +1 -0
- package/dist/serv/runtime/executor.d.ts +76 -0
- package/dist/serv/runtime/executor.d.ts.map +1 -0
- package/dist/serv/runtime/executor.js +105 -0
- package/dist/serv/runtime/executor.js.map +1 -0
- package/dist/serv/runtime/index.d.ts +8 -0
- package/dist/serv/runtime/index.d.ts.map +1 -0
- package/dist/serv/runtime/index.js +10 -0
- package/dist/serv/runtime/index.js.map +1 -0
- package/dist/serv/runtime/oauth-context.d.ts +121 -0
- package/dist/serv/runtime/oauth-context.d.ts.map +1 -0
- package/dist/serv/runtime/oauth-context.js +153 -0
- package/dist/serv/runtime/oauth-context.js.map +1 -0
- package/dist/serv/session/kv-store.d.ts +54 -0
- package/dist/serv/session/kv-store.d.ts.map +1 -0
- package/dist/serv/session/kv-store.js +149 -0
- package/dist/serv/session/kv-store.js.map +1 -0
- package/dist/serv/session/store.d.ts +113 -0
- package/dist/serv/session/store.d.ts.map +1 -0
- package/dist/serv/session/store.js +284 -0
- package/dist/serv/session/store.js.map +1 -0
- package/dist/serv/types/index.d.ts +147 -0
- package/dist/serv/types/index.d.ts.map +1 -0
- package/dist/serv/types/index.js +8 -0
- package/dist/serv/types/index.js.map +1 -0
- package/dist/serv/vault/token-vault.d.ts +102 -0
- package/dist/serv/vault/token-vault.d.ts.map +1 -0
- package/dist/serv/vault/token-vault.js +177 -0
- package/dist/serv/vault/token-vault.js.map +1 -0
- package/dist/server.d.ts +184 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1995 -86
- package/dist/server.js.map +1 -1
- package/dist/shared/cli-sections.d.ts +6 -0
- package/dist/shared/cli-sections.d.ts.map +1 -0
- package/dist/shared/cli-sections.js +16 -0
- package/dist/shared/cli-sections.js.map +1 -0
- package/dist/shared/cli-utils.d.ts +81 -0
- package/dist/shared/cli-utils.d.ts.map +1 -0
- package/dist/shared/cli-utils.js +174 -0
- package/dist/shared/cli-utils.js.map +1 -0
- package/dist/shared/config-docs.d.ts +6 -0
- package/dist/shared/config-docs.d.ts.map +1 -0
- package/dist/shared/config-docs.js +6 -0
- package/dist/shared/config-docs.js.map +1 -0
- package/dist/shared/error-handler.d.ts +128 -0
- package/dist/shared/error-handler.d.ts.map +1 -0
- package/dist/shared/error-handler.js +342 -0
- package/dist/shared/error-handler.js.map +1 -0
- package/dist/shared/logger.d.ts +42 -0
- package/dist/shared/logger.d.ts.map +1 -0
- package/dist/shared/logger.js +123 -0
- package/dist/shared/logger.js.map +1 -0
- package/dist/shared/performance.d.ts +65 -0
- package/dist/shared/performance.d.ts.map +1 -0
- package/dist/shared/performance.js +136 -0
- package/dist/shared/performance.js.map +1 -0
- package/dist/shared/task-runner.d.ts +2 -0
- package/dist/shared/task-runner.d.ts.map +1 -0
- package/dist/shared/task-runner.js +16 -0
- package/dist/shared/task-runner.js.map +1 -0
- package/dist/shared/validation.d.ts +6 -0
- package/dist/shared/validation.d.ts.map +1 -0
- package/dist/shared/validation.js +6 -0
- package/dist/shared/validation.js.map +1 -0
- package/dist/shared-utils.d.ts +63 -0
- package/dist/shared-utils.d.ts.map +1 -0
- package/dist/shared-utils.js +123 -0
- package/dist/shared-utils.js.map +1 -0
- package/dist/template-manager.d.ts +23 -2
- package/dist/template-manager.d.ts.map +1 -1
- package/dist/template-manager.js +176 -87
- package/dist/template-manager.js.map +1 -1
- package/dist/test-client.d.ts.map +1 -1
- package/dist/test-client.js +10 -8
- package/dist/test-client.js.map +1 -1
- package/dist/test-runner.d.ts +52 -0
- package/dist/test-runner.d.ts.map +1 -0
- package/dist/test-runner.js +785 -0
- package/dist/test-runner.js.map +1 -0
- package/dist/testing.d.ts +103 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +163 -0
- package/dist/testing.js.map +1 -0
- package/dist/version-checker.d.ts.map +1 -1
- package/dist/version-checker.js +2 -2
- package/dist/version-checker.js.map +1 -1
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +21 -0
- package/dist/version.js.map +1 -0
- package/dist/watcher.d.ts +6 -3
- package/dist/watcher.d.ts.map +1 -1
- package/dist/watcher.js +49 -10
- package/dist/watcher.js.map +1 -1
- package/package.json +57 -7
- package/templates/cloudflare/worker.ts.template +381 -0
- package/templates/cloudflare/wrangler.toml.template +9 -0
- package/dist/base.d.ts +0 -58
- package/dist/base.d.ts.map +0 -1
- package/dist/base.js +0 -92
- package/dist/base.js.map +0 -1
- package/dist/dependency-manager.d.ts +0 -49
- package/dist/dependency-manager.d.ts.map +0 -1
- package/dist/dependency-manager.js +0 -165
- package/dist/dependency-manager.js.map +0 -1
- package/dist/registry-manager.d.ts +0 -76
- package/dist/registry-manager.d.ts.map +0 -1
- package/dist/registry-manager.js +0 -220
- package/dist/registry-manager.js.map +0 -1
- package/dist/schema-extractor.d.ts +0 -110
- package/dist/schema-extractor.d.ts.map +0 -1
- package/dist/schema-extractor.js +0 -727
- package/dist/schema-extractor.js.map +0 -1
- package/dist/test-marketplace-sources.d.ts +0 -5
- package/dist/test-marketplace-sources.d.ts.map +0 -1
- package/dist/test-marketplace-sources.js +0 -53
- package/dist/test-marketplace-sources.js.map +0 -1
- package/dist/types.d.ts +0 -109
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -12
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,1370 +1,519 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
<div align="center">
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@portel/photon)
|
|
6
|
-
[](https://modelcontextprotocol.io)
|
|
4
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/photon-logo.png" alt="Photon" width="500">
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
**Simplify the creation of CLI tools, MCP servers, and web applications.**
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
A framework, runtime, and ecosystem. Batteries included.
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
[](https://www.npmjs.com/package/@portel/photon)
|
|
11
|
+
[](https://www.npmjs.com/package/@portel/photon)
|
|
12
|
+
[](https://github.com/portel-dev/photon/blob/main/LICENSE)
|
|
13
|
+
[](https://www.typescriptlang.org)
|
|
14
|
+
[](https://nodejs.org)
|
|
15
|
+
[](https://modelcontextprotocol.io)
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## TL;DR
|
|
17
|
-
|
|
18
|
-
**The Problem with MCPs Today:**
|
|
19
|
-
|
|
20
|
-
- Popular MCPs don't exactly match your specific requirements
|
|
21
|
-
- **Security risk**: Malicious MCPs can steal your data through prompt injectionโnot just credentials
|
|
22
|
-
- Scattered across 4-6 files, making security audits impractical
|
|
23
|
-
- Too complex to fork and customize safely
|
|
24
|
-
|
|
25
|
-
**Photon's Solution:** Single-file TypeScript format. Pure business logic, zero boilerplate. Fork-first design where every `.photon.ts` is trivial to audit and customize.
|
|
26
|
-
|
|
27
|
-
Think of it like **NPM and Node, but for MCP**.
|
|
28
|
-
|
|
29
|
-
### Write Once, Use Everywhere
|
|
30
|
-
|
|
31
|
-
The same `.photon.ts` file automatically becomes:
|
|
32
|
-
- ๐ค **MCP Server** - Tools for Claude Desktop, Cursor, and AI assistants
|
|
33
|
-
- ๐ป **CLI Tool** - Beautiful command-line interface for humans
|
|
34
|
-
- ๐ **Platform Integrations** - NCP, Lumina, and future runtimes
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Same file, multiple interfaces:
|
|
38
|
-
photon mcp analytics # Run as MCP server for AI
|
|
39
|
-
photon cli analytics revenue # Use as CLI tool for humans
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Zero extra code. Pure business logic. Infinite deployment targets.**
|
|
43
|
-
|
|
44
|
-
### The Photon Ecosystem Flywheel
|
|
45
|
-
|
|
46
|
-

|
|
17
|
+
[Quick Start](#quick-start) ยท [How It Works](#how-it-works) ยท [Beam UI](#beam) ยท [Marketplace](#marketplace) ยท [Docs](#documentation)
|
|
47
18
|
|
|
48
|
-
|
|
19
|
+
</div>
|
|
49
20
|
|
|
50
21
|
---
|
|
51
22
|
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
Traditional MCP servers scatter your logic across 4-6 files:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
traditional-mcp/
|
|
58
|
-
โโโ server.ts (50 lines of boilerplate)
|
|
59
|
-
โโโ transport.ts (40 lines of setup)
|
|
60
|
-
โโโ schemas.ts (40 lines of type definitions)
|
|
61
|
-
โโโ types.ts (30 lines more types)
|
|
62
|
-
โโโ package.json (dependencies)
|
|
63
|
-
โโโ business.ts (20 lines of YOUR CODE)
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**This creates real problems:**
|
|
67
|
-
|
|
68
|
-
- โ **For AI agents**: Scattered context across files makes understanding difficult
|
|
69
|
-
- โ **For humans**: Jump between files to understand one feature
|
|
70
|
-
- โ **For teams**: 200+ lines before you write business logic
|
|
71
|
-
- โ **For maintenance**: Changes require updating multiple files and configs
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## The Solution
|
|
76
|
-
|
|
77
|
-
Photon puts everything in **one file**:
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
/**
|
|
81
|
-
* Analytics - Query company analytics database
|
|
82
|
-
* @dependencies pg@^8.11.0
|
|
83
|
-
*/
|
|
84
|
-
import { Client } from 'pg';
|
|
85
|
-
|
|
86
|
-
export default class Analytics {
|
|
87
|
-
private db: Client;
|
|
88
|
-
|
|
89
|
-
constructor(
|
|
90
|
-
private host: string,
|
|
91
|
-
private database: string,
|
|
92
|
-
private password: string
|
|
93
|
-
) {}
|
|
94
|
-
|
|
95
|
-
async onInitialize() {
|
|
96
|
-
this.db = new Client({
|
|
97
|
-
host: this.host,
|
|
98
|
-
database: this.database,
|
|
99
|
-
password: this.password
|
|
100
|
-
});
|
|
101
|
-
await this.db.connect();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Get revenue by date range
|
|
106
|
-
* @param startDate Start date (YYYY-MM-DD)
|
|
107
|
-
* @param endDate End date (YYYY-MM-DD)
|
|
108
|
-
*/
|
|
109
|
-
async revenue(params: { startDate: string; endDate: string }) {
|
|
110
|
-
const result = await this.db.query(
|
|
111
|
-
'SELECT date, SUM(amount) FROM orders WHERE date BETWEEN $1 AND $2 GROUP BY date',
|
|
112
|
-
[params.startDate, params.endDate]
|
|
113
|
-
);
|
|
114
|
-
return result.rows;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
```
|
|
23
|
+
## What Is This Thing?
|
|
118
24
|
|
|
119
|
-
|
|
25
|
+
So, here is the situation. You write a single TypeScript file. Just one. And somehow, through some dark magic I donโt fully understand either, you get three things at once:
|
|
120
26
|
|
|
121
|
-
|
|
27
|
+
1. **An MCP server** (so Claude or Cursor can use your tools).
|
|
28
|
+
2. **A CLI tool** (so you can run it from the terminal like a normal human).
|
|
29
|
+
3. **A web application** (a visual dashboard called "Beam" that makes forms for you).
|
|
122
30
|
|
|
123
|
-
|
|
31
|
+
It looks like this:
|
|
124
32
|
|
|
125
|
-
```bash
|
|
126
|
-
# As an MCP server (for AI assistants)
|
|
127
|
-
photon mcp analytics
|
|
128
|
-
# โ Claude Desktop can now call revenue() as a tool
|
|
129
|
-
|
|
130
|
-
# As a CLI (for humans)
|
|
131
|
-
photon cli analytics revenue --startDate 2024-01-01 --endDate 2024-12-31
|
|
132
|
-
# โ Beautiful formatted output:
|
|
133
|
-
# โโโโโโโโโโโโโโฌโโโโโโโโโโโ
|
|
134
|
-
# โ Date โ Revenue โ
|
|
135
|
-
# โโโโโโโโโโโโโโผโโโโโโโโโโโค
|
|
136
|
-
# โ 2024-01-01 โ $12,450 โ
|
|
137
|
-
# โ 2024-01-02 โ $15,320 โ
|
|
138
|
-
# โโโโโโโโโโโโโโดโโโโโโโโโโโ
|
|
139
33
|
```
|
|
140
|
-
|
|
141
|
-
**Same code. Same logic. Two interfaces. Zero duplication.**
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Why One File Changes Everything
|
|
146
|
-
|
|
147
|
-
### ๐ค AI-Native Design
|
|
148
|
-
|
|
149
|
-
AI agents can now understand your entire MCP in one context:
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
# AI can read, understand, and suggest improvements
|
|
153
|
-
"Read my analytics.photon.ts and explain how it works"
|
|
154
|
-
"Review this photon for security issues"
|
|
155
|
-
"Add error handling to this photon"
|
|
34
|
+
analytics.photon.ts โ MCP Server | CLI Tool | Web UI
|
|
156
35
|
```
|
|
157
36
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
### ๐ค Human-Friendly
|
|
37
|
+
You just write the logic. Photon deals with the protocols, schemas, and the boring stuff that usually makes you question your life choices.
|
|
161
38
|
|
|
162
|
-
|
|
163
|
-
- **Review**: Code reviews are one file, one story
|
|
164
|
-
- **Debug**: All logic in one place, no jumping around
|
|
165
|
-
- **Learn**: New team members read one file
|
|
39
|
+
### The Basics
|
|
166
40
|
|
|
167
|
-
|
|
41
|
+
If you are just skimming, here is what you need to know:
|
|
168
42
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
43
|
+
| Concept | What it is | Learn more |
|
|
44
|
+
|---------|-----------|------------|
|
|
45
|
+
| **MCP** | A way for AI to use your tools. Itโs a standard. | [modelcontextprotocol.io](https://modelcontextprotocol.io/introduction) |
|
|
46
|
+
| **Photon file** | A `.photon.ts` file. You define tools as methods in a class. | [Guide](./GUIDE.md) |
|
|
47
|
+
| **Beam** | A web dashboard. It shows your tools as forms. | [Beam UI](#beam) |
|
|
48
|
+
| **Marketplace** | A way to get other peopleโs photons. | [Marketplace](#marketplace) |
|
|
49
|
+
| **Daemon** | A background thing that handles messages and jobs. | [Daemon Pub/Sub](./DAEMON-PUBSUB.md) |
|
|
50
|
+
| **Tags** | JSDoc comments that tell Photon what to do. | [Tag Reference](./DOCBLOCK-TAGS.md) |
|
|
51
|
+
| **Custom UI** | When the auto-generated forms aren't enough. | [Custom UI Guide](./CUSTOM-UI.md) |
|
|
177
52
|
|
|
178
|
-
|
|
53
|
+
### Who Is This For?
|
|
179
54
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
- Experiment without breaking originals
|
|
55
|
+
* **Developers** who want to give AI access to their database but are too lazy to write a full server.
|
|
56
|
+
* **Teams** who want to share tools without emailing zip files.
|
|
57
|
+
* **Anyone** who wants a CLI and a web UI without writing the boilerplate.
|
|
184
58
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
Prompt injection attacks are the new supply-chain threat. A malicious MCP can manipulate AI responses to exfiltrate your entire conversation historyโnot just credentials.
|
|
188
|
-
|
|
189
|
-
**One file = one audit:**
|
|
190
|
-
|
|
191
|
-
- Read 40 lines, understand everything
|
|
192
|
-
- No hidden code scattered across imports
|
|
193
|
-
- Fork and verify in minutes, not hours
|
|
194
|
-
- Trust through transparency, not reputation
|
|
195
|
-
|
|
196
|
-
When you can't trust a photon, you can **safely fork and audit it**. Traditional MCPs with scattered logic? Nearly impossible to verify.
|
|
197
|
-
|
|
198
|
-
### ๐ฆ Zero-Friction Dependencies
|
|
199
|
-
|
|
200
|
-
Dependencies are auto-installed via JSDoc (like `npx` or `uv`):
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
/**
|
|
204
|
-
* @dependencies axios@^1.6.0, lodash@^4.17.21
|
|
205
|
-
*/
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
No manual `npm install`. No `package.json`. Photon handles it.
|
|
59
|
+
You don't need to know what "MCP" actually stands for. If you can write a TypeScript class, you are qualified.
|
|
209
60
|
|
|
210
61
|
---
|
|
211
62
|
|
|
212
63
|
## Quick Start
|
|
213
64
|
|
|
214
|
-
|
|
65
|
+
If you are the type who likes to just run commands and see what happens:
|
|
215
66
|
|
|
216
67
|
```bash
|
|
217
68
|
npm install -g @portel/photon
|
|
69
|
+
photon maker new my-tool # Makes a new photon
|
|
70
|
+
photon # Opens the Beam UI
|
|
218
71
|
```
|
|
219
72
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
The [**official Photon marketplace**](https://github.com/portel-dev/photons) comes pre-configured with 16+ production-ready photons:
|
|
73
|
+
Or if you don't want to install anything (I get it):
|
|
223
74
|
|
|
224
75
|
```bash
|
|
225
|
-
|
|
226
|
-
photon
|
|
227
|
-
|
|
228
|
-
# Install any photon (filesystem, git, postgres, mongodb, slack, etc.)
|
|
229
|
-
photon add filesystem
|
|
230
|
-
|
|
231
|
-
# or else copy your own .photon.ts file to
|
|
232
|
-
# .photon folder in your user folder
|
|
233
|
-
|
|
234
|
-
# Call info command with mcp option
|
|
235
|
-
photon info filesystem --mcp
|
|
236
|
-
# Get client config json
|
|
237
|
-
{
|
|
238
|
-
"filesystem": {
|
|
239
|
-
"command": "photon",
|
|
240
|
-
"args": [
|
|
241
|
-
"mcp",
|
|
242
|
-
"filesystem"
|
|
243
|
-
],
|
|
244
|
-
"env": {
|
|
245
|
-
"FILESYSTEM_WORKDIR": "/Users/arul/Documents",
|
|
246
|
-
"FILESYSTEM_MAX_FILE_SIZE": "10485760",
|
|
247
|
-
"FILESYSTEM_ALLOW_HIDDEN": "false"
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
# Add to your client
|
|
76
|
+
npx @portel/photon maker new my-tool
|
|
77
|
+
npx @portel/photon
|
|
252
78
|
```
|
|
253
79
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
Use the [**photon-skill**](https://github.com/portel-dev/photon-skill) for Claude Desktop or Claude Code to generate `.photon.ts` files:
|
|
257
|
-
- Single TypeScript files with metadata
|
|
258
|
-
- AI understands complete context in one file
|
|
259
|
-
- Zero boilerplate, just business logic
|
|
260
|
-
|
|
261
|
-
### Add Your Own Marketplace
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
# Add custom marketplace from GitHub
|
|
265
|
-
photon marketplace add your-org/your-photons
|
|
266
|
-
|
|
267
|
-
# Install from your marketplace
|
|
268
|
-
photon add your-custom-tool
|
|
269
|
-
```
|
|
80
|
+
> **Note:** You need [Node.js 18+](https://nodejs.org). Also, TypeScript helps, but Photon handles the compiling, so you don't have to fight with `tsconfig.json`.
|
|
270
81
|
|
|
271
82
|
---
|
|
272
83
|
|
|
273
|
-
##
|
|
84
|
+
## How It Works
|
|
274
85
|
|
|
275
|
-
|
|
276
|
-
|--------|-----------------|--------|
|
|
277
|
-
| **Setup Time** | 40 minutes | 5 minutes |
|
|
278
|
-
| **Lines of Code** | 200+ | ~40 |
|
|
279
|
-
| **Files Needed** | 4-6 files | 1 file |
|
|
280
|
-
| **Boilerplate** | Manual | Auto-handled |
|
|
281
|
-
| **Schema Generation** | Manual | Automatic from TypeScript |
|
|
282
|
-
| **Dependencies** | Manual npm install | Auto-installed from @dependencies |
|
|
283
|
-
| **Hot Reload** | Configure yourself | Built-in with --dev |
|
|
284
|
-
| **AI Context** | Scattered | Single file |
|
|
285
|
-
| **CLI Interface** | Write separate code | Automatic from same code |
|
|
286
|
-
| **Deployment Targets** | MCP only | MCP, CLI, NCP, Lumina, APIs... |
|
|
86
|
+
A photon is just a TypeScript class. The **public methods become tools**. Photon reads your code, looks at the types, reads your comments, and then generates everything else.
|
|
287
87
|
|
|
288
|
-
|
|
88
|
+
Iโll show you.
|
|
289
89
|
|
|
290
|
-
|
|
90
|
+
### Step 1: The Bare Minimum
|
|
291
91
|
|
|
292
|
-
|
|
92
|
+
Here is a class with one method. This is a valid photon.
|
|
293
93
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
photon cli lg-remote
|
|
301
|
-
|
|
302
|
-
# Call methods with natural syntax
|
|
303
|
-
photon cli lg-remote volume 50
|
|
304
|
-
photon cli lg-remote volume +5
|
|
305
|
-
photon cli lg-remote channel 7
|
|
306
|
-
photon cli lg-remote app netflix
|
|
307
|
-
|
|
308
|
-
# Get method help
|
|
309
|
-
photon cli lg-remote volume --help
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### Beautiful Output Formats
|
|
313
|
-
|
|
314
|
-
Photon automatically formats output based on data structure:
|
|
315
|
-
|
|
316
|
-
**Tables** - Key-value pairs and flat objects:
|
|
317
|
-
```bash
|
|
318
|
-
$ photon cli lg-remote volume
|
|
319
|
-
โโโโโโโโโโโฌโโโโโ
|
|
320
|
-
โ volume โ 45 โ
|
|
321
|
-
โโโโโโโโโโโผโโโโโค
|
|
322
|
-
โ muted โ no โ
|
|
323
|
-
โโโโโโโโโโโผโโโโโค
|
|
324
|
-
โ maxVol โ 100โ
|
|
325
|
-
โโโโโโโโโโโดโโโโโ
|
|
94
|
+
```typescript
|
|
95
|
+
export default class Weather {
|
|
96
|
+
async forecast(params: { city: string }) {
|
|
97
|
+
return `Weather for ${params.city}: Sunny, 72ยฐF`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
326
100
|
```
|
|
327
101
|
|
|
328
|
-
**
|
|
329
|
-
```bash
|
|
330
|
-
$ photon cli lg-remote apps
|
|
331
|
-
โข Netflix (netflix)
|
|
332
|
-
โข YouTube (youtube.leanback.v4)
|
|
333
|
-
โข HDMI1 (com.webos.app.hdmi1)
|
|
334
|
-
โข Disney+ (disney)
|
|
335
|
-
```
|
|
102
|
+
**What happens:** Beam sees this and makes a form with a text box labeled "city". You click a button, and it runs.
|
|
336
103
|
|
|
337
|
-
**
|
|
338
|
-
|
|
104
|
+
**What you get:**
|
|
105
|
+
* `photon mcp weather` (The server for Claude)
|
|
106
|
+
* `photon cli weather forecast --city Paris` (The command line tool)
|
|
107
|
+
* `photon` (The web UI)
|
|
339
108
|
|
|
340
|
-
|
|
109
|
+
<div align="center">
|
|
110
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-1.png" alt="Step 1 โ Bare method in Beam" width="600">
|
|
111
|
+
</div>
|
|
341
112
|
|
|
342
|
-
|
|
113
|
+
### Step 2: Adding Descriptions
|
|
343
114
|
|
|
344
|
-
|
|
345
|
-
2. **`table`** - Flat object or array of flat objects
|
|
346
|
-
3. **`tree`** - Nested/hierarchical data
|
|
347
|
-
4. **`list`** - Array of simple items
|
|
348
|
-
5. **`none`** - No return value (void operations)
|
|
115
|
+
If you add JSDoc comments, they show up as descriptions.
|
|
349
116
|
|
|
350
|
-
**Hint the format** (optional):
|
|
351
117
|
```typescript
|
|
352
118
|
/**
|
|
353
|
-
*
|
|
354
|
-
*
|
|
119
|
+
* Weather - Check weather forecasts worldwide
|
|
120
|
+
*
|
|
121
|
+
* Provides current conditions.
|
|
355
122
|
*/
|
|
356
|
-
|
|
357
|
-
|
|
123
|
+
export default class Weather {
|
|
124
|
+
/**
|
|
125
|
+
* Get the weather forecast
|
|
126
|
+
* @param city City name (e.g., "London")
|
|
127
|
+
*/
|
|
128
|
+
async forecast(params: { city: string }) {
|
|
129
|
+
return `Weather for ${params.city}: Sunny, 72ยฐF`;
|
|
130
|
+
}
|
|
358
131
|
}
|
|
359
132
|
```
|
|
360
133
|
|
|
361
|
-
**
|
|
362
|
-
|
|
363
|
-
### CLI Command Reference
|
|
364
|
-
|
|
365
|
-
#### `photon cli <photon-name> [method] [args...]`
|
|
366
|
-
|
|
367
|
-
**List all methods:**
|
|
368
|
-
```bash
|
|
369
|
-
photon cli lg-remote
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
**Call a method:**
|
|
373
|
-
```bash
|
|
374
|
-
# No parameters
|
|
375
|
-
photon cli lg-remote status
|
|
376
|
-
|
|
377
|
-
# Single parameter
|
|
378
|
-
photon cli lg-remote volume 50
|
|
379
|
-
|
|
380
|
-
# Multiple parameters
|
|
381
|
-
photon cli lg-remote search query "breaking bad" limit 10
|
|
382
|
-
|
|
383
|
-
# Relative adjustments
|
|
384
|
-
photon cli lg-remote volume +5
|
|
385
|
-
photon cli lg-remote channel +1
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
**Get method help:**
|
|
389
|
-
```bash
|
|
390
|
-
photon cli lg-remote volume --help
|
|
391
|
-
```
|
|
134
|
+
**What happens:** Now the UI has helpful text. Also, the AI client reads this to understand what the tool does.
|
|
392
135
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
```
|
|
136
|
+
<div align="center">
|
|
137
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-2.png" alt="Step 2 โ JSDoc descriptions in Beam" width="600">
|
|
138
|
+
</div>
|
|
397
139
|
|
|
398
|
-
###
|
|
140
|
+
### Step 3: Configuration (The clever bit)
|
|
399
141
|
|
|
400
|
-
|
|
142
|
+
If you need an API key, put it in the constructor.
|
|
401
143
|
|
|
402
|
-
Write your logic once:
|
|
403
144
|
```typescript
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
145
|
+
export default class Weather {
|
|
146
|
+
constructor(
|
|
147
|
+
private apiKey: string,
|
|
148
|
+
private units: string = 'metric'
|
|
149
|
+
) {}
|
|
150
|
+
|
|
151
|
+
async forecast(params: { city: string }) {
|
|
152
|
+
const res = await fetch(
|
|
153
|
+
`https://api.openweathermap.org/data/2.5/weather?q=${params.city}&appid=${this.apiKey}&units=${this.units}`
|
|
154
|
+
);
|
|
155
|
+
return await res.json();
|
|
411
156
|
}
|
|
412
|
-
// ... rest of logic
|
|
413
|
-
return this._getCurrentVolume(); // Always return current state
|
|
414
157
|
}
|
|
415
158
|
```
|
|
416
159
|
|
|
417
|
-
**
|
|
418
|
-
- โ
**MCP**: Claude Desktop, Cursor, etc.
|
|
419
|
-
- โ
**CLI**: `photon cli lg-remote volume +5`
|
|
420
|
-
- โ
**Future interfaces**: HTTP, WebSocket, etc.
|
|
160
|
+
**What happens:** Beam creates a settings panel. `apiKey` becomes a password field. It also maps to environment variables like `WEATHER_API_KEY`. It just works.
|
|
421
161
|
|
|
422
|
-
|
|
162
|
+
<div align="center">
|
|
163
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-3.png" alt="Step 3 โ Configuration panel in Beam" width="600">
|
|
164
|
+
</div>
|
|
423
165
|
|
|
424
|
-
|
|
166
|
+
### Step 4: Validation (Stop bad inputs)
|
|
425
167
|
|
|
426
|
-
|
|
427
|
-
$ photon cli lg-remote channels
|
|
428
|
-
โ Error: TV channels not available. Currently on HDMI1.
|
|
429
|
-
Switch to a TV tuner input to access channels.
|
|
430
|
-
```
|
|
168
|
+
You can add tags to valid inputs.
|
|
431
169
|
|
|
432
|
-
The same error quality appears in MCP toolsโbecause it's the same code.
|
|
433
|
-
|
|
434
|
-
### Exit Codes
|
|
435
|
-
|
|
436
|
-
The CLI properly returns exit codes for automation:
|
|
437
|
-
- **0**: Success
|
|
438
|
-
- **1**: Error (tool execution failed, invalid parameters, etc.)
|
|
439
|
-
|
|
440
|
-
Perfect for shell scripts and CI/CD:
|
|
441
|
-
```bash
|
|
442
|
-
if photon cli lg-remote volume 50; then
|
|
443
|
-
echo "Volume set successfully"
|
|
444
|
-
else
|
|
445
|
-
echo "Failed to set volume"
|
|
446
|
-
exit 1
|
|
447
|
-
fi
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
---
|
|
451
|
-
|
|
452
|
-
## How Photon Works
|
|
453
|
-
|
|
454
|
-
### Convention = Automation
|
|
455
|
-
|
|
456
|
-
**File Name โ MCP Name**
|
|
457
170
|
```typescript
|
|
458
|
-
|
|
459
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Weather - Check weather forecasts worldwide
|
|
173
|
+
* @dependencies node-fetch@^3.0.0
|
|
174
|
+
*/
|
|
175
|
+
export default class Weather {
|
|
176
|
+
constructor(
|
|
177
|
+
private apiKey: string,
|
|
178
|
+
private units: string = 'metric'
|
|
179
|
+
) {}
|
|
460
180
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
181
|
+
/**
|
|
182
|
+
* Get the weather forecast for a city
|
|
183
|
+
* @param city City name {@example London} {@pattern ^[a-zA-Z\s]+$}
|
|
184
|
+
* @param days Number of days {@min 1} {@max 7}
|
|
185
|
+
* @format table
|
|
186
|
+
*/
|
|
187
|
+
async forecast(params: { city: string; days?: number }) {
|
|
188
|
+
// fetch and return forecast data...
|
|
189
|
+
}
|
|
190
|
+
}
|
|
465
191
|
```
|
|
466
192
|
|
|
467
|
-
**
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
193
|
+
**What happens:**
|
|
194
|
+
* The `city` input validates the regex.
|
|
195
|
+
* The `days` input becomes a number spinner (1-7).
|
|
196
|
+
* The result is formatted as a table.
|
|
197
|
+
* `@dependencies` makes Photon install `node-fetch` automatically. You don't even run `npm install`.
|
|
472
198
|
|
|
473
|
-
|
|
474
|
-
```typescript
|
|
475
|
-
/**
|
|
476
|
-
* Get revenue by date range
|
|
477
|
-
* @param startDate Start date (YYYY-MM-DD)
|
|
478
|
-
*/
|
|
479
|
-
// Photon extracts descriptions automatically
|
|
480
|
-
```
|
|
199
|
+
#### System CLI Dependencies
|
|
481
200
|
|
|
482
|
-
|
|
483
|
-
```typescript
|
|
484
|
-
constructor(private host: string, private database: string) {}
|
|
485
|
-
// Maps to: ANALYTICS_HOST, ANALYTICS_DATABASE
|
|
486
|
-
```
|
|
201
|
+
If your photon wraps a command-line tool (e.g. `ffmpeg`, `git`, `docker`), declare it with `@cli`. Photon checks for the tool at load time and refuses to load if it's missing.
|
|
487
202
|
|
|
488
|
-
**JSDoc @dependencies โ Auto-Install**
|
|
489
203
|
```typescript
|
|
490
204
|
/**
|
|
491
|
-
*
|
|
205
|
+
* Video processor
|
|
206
|
+
* @cli ffmpeg - https://ffmpeg.org/download.html
|
|
207
|
+
* @cli imagemagick - https://imagemagick.org/script/download.php
|
|
492
208
|
*/
|
|
493
|
-
|
|
209
|
+
export default class VideoProcessor {
|
|
210
|
+
async convert({ input, format }: { input: string; format: string }) {
|
|
211
|
+
// ffmpeg is guaranteed to exist if this method runs
|
|
212
|
+
}
|
|
213
|
+
}
|
|
494
214
|
```
|
|
495
215
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
## Available Photons
|
|
499
|
-
|
|
500
|
-
Production-ready photons from **[portel-dev/photons](https://github.com/portel-dev/photons)**:
|
|
501
|
-
|
|
502
|
-
| Category | Photons | Total Tools |
|
|
503
|
-
|----------|---------|-------------|
|
|
504
|
-
| **Databases** | PostgreSQL (7), MongoDB (13), Redis (18), SQLite (9) | 47 |
|
|
505
|
-
| **Infrastructure** | AWS S3 (11), Docker (10), Filesystem (13) | 34 |
|
|
506
|
-
| **Development** | Git (11), GitHub Issues (7) | 18 |
|
|
507
|
-
| **Communication** | Email (8), Slack (7) | 15 |
|
|
508
|
-
| **Productivity** | Google Calendar (9), Jira (10) | 19 |
|
|
509
|
-
| **Utilities** | Fetch (2), Time (3), Memory (10) | 15 |
|
|
216
|
+
If `ffmpeg` is not installed, the photon won't load and the user sees:
|
|
510
217
|
|
|
511
|
-
**Total: 16 photons, 148 focused tools**
|
|
512
|
-
|
|
513
|
-
Browse and install:
|
|
514
|
-
```bash
|
|
515
|
-
photon info # See all available photons
|
|
516
|
-
photon add postgres # Install any photon
|
|
517
|
-
photon search git # Search by keyword
|
|
518
218
|
```
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
## Create Your Own Photon
|
|
523
|
-
|
|
524
|
-
### 1. Initialize
|
|
525
|
-
|
|
526
|
-
```bash
|
|
527
|
-
photon init analytics
|
|
219
|
+
VideoProcessor requires the following CLI tools to be installed:
|
|
220
|
+
- ffmpeg: Install from https://ffmpeg.org/download.html
|
|
528
221
|
```
|
|
529
222
|
|
|
530
|
-
|
|
223
|
+
> See the full [Tag Reference](./DOCBLOCK-TAGS.md) for all available tags. There are 30+ covering validation, UI hints, scheduling, webhooks, and more.
|
|
531
224
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
```
|
|
225
|
+
<div align="center">
|
|
226
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-4.png" alt="Step 4 โ Validation and formatting in Beam" width="600">
|
|
227
|
+
</div>
|
|
536
228
|
|
|
537
|
-
###
|
|
229
|
+
### Step 5: Custom UI (When you want to be fancy)
|
|
230
|
+
|
|
231
|
+
If the auto-generated form is too boring, you can write your own HTML.
|
|
538
232
|
|
|
539
233
|
```typescript
|
|
540
234
|
/**
|
|
541
|
-
*
|
|
542
|
-
* @dependencies
|
|
235
|
+
* Weather - Check weather forecasts worldwide
|
|
236
|
+
* @dependencies node-fetch@^3.0.0
|
|
237
|
+
* @ui dashboard ./ui/weather.html
|
|
543
238
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
export default class Analytics {
|
|
547
|
-
private db: Client;
|
|
548
|
-
|
|
549
|
-
constructor(
|
|
550
|
-
private host: string,
|
|
551
|
-
private database: string,
|
|
552
|
-
private password: string
|
|
553
|
-
) {}
|
|
554
|
-
|
|
555
|
-
async onInitialize() {
|
|
556
|
-
this.db = new Client({
|
|
557
|
-
host: this.host,
|
|
558
|
-
database: this.database,
|
|
559
|
-
password: this.password
|
|
560
|
-
});
|
|
561
|
-
await this.db.connect();
|
|
562
|
-
}
|
|
239
|
+
export default class Weather {
|
|
240
|
+
constructor(private apiKey: string, private units: string = 'metric') {}
|
|
563
241
|
|
|
564
242
|
/**
|
|
565
|
-
* Get
|
|
566
|
-
* @
|
|
567
|
-
* @
|
|
243
|
+
* Get the weather forecast for a city
|
|
244
|
+
* @ui dashboard
|
|
245
|
+
* @format table
|
|
568
246
|
*/
|
|
569
|
-
async
|
|
570
|
-
|
|
571
|
-
'SELECT date, SUM(amount) FROM orders WHERE date BETWEEN $1 AND $2 GROUP BY date',
|
|
572
|
-
[params.startDate, params.endDate]
|
|
573
|
-
);
|
|
574
|
-
return result.rows;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
async onShutdown() {
|
|
578
|
-
await this.db.end();
|
|
247
|
+
async forecast(params: { city: string; days?: number }) {
|
|
248
|
+
// returns structured weather data
|
|
579
249
|
}
|
|
580
250
|
}
|
|
581
251
|
```
|
|
582
252
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
253
|
+
```html
|
|
254
|
+
<!-- ui/weather.html -->
|
|
255
|
+
<div id="weather-app">
|
|
256
|
+
<div id="forecast"></div>
|
|
257
|
+
</div>
|
|
258
|
+
<script>
|
|
259
|
+
window.photon.onResult(data => {
|
|
260
|
+
document.getElementById('forecast').innerHTML = renderWeather(data);
|
|
261
|
+
});
|
|
262
|
+
</script>
|
|
591
263
|
```
|
|
592
264
|
|
|
593
|
-
**
|
|
594
|
-
- โ
TypeScript compilation (via esbuild)
|
|
595
|
-
- โ
Schema generation from types
|
|
596
|
-
- โ
MCP protocol implementation
|
|
597
|
-
- โ
Environment variable mapping
|
|
598
|
-
- โ
Dependency installation (@dependencies)
|
|
599
|
-
- โ
Hot reload in dev mode
|
|
265
|
+
**What changes in Beam:** Instead of the auto-generated table, results render inside your custom HTML (a weather dashboard with icons, charts, or any visualization you build). The `window.photon` API bridges your UI to the tool system.
|
|
600
266
|
|
|
601
|
-
|
|
602
|
-
**Photon handles:** Everything else
|
|
267
|
+
> Custom UIs follow the [MCP Apps Extension (SEP-1865)](https://github.com/nicolo-ribaudo/modelcontextprotocol/blob/nicolo/sep-1865/docs/specification/draft/extensions/apps.mdx) standard and work across compatible hosts. See the [Custom UI Guide](./CUSTOM-UI.md).
|
|
603
268
|
|
|
604
|
-
|
|
269
|
+
<div align="center">
|
|
270
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/readme-step-5.png" alt="Step 5 โ Custom UI result in Beam" width="600">
|
|
271
|
+
</div>
|
|
605
272
|
|
|
606
|
-
|
|
273
|
+
### In Summary
|
|
607
274
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
### Development Commands
|
|
617
|
-
|
|
618
|
-
#### `photon init <name>`
|
|
619
|
-
Create a new `.photon.ts` file from template.
|
|
620
|
-
|
|
621
|
-
```bash
|
|
622
|
-
# Create in default directory (~/.photon)
|
|
623
|
-
photon init calculator
|
|
624
|
-
|
|
625
|
-
# Create in custom directory
|
|
626
|
-
photon --working-dir ./my-photons init calculator
|
|
627
|
-
```
|
|
275
|
+
| Step | You write | Photon generates |
|
|
276
|
+
|------|---------|-----------------|
|
|
277
|
+
| **1. Methods** | A function | Tools, CLI commands, Forms |
|
|
278
|
+
| **2. JSDoc** | Comments | Descriptions for AI and Humans |
|
|
279
|
+
| **3. Constructor** | Arguments | Config UI, Env vars |
|
|
280
|
+
| **4. Tags** | `@tags` | Validation, Installers, Formatting |
|
|
281
|
+
| **5. Custom UI** | HTML | A custom app |
|
|
628
282
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
```bash
|
|
633
|
-
photon validate calculator
|
|
634
|
-
```
|
|
635
|
-
|
|
636
|
-
Useful for:
|
|
637
|
-
- Checking syntax errors
|
|
638
|
-
- Testing schema generation
|
|
639
|
-
- CI/CD validation
|
|
640
|
-
|
|
641
|
-
### Running Photons
|
|
642
|
-
|
|
643
|
-
#### `photon mcp <name>`
|
|
644
|
-
Run a photon as an MCP server.
|
|
645
|
-
|
|
646
|
-
```bash
|
|
647
|
-
# Production mode
|
|
648
|
-
photon mcp calculator
|
|
649
|
-
|
|
650
|
-
# Development mode (hot reload on file changes)
|
|
651
|
-
photon mcp calculator --dev
|
|
652
|
-
|
|
653
|
-
# Validate configuration without running
|
|
654
|
-
photon mcp calculator --validate
|
|
655
|
-
|
|
656
|
-
# Show MCP configuration template
|
|
657
|
-
photon mcp calculator --config
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
**Options:**
|
|
661
|
-
- `--dev` - Enable hot reload for development
|
|
662
|
-
- `--validate` - Validate configuration without running server
|
|
663
|
-
- `--config` - Show configuration template and exit
|
|
664
|
-
|
|
665
|
-
#### `photon cli <photon-name> [method] [args...]`
|
|
666
|
-
Run photon methods directly from the command line.
|
|
667
|
-
|
|
668
|
-
```bash
|
|
669
|
-
# List all available methods
|
|
670
|
-
photon cli calculator
|
|
671
|
-
|
|
672
|
-
# Call a method with arguments
|
|
673
|
-
photon cli calculator add 5 10
|
|
674
|
-
|
|
675
|
-
# Get method-specific help
|
|
676
|
-
photon cli calculator add --help
|
|
677
|
-
|
|
678
|
-
# Output raw JSON instead of formatted output
|
|
679
|
-
photon cli calculator add 5 10 --json
|
|
680
|
-
```
|
|
681
|
-
|
|
682
|
-
**Arguments:**
|
|
683
|
-
- Arguments are automatically coerced to expected types (string, number, boolean)
|
|
684
|
-
- Strings starting with `+` or `-` are preserved for relative adjustments
|
|
685
|
-
- Arrays and objects can be passed as JSON strings
|
|
686
|
-
|
|
687
|
-
**Options:**
|
|
688
|
-
- `--help` - Show help for the photon or specific method
|
|
689
|
-
- `--json` - Output raw JSON instead of formatted output
|
|
690
|
-
|
|
691
|
-
**Exit Codes:**
|
|
692
|
-
- `0` - Success
|
|
693
|
-
- `1` - Error (invalid arguments, execution failure, etc.)
|
|
694
|
-
|
|
695
|
-
**Examples:**
|
|
696
|
-
|
|
697
|
-
```bash
|
|
698
|
-
# Smart home control
|
|
699
|
-
photon cli lg-remote volume 50
|
|
700
|
-
photon cli lg-remote volume +5 # Relative adjustment
|
|
701
|
-
photon cli lg-remote channel 7
|
|
702
|
-
photon cli lg-remote app netflix
|
|
703
|
-
|
|
704
|
-
# Database queries
|
|
705
|
-
photon cli postgres query "SELECT * FROM users LIMIT 10"
|
|
706
|
-
|
|
707
|
-
# File operations
|
|
708
|
-
photon cli filesystem read-file path "/home/user/document.txt"
|
|
709
|
-
|
|
710
|
-
# Git operations
|
|
711
|
-
photon cli git commit message "feat: add new feature"
|
|
712
|
-
```
|
|
713
|
-
|
|
714
|
-
### Inspect & Configure
|
|
715
|
-
|
|
716
|
-
#### `photon info [name]`
|
|
717
|
-
List all photons or show details for a specific one.
|
|
718
|
-
|
|
719
|
-
```bash
|
|
720
|
-
# List all installed photons
|
|
721
|
-
photon info
|
|
722
|
-
|
|
723
|
-
# Show details for one photon
|
|
724
|
-
photon info calculator
|
|
725
|
-
|
|
726
|
-
# Get MCP client configuration
|
|
727
|
-
photon info calculator --mcp
|
|
728
|
-
```
|
|
729
|
-
|
|
730
|
-
**Options:**
|
|
731
|
-
- `--mcp` - Output MCP server configuration for your client
|
|
732
|
-
|
|
733
|
-
### Marketplace Commands
|
|
734
|
-
|
|
735
|
-
#### `photon add <name>`
|
|
736
|
-
Install a photon from a marketplace.
|
|
737
|
-
|
|
738
|
-
```bash
|
|
739
|
-
# Install from any enabled marketplace
|
|
740
|
-
photon add filesystem
|
|
741
|
-
|
|
742
|
-
# Install from specific marketplace
|
|
743
|
-
photon add filesystem --marketplace portel-dev/photons
|
|
744
|
-
```
|
|
745
|
-
|
|
746
|
-
**Options:**
|
|
747
|
-
- `--marketplace <name>` - Specify which marketplace to use
|
|
748
|
-
|
|
749
|
-
#### `photon search <query>`
|
|
750
|
-
Search for photons across all enabled marketplaces.
|
|
751
|
-
|
|
752
|
-
```bash
|
|
753
|
-
photon search database
|
|
754
|
-
photon search git
|
|
755
|
-
```
|
|
756
|
-
|
|
757
|
-
#### `photon info <name>`
|
|
758
|
-
Show detailed information about a photon from marketplaces.
|
|
759
|
-
|
|
760
|
-
```bash
|
|
761
|
-
photon info postgres
|
|
762
|
-
```
|
|
763
|
-
|
|
764
|
-
Shows:
|
|
765
|
-
- Description
|
|
766
|
-
- Available tools
|
|
767
|
-
- Configuration requirements
|
|
768
|
-
- Marketplace source
|
|
769
|
-
|
|
770
|
-
#### `photon upgrade [name]`
|
|
771
|
-
Upgrade photons from marketplaces.
|
|
772
|
-
|
|
773
|
-
```bash
|
|
774
|
-
# Upgrade all photons
|
|
775
|
-
photon upgrade
|
|
776
|
-
|
|
777
|
-
# Upgrade specific photon
|
|
778
|
-
photon upgrade filesystem
|
|
779
|
-
|
|
780
|
-
# Check for updates without upgrading
|
|
781
|
-
photon upgrade --check
|
|
782
|
-
```
|
|
783
|
-
|
|
784
|
-
**Options:**
|
|
785
|
-
- `--check` - Only check for updates, don't install
|
|
786
|
-
|
|
787
|
-
#### `photon conflicts`
|
|
788
|
-
Show photons available in multiple marketplaces.
|
|
789
|
-
|
|
790
|
-
```bash
|
|
791
|
-
photon conflicts
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
Useful when same photon name exists in different marketplaces.
|
|
795
|
-
|
|
796
|
-
### Marketplace Management
|
|
797
|
-
|
|
798
|
-
#### `photon marketplace list`
|
|
799
|
-
List all configured marketplaces.
|
|
800
|
-
|
|
801
|
-
```bash
|
|
802
|
-
photon marketplace list
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
#### `photon marketplace add <repo>`
|
|
806
|
-
Add a new marketplace.
|
|
807
|
-
|
|
808
|
-
```bash
|
|
809
|
-
# GitHub shorthand
|
|
810
|
-
photon marketplace add username/repo
|
|
811
|
-
|
|
812
|
-
# Full HTTPS URL
|
|
813
|
-
photon marketplace add https://github.com/username/repo
|
|
814
|
-
|
|
815
|
-
# SSH URL
|
|
816
|
-
photon marketplace add git@github.com:username/repo.git
|
|
817
|
-
|
|
818
|
-
# Direct URL
|
|
819
|
-
photon marketplace add https://example.com/marketplace
|
|
820
|
-
|
|
821
|
-
# Local path
|
|
822
|
-
photon marketplace add ./my-local-marketplace
|
|
823
|
-
```
|
|
824
|
-
|
|
825
|
-
#### `photon marketplace remove <name>`
|
|
826
|
-
Remove a marketplace.
|
|
827
|
-
|
|
828
|
-
```bash
|
|
829
|
-
photon marketplace remove my-marketplace
|
|
830
|
-
```
|
|
831
|
-
|
|
832
|
-
#### `photon marketplace enable <name>`
|
|
833
|
-
Enable a previously disabled marketplace.
|
|
834
|
-
|
|
835
|
-
```bash
|
|
836
|
-
photon marketplace enable my-marketplace
|
|
837
|
-
```
|
|
838
|
-
|
|
839
|
-
#### `photon marketplace disable <name>`
|
|
840
|
-
Disable a marketplace without removing it.
|
|
841
|
-
|
|
842
|
-
```bash
|
|
843
|
-
photon marketplace disable my-marketplace
|
|
844
|
-
```
|
|
845
|
-
|
|
846
|
-
#### `photon marketplace update [name]`
|
|
847
|
-
Update marketplace metadata from remote.
|
|
848
|
-
|
|
849
|
-
```bash
|
|
850
|
-
# Update all marketplaces
|
|
851
|
-
photon marketplace update
|
|
852
|
-
|
|
853
|
-
# Update specific marketplace
|
|
854
|
-
photon marketplace update portel-dev/photons
|
|
855
|
-
```
|
|
856
|
-
|
|
857
|
-
### Advanced Commands
|
|
858
|
-
|
|
859
|
-
#### `photon sync marketplace [path]`
|
|
860
|
-
Generate marketplace manifest and documentation.
|
|
861
|
-
|
|
862
|
-
```bash
|
|
863
|
-
# Sync current directory
|
|
864
|
-
photon sync marketplace
|
|
865
|
-
|
|
866
|
-
# Sync specific directory
|
|
867
|
-
photon sync marketplace ./my-marketplace
|
|
868
|
-
|
|
869
|
-
# Generate Claude Code plugin files too
|
|
870
|
-
photon sync marketplace --claude-code
|
|
871
|
-
```
|
|
872
|
-
|
|
873
|
-
**Options:**
|
|
874
|
-
- `--claude-code` - Also generate Claude Code plugin files (`.claude-plugin/`)
|
|
875
|
-
- `--name <name>` - Override marketplace name
|
|
876
|
-
- `--description <desc>` - Set marketplace description
|
|
877
|
-
- `--owner <owner>` - Set owner name
|
|
878
|
-
|
|
879
|
-
Used when creating your own marketplace. See [Marketplace System](#marketplace-system) and [Claude Code Plugins](#claude-code-plugins).
|
|
880
|
-
|
|
881
|
-
#### `photon audit [name]`
|
|
882
|
-
Security audit of photon dependencies.
|
|
883
|
-
|
|
884
|
-
```bash
|
|
885
|
-
# Audit all photons
|
|
886
|
-
photon audit
|
|
887
|
-
|
|
888
|
-
# Audit specific photon
|
|
889
|
-
photon audit postgres
|
|
890
|
-
```
|
|
891
|
-
|
|
892
|
-
Checks for:
|
|
893
|
-
- Vulnerable dependencies
|
|
894
|
-
- Outdated packages
|
|
895
|
-
- Security advisories
|
|
283
|
+
<div align="center">
|
|
284
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/photon-ecosystem.png" alt="Photon Ecosystem" width="600">
|
|
285
|
+
</div>
|
|
896
286
|
|
|
897
287
|
---
|
|
898
288
|
|
|
899
|
-
##
|
|
900
|
-
|
|
901
|
-
### For Users: Install from Marketplace
|
|
902
|
-
|
|
903
|
-
```bash
|
|
904
|
-
# Install from official marketplace (portel-dev/photons)
|
|
905
|
-
photon add github-issues
|
|
906
|
-
photon add sqlite
|
|
907
|
-
photon add memory
|
|
908
|
-
|
|
909
|
-
# Search for photons
|
|
910
|
-
photon search slack
|
|
911
|
-
```
|
|
912
|
-
|
|
913
|
-
### For Teams: Create Your Marketplace
|
|
914
|
-
|
|
915
|
-
**Build an internal marketplace for your organization:**
|
|
916
|
-
|
|
917
|
-
```bash
|
|
918
|
-
# 1. Organize your photons
|
|
919
|
-
mkdir company-photons && cd company-photons
|
|
920
|
-
cp ~/.photon/*.photon.ts .
|
|
921
|
-
|
|
922
|
-
# 2. Generate marketplace manifest (and optionally Claude Code plugin)
|
|
923
|
-
photon sync marketplace --claude-code
|
|
924
|
-
|
|
925
|
-
# 3. Push to GitHub/Git
|
|
926
|
-
git init
|
|
927
|
-
git add .
|
|
928
|
-
git commit -m "Initial marketplace"
|
|
929
|
-
git push origin main
|
|
930
|
-
|
|
931
|
-
# 4. Team members install (via CLI or Claude Code)
|
|
932
|
-
photon marketplace add company/photons
|
|
933
|
-
photon add internal-crm
|
|
934
|
-
photon add analytics-db
|
|
935
|
-
```
|
|
936
|
-
|
|
937
|
-
**Benefits:**
|
|
289
|
+
## Beam
|
|
938
290
|
|
|
939
|
-
|
|
940
|
-
- ๐ฆ **Easy**: Single-file photons are trivial to maintain
|
|
941
|
-
- ๐ฏ **Focused**: Build exact tools for your workflows
|
|
942
|
-
- ๐ **Traceable**: Git-based versioning and attribution
|
|
943
|
-
- ๐ **Dual Distribution**: With `--claude-code`, also works as Claude Code plugin
|
|
291
|
+
Beam is the dashboard. Itโs where you go to poke your tools and see if they work before you let an AI loose on them.
|
|
944
292
|
|
|
945
|
-
|
|
293
|
+
Run `photon`. Thatโs it.
|
|
946
294
|
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
# List all marketplaces
|
|
951
|
-
photon marketplace list
|
|
952
|
-
|
|
953
|
-
# Add marketplace (multiple formats supported)
|
|
954
|
-
photon marketplace add username/repo # GitHub shorthand
|
|
955
|
-
photon marketplace add https://github.com/u/repo # HTTPS
|
|
956
|
-
photon marketplace add git@github.com:u/repo.git # SSH
|
|
957
|
-
photon marketplace add https://example.com/mkt # Direct URL
|
|
958
|
-
photon marketplace add ./local-photons # Local path
|
|
959
|
-
|
|
960
|
-
# Remove marketplace
|
|
961
|
-
photon marketplace remove <name>
|
|
962
|
-
|
|
963
|
-
# Search across all marketplaces
|
|
964
|
-
photon search <keyword>
|
|
965
|
-
```
|
|
295
|
+
<div align="center">
|
|
296
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/beam-dashboard.png" alt="Beam Dashboard" width="700">
|
|
297
|
+
</div>
|
|
966
298
|
|
|
967
299
|
---
|
|
968
300
|
|
|
969
|
-
##
|
|
970
|
-
|
|
971
|
-
Photon marketplaces can be automatically published as **Claude Code plugins**, enabling users to install individual photons directly from Claude Code's plugin manager.
|
|
972
|
-
|
|
973
|
-
### Why Dual Distribution?
|
|
301
|
+
## Connecting to AI
|
|
974
302
|
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
**Via Photon CLI:**
|
|
978
|
-
```bash
|
|
979
|
-
photon add filesystem
|
|
980
|
-
photon add git
|
|
981
|
-
```
|
|
303
|
+
If you want to use this with Claude or Cursor, you need the config.
|
|
982
304
|
|
|
983
|
-
**Via Claude Code Plugin:**
|
|
984
305
|
```bash
|
|
985
|
-
|
|
986
|
-
/plugin install filesystem@your-marketplace
|
|
987
|
-
/plugin install git@your-marketplace
|
|
306
|
+
photon info weather --mcp
|
|
988
307
|
```
|
|
989
308
|
|
|
990
|
-
|
|
991
|
-
- ๐ฏ **Granular Installation**: Claude Code users can install only the photons they need
|
|
992
|
-
- ๐ **Auto-Sync**: Plugin stays in sync with your marketplace
|
|
993
|
-
- โก **Zero Config**: Photon CLI auto-installs on first use
|
|
994
|
-
- ๐ก๏ธ **Secure**: Credentials never shared with AI (interactive setup available)
|
|
995
|
-
- ๐ฆ **Same Source**: One marketplace serves both CLI and plugin users
|
|
996
|
-
|
|
997
|
-
### Generate Plugin Files
|
|
998
|
-
|
|
999
|
-
When creating your marketplace, add the `--claude-code` flag:
|
|
1000
|
-
|
|
1001
|
-
```bash
|
|
1002
|
-
# In your marketplace directory
|
|
1003
|
-
photon sync marketplace --claude-code
|
|
1004
|
-
```
|
|
1005
|
-
|
|
1006
|
-
This generates:
|
|
1007
|
-
- `.claude-plugin/marketplace.json` - Plugin manifest with individual photon entries
|
|
1008
|
-
- `.claude-plugin/hooks.json` - SessionStart hook to auto-install Photon CLI
|
|
1009
|
-
- `.claude-plugin/scripts/check-photon.sh` - Auto-installer script
|
|
1010
|
-
- `.claude-plugin/scripts/setup-photon.sh` - Interactive credential setup tool
|
|
1011
|
-
|
|
1012
|
-
### What Gets Generated
|
|
1013
|
-
|
|
1014
|
-
**Individual Plugins:** Each photon becomes a separate installable plugin in Claude Code:
|
|
309
|
+
It spits out some JSON:
|
|
1015
310
|
|
|
1016
311
|
```json
|
|
1017
312
|
{
|
|
1018
|
-
"
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
"
|
|
1022
|
-
"description": "Filesystem - File and directory operations",
|
|
1023
|
-
"mcpServers": {
|
|
1024
|
-
"filesystem": {
|
|
1025
|
-
"command": "photon",
|
|
1026
|
-
"args": ["mcp", "filesystem"]
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
313
|
+
"mcpServers": {
|
|
314
|
+
"weather": {
|
|
315
|
+
"command": "photon",
|
|
316
|
+
"args": ["mcp", "weather"]
|
|
1029
317
|
}
|
|
1030
|
-
// ... one entry per photon
|
|
1031
|
-
]
|
|
1032
|
-
}
|
|
1033
|
-
```
|
|
1034
|
-
|
|
1035
|
-
**Auto-Install Hook:** When users install your plugin, Claude Code automatically:
|
|
1036
|
-
1. Checks if `photon` CLI is installed
|
|
1037
|
-
2. Installs it globally via npm if missing
|
|
1038
|
-
3. Makes all photon tools available immediately
|
|
1039
|
-
|
|
1040
|
-
### Example: Official Photons Marketplace
|
|
1041
|
-
|
|
1042
|
-
The [official photons marketplace](https://github.com/portel-dev/photons) uses this approach:
|
|
1043
|
-
|
|
1044
|
-
```bash
|
|
1045
|
-
# In the photons repo
|
|
1046
|
-
photon sync marketplace --claude-code
|
|
1047
|
-
git commit -m "chore: update marketplace"
|
|
1048
|
-
git push
|
|
1049
|
-
```
|
|
1050
|
-
|
|
1051
|
-
Users can then install via Claude Code:
|
|
1052
|
-
```bash
|
|
1053
|
-
/plugin marketplace add portel-dev/photons
|
|
1054
|
-
/plugin install knowledge-graph@photons-marketplace
|
|
1055
|
-
/plugin install git@photons-marketplace
|
|
1056
|
-
```
|
|
1057
|
-
|
|
1058
|
-
### Automated Git Hooks
|
|
1059
|
-
|
|
1060
|
-
Add this to your `.git/hooks/pre-commit` to auto-sync:
|
|
1061
|
-
|
|
1062
|
-
```bash
|
|
1063
|
-
#!/bin/bash
|
|
1064
|
-
photon sync marketplace --claude-code
|
|
1065
|
-
git add .marketplace/ .claude-plugin/ README.md *.md
|
|
1066
|
-
```
|
|
1067
|
-
|
|
1068
|
-
Now your marketplace AND plugin files stay in sync automatically.
|
|
1069
|
-
|
|
1070
|
-
### Distribution Strategy
|
|
1071
|
-
|
|
1072
|
-
**Recommended approach:**
|
|
1073
|
-
|
|
1074
|
-
1. **Commit both** `.marketplace/` and `.claude-plugin/` to your repo
|
|
1075
|
-
2. **Single command** keeps them in sync
|
|
1076
|
-
3. **Users choose** their preferred installation method
|
|
1077
|
-
4. **Same photons**, whether via CLI or Claude Code
|
|
1078
|
-
|
|
1079
|
-
**Result:** Maximum reach with minimal maintenance.
|
|
1080
|
-
|
|
1081
|
-
---
|
|
1082
|
-
|
|
1083
|
-
## Advanced Features
|
|
1084
|
-
|
|
1085
|
-
### Lifecycle Hooks
|
|
1086
|
-
|
|
1087
|
-
```typescript
|
|
1088
|
-
export default class MyPhoton {
|
|
1089
|
-
async onInitialize() {
|
|
1090
|
-
// Called when photon loads
|
|
1091
|
-
console.error('Photon initialized');
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
async onShutdown() {
|
|
1095
|
-
// Called on shutdown
|
|
1096
|
-
console.error('Photon shutting down');
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
async myTool(params: { input: string }) {
|
|
1100
|
-
return `Processed: ${params.input}`;
|
|
1101
318
|
}
|
|
1102
319
|
}
|
|
1103
320
|
```
|
|
1104
321
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
```typescript
|
|
1108
|
-
import { Template, asTemplate } from '@portel/photon';
|
|
1109
|
-
|
|
1110
|
-
export default class MyPhoton {
|
|
1111
|
-
/**
|
|
1112
|
-
* Generate a code review prompt
|
|
1113
|
-
* @Template
|
|
1114
|
-
* @param language Programming language
|
|
1115
|
-
* @param code Code to review
|
|
1116
|
-
*/
|
|
1117
|
-
async codeReview(params: { language: string; code: string }): Promise<Template> {
|
|
1118
|
-
const prompt = `Review this ${params.language} code:\n\`\`\`\n${params.code}\n\`\`\``;
|
|
1119
|
-
return asTemplate(prompt);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
```
|
|
322
|
+
Copy that. Paste it into your AI clientโs config file. Done.
|
|
1123
323
|
|
|
1124
|
-
|
|
324
|
+
Works with [Claude Desktop](https://claude.ai/download), [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Cursor](https://cursor.com), and any [MCP-compatible client](https://modelcontextprotocol.io).
|
|
1125
325
|
|
|
1126
|
-
|
|
1127
|
-
import { Static, asStatic } from '@portel/photon';
|
|
326
|
+
---
|
|
1128
327
|
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* Get API documentation
|
|
1132
|
-
* @Static api://docs
|
|
1133
|
-
* @mimeType text/markdown
|
|
1134
|
-
*/
|
|
1135
|
-
async apiDocs(params: {}): Promise<Static> {
|
|
1136
|
-
const docs = `# API Documentation\n\n...`;
|
|
1137
|
-
return asStatic(docs);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
```
|
|
328
|
+
## Why did we build this?
|
|
1141
329
|
|
|
1142
|
-
|
|
330
|
+
Writing an MCP server usually involves 4 to 6 files and about 150 lines of code before you even start writing the thing you actually wanted to write.
|
|
1143
331
|
|
|
1144
|
-
|
|
332
|
+
With Photon, itโs one file.
|
|
1145
333
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
334
|
+
| | Traditional MCP | Photon |
|
|
335
|
+
|---|---|---|
|
|
336
|
+
| **Files** | 4-6 (server, transport, schemas, types, config) | 1 |
|
|
337
|
+
| **Boilerplate** | 150+ lines | 0 |
|
|
338
|
+
| **Dependencies** | Manual `npm install` | Automatic |
|
|
339
|
+
| **Schema** | Hand-written JSON Schema | Generated from TS types |
|
|
340
|
+
| **Config** | Manual env var parsing | Automatic from Constructor |
|
|
1152
341
|
|
|
1153
|
-
|
|
1154
|
-
async _helperMethod() {
|
|
1155
|
-
return "Internal logic only";
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
```
|
|
342
|
+
It is unnecessarily difficult to do it the old way. So we stopped doing it.
|
|
1159
343
|
|
|
1160
344
|
---
|
|
1161
345
|
|
|
1162
|
-
##
|
|
346
|
+
## Marketplace
|
|
1163
347
|
|
|
1164
|
-
|
|
348
|
+
We also have a marketplace. 31 photons and counting.
|
|
1165
349
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
```
|
|
1170
|
-
Demonstrates Templates (MCP Prompts) and Static resources.
|
|
350
|
+
<div align="center">
|
|
351
|
+
<img src="https://raw.githubusercontent.com/portel-dev/photon/main/assets/beam-marketplace.png" alt="Marketplace" width="700">
|
|
352
|
+
</div>
|
|
1171
353
|
|
|
1172
|
-
### Calculator
|
|
1173
354
|
```bash
|
|
1174
|
-
|
|
355
|
+
photon search postgres
|
|
356
|
+
photon add postgres
|
|
1175
357
|
```
|
|
1176
|
-
Basic arithmetic operations.
|
|
1177
358
|
|
|
1178
|
-
###
|
|
1179
|
-
```bash
|
|
1180
|
-
npx photon --working-dir examples mcp text --dev
|
|
1181
|
-
```
|
|
1182
|
-
Text manipulation tools.
|
|
359
|
+
### Available Photons
|
|
1183
360
|
|
|
1184
|
-
|
|
1185
|
-
```bash
|
|
1186
|
-
npx photon --working-dir examples mcp workflow --dev
|
|
1187
|
-
```
|
|
1188
|
-
Task management system.
|
|
361
|
+
**Productivity**
|
|
1189
362
|
|
|
1190
|
-
|
|
363
|
+
| Photon | What it does | Tools |
|
|
364
|
+
|--------|-------------|-------|
|
|
365
|
+
| ๐ **kanban** | Multi-tenant task boards for humans and AI | 33 |
|
|
366
|
+
| ๐ฌ **git-box** | Mailbox-style Git interface, manage repos like an inbox | 58 |
|
|
367
|
+
| ๐ฌ **form-inbox** | Webhook-powered form submission collector | 12 |
|
|
368
|
+
| ๐
**google-calendar** | Calendar integration via OAuth | 9 |
|
|
369
|
+
| ๐ซ **jira** | Project management and issue tracking | 10 |
|
|
370
|
+
| ๐ฌ **slack** | Send messages and manage Slack workspaces | 7 |
|
|
371
|
+
| ๐ง **email** | Send and receive via SMTP/IMAP | 8 |
|
|
1191
372
|
|
|
1192
|
-
|
|
373
|
+
**Infrastructure**
|
|
1193
374
|
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
โโโโโโโโโฌโโโโโโโโ
|
|
1203
|
-
โ
|
|
1204
|
-
โ
|
|
1205
|
-
โโโโโโโโโโโโโโโโโ
|
|
1206
|
-
โ Loader โ โ Compiles TypeScript with esbuild
|
|
1207
|
-
โโโโโโโโโฌโโโโโโโโ Loads class dynamically
|
|
1208
|
-
โ
|
|
1209
|
-
โ
|
|
1210
|
-
โโโโโโโโโโโโโโโโโโโโโโโ
|
|
1211
|
-
โ Schema Extractor โ โ Parses JSDoc + TypeScript types
|
|
1212
|
-
โโโโโโโโโโโโฌโโโโโโโโโโโ Generates JSON schemas
|
|
1213
|
-
โ
|
|
1214
|
-
โ
|
|
1215
|
-
โโโโโโโโโโโโโโโโ
|
|
1216
|
-
โ MCP Server โ โ Implements MCP protocol
|
|
1217
|
-
โโโโโโโโฌโโโโโโโโ Using @modelcontextprotocol/sdk
|
|
1218
|
-
โ
|
|
1219
|
-
โ
|
|
1220
|
-
โโโโโโโโโโโโโโ-โโ
|
|
1221
|
-
โ stdio/JSON-RPCโ โ Communicates with MCP clients
|
|
1222
|
-
โโโโโโโโโโโโโโ-โโ (Claude Desktop, Cursor, Zed, etc.)
|
|
1223
|
-
```
|
|
1224
|
-
|
|
1225
|
-
---
|
|
375
|
+
| Photon | What it does | Tools |
|
|
376
|
+
|--------|-------------|-------|
|
|
377
|
+
| ๐ **filesystem** | Safe, cross-platform file operations | 13 |
|
|
378
|
+
| ๐ **git** | Local git repository operations | 11 |
|
|
379
|
+
| ๐ **github-issues** | Manage GitHub issues and comments | 7 |
|
|
380
|
+
| ๐ณ **docker** | Container and image management | 10 |
|
|
381
|
+
| โ๏ธ **aws-s3** | S3 object storage operations | 11 |
|
|
382
|
+
| ๐ **web** | DuckDuckGo search + Readability extraction | 2 |
|
|
1226
383
|
|
|
1227
|
-
|
|
384
|
+
**Databases**
|
|
1228
385
|
|
|
1229
|
-
|
|
386
|
+
| Photon | What it does | Tools |
|
|
387
|
+
|--------|-------------|-------|
|
|
388
|
+
| ๐ **postgres** | PostgreSQL queries and schema ops | 7 |
|
|
389
|
+
| ๐๏ธ **sqlite** | SQLite database operations | 9 |
|
|
390
|
+
| ๐ **mongodb** | MongoDB document CRUD and aggregation | 13 |
|
|
391
|
+
| โก **redis** | Key-value store, lists, sets, pub/sub | 18 |
|
|
1230
392
|
|
|
1231
|
-
|
|
393
|
+
**Utilities and Demos**
|
|
1232
394
|
|
|
1233
|
-
|
|
395
|
+
| Photon | What it does | Tools |
|
|
396
|
+
|--------|-------------|-------|
|
|
397
|
+
| ๐ **time** | Timezone conversion and queries | 3 |
|
|
398
|
+
| ๐งฎ **math** | Expression evaluator (trig, stats, etc.) | 1 |
|
|
399
|
+
| ๐ **code-diagram** | Generate Mermaid diagrams from code | 3 |
|
|
400
|
+
| ๐ด **connect-four** | Play against AI with distributed locks | 8 |
|
|
401
|
+
| ๐ณ **kitchen-sink** | Every runtime feature in one file | 25 |
|
|
402
|
+
| ๐ **dashboard** | MCP Apps UI demo | 6 |
|
|
403
|
+
| ๐บ **team-dashboard** | TV/monitor-optimized team display | 20 |
|
|
404
|
+
| ๐ญ **mcp-orchestrator** | Combine multiple MCPs into workflows | 10 |
|
|
1234
405
|
|
|
1235
|
-
|
|
1236
|
-
- **Precise target** - Clear purpose, clean API
|
|
1237
|
-
- **Universal design** - Pure TypeScript, ready for future possibilities
|
|
406
|
+
You can also make a private marketplace for your team, so internal tools stay off the public internet.
|
|
1238
407
|
|
|
1239
408
|
---
|
|
1240
409
|
|
|
1241
|
-
##
|
|
1242
|
-
|
|
1243
|
-
### Do I need to extend a base class?
|
|
1244
|
-
|
|
1245
|
-
No! Just export any class with async methods. Photon handles the rest.
|
|
1246
|
-
|
|
1247
|
-
### How are parameters validated?
|
|
1248
|
-
|
|
1249
|
-
Photon extracts JSON schemas from your TypeScript types. MCP clients validate parameters before calling your tools.
|
|
1250
|
-
|
|
1251
|
-
### Can I use external packages?
|
|
1252
|
-
|
|
1253
|
-
Yes! Dependencies are **auto-installed** from JSDoc `@dependencies` tags (like `npx` or `uv`).
|
|
1254
|
-
|
|
1255
|
-
### How does hot reload work?
|
|
1256
|
-
|
|
1257
|
-
In `--dev` mode, Photon watches your `.photon.ts` file and recompiles on save.
|
|
1258
|
-
|
|
1259
|
-
### Where are compiled files cached?
|
|
1260
|
-
|
|
1261
|
-
`~/.cache/photon-mcp/compiled/`
|
|
410
|
+
## Commands
|
|
1262
411
|
|
|
1263
|
-
|
|
412
|
+
A few commands you might use:
|
|
1264
413
|
|
|
1265
|
-
|
|
1266
|
-
|
|
414
|
+
```bash
|
|
415
|
+
# Run
|
|
416
|
+
photon # Open Beam UI
|
|
417
|
+
photon mcp <name> # Run as MCP server
|
|
418
|
+
photon mcp <name> --dev # MCP server with hot reload
|
|
419
|
+
photon cli <name> [method] # Run as CLI tool
|
|
1267
420
|
|
|
1268
|
-
|
|
421
|
+
# Create
|
|
422
|
+
photon maker new <name> # Scaffold a new photon
|
|
1269
423
|
|
|
1270
|
-
|
|
424
|
+
# Manage
|
|
425
|
+
photon info # List all photons
|
|
426
|
+
photon info <name> --mcp # Get MCP client config (paste into Claude/Cursor)
|
|
427
|
+
photon validate <name> # Check for errors
|
|
1271
428
|
|
|
1272
|
-
|
|
429
|
+
# Marketplace
|
|
430
|
+
photon add <name> # Install photon
|
|
431
|
+
photon search <query> # Search marketplace
|
|
432
|
+
photon upgrade # Upgrade all
|
|
1273
433
|
|
|
1274
|
-
|
|
1275
|
-
photon
|
|
1276
|
-
photon
|
|
434
|
+
# Ops
|
|
435
|
+
photon doctor # Diagnose environment
|
|
436
|
+
photon audit # Security audit
|
|
437
|
+
photon test # Run tests
|
|
1277
438
|
```
|
|
1278
439
|
|
|
1279
440
|
---
|
|
1280
441
|
|
|
1281
|
-
##
|
|
1282
|
-
|
|
1283
|
-
### โ
MCP Servers & CLI Interface (Available Now)
|
|
1284
|
-
|
|
1285
|
-
**MCP Servers:**
|
|
1286
|
-
Build and run photons as MCP servers for AI assistants. Works with Claude Desktop, Cursor, Zed, Continue, Cline, and any MCP-compatible client.
|
|
1287
|
-
|
|
1288
|
-
**CLI Interface:**
|
|
1289
|
-
Run photon methods directly from the command line with beautiful formatted output. Every photon automatically becomes a CLI tool with zero additional code.
|
|
1290
|
-
|
|
1291
|
-
**Write once, deploy everywhere:** The same business logic powers both your MCP tools and CLI commands.
|
|
1292
|
-
|
|
1293
|
-
### ๐ Ecosystem Integrations
|
|
1294
|
-
|
|
1295
|
-
Photon files are first-class citizens across multiple platforms:
|
|
1296
|
-
|
|
1297
|
-
#### NCP - Intelligent MCP Orchestration
|
|
1298
|
-
|
|
1299
|
-
[NCP](https://github.com/portel-dev/ncp) runs as an MCP client hosting many MCPs intelligently, while acting as an MCP server for any client. Photon files integrate seamlessly as context providers.
|
|
1300
|
-
|
|
1301
|
-
```bash
|
|
1302
|
-
# Photons work natively with NCP
|
|
1303
|
-
ncp add analytics.photon.ts
|
|
1304
|
-
```
|
|
1305
|
-
|
|
1306
|
-
NCP enables sophisticated MCP orchestration patterns, and `.photon.ts` files are designed to work seamlessly in this environment.
|
|
442
|
+
## Tag Reference (Quick Overview)
|
|
1307
443
|
|
|
1308
|
-
|
|
444
|
+
Tags are JSDoc annotations that control how Photon processes your code. Here are the most commonly used ones:
|
|
1309
445
|
|
|
1310
|
-
|
|
446
|
+
| Tag | Where | What it does |
|
|
447
|
+
|-----|-------|-------------|
|
|
448
|
+
| `@dependencies` | Class | Auto-install npm packages on first run |
|
|
449
|
+
| `@cli` | Class | Declare system CLI tool dependencies, checked at load time |
|
|
450
|
+
| `@format` | Method | Control result rendering (table, list, markdown, code, etc.) |
|
|
451
|
+
| `@param ... {@choice a,b,c}` | Param | Dropdown selection in Beam |
|
|
452
|
+
| `@param ... {@format email}` | Param | Input validation and field type |
|
|
453
|
+
| `@param ... {@min N} {@max N}` | Param | Numeric range constraints |
|
|
454
|
+
| `@ui` | Class/Method | Link a custom HTML template |
|
|
455
|
+
| `@webhook` | Method | Expose as HTTP endpoint |
|
|
456
|
+
| `@scheduled` | Method | Run on a cron schedule |
|
|
457
|
+
| `@locked` | Method | Distributed lock across processes |
|
|
458
|
+
| `@autorun` | Method | Auto-execute when selected in Beam |
|
|
459
|
+
| `@mcp` | Class | Inject another MCP server as a dependency |
|
|
460
|
+
| `@icon` | Class/Method | Set emoji icon |
|
|
1311
461
|
|
|
1312
|
-
|
|
1313
|
-
# Same photon, now an HTTP API
|
|
1314
|
-
lumina serve analytics.photon.ts
|
|
1315
|
-
# โ POST /revenue with JSON params
|
|
1316
|
-
# โ GET /status
|
|
1317
|
-
# โ Full REST API from your photon methods
|
|
1318
|
-
```
|
|
462
|
+
> This is a subset. See the full [Tag Reference](./DOCBLOCK-TAGS.md) for all 30+ tags with examples.
|
|
1319
463
|
|
|
1320
|
-
|
|
464
|
+
---
|
|
1321
465
|
|
|
1322
|
-
|
|
466
|
+
## Documentation
|
|
1323
467
|
|
|
1324
|
-
|
|
1325
|
-
- WebSocket servers
|
|
1326
|
-
- Serverless functions (AWS Lambda, Cloudflare Workers)
|
|
1327
|
-
- Native desktop applications
|
|
1328
|
-
- Browser extensions
|
|
1329
|
-
- GraphQL servers
|
|
468
|
+
**Start here:**
|
|
1330
469
|
|
|
1331
|
-
|
|
470
|
+
| Guide | |
|
|
471
|
+
|-------|-|
|
|
472
|
+
| [Getting Started](./GUIDE.md) | Create your first photon, step by step |
|
|
473
|
+
| [Tag Reference](./DOCBLOCK-TAGS.md) | Complete JSDoc tag reference with examples |
|
|
474
|
+
| [Naming Conventions](./NAMING-CONVENTIONS.md) | How to name methods so they read naturally as CLI commands |
|
|
475
|
+
| [Troubleshooting](./TROUBLESHOOTING.md) | Common issues and solutions |
|
|
1332
476
|
|
|
1333
|
-
|
|
477
|
+
**Build more:**
|
|
1334
478
|
|
|
1335
|
-
|
|
479
|
+
| Topic | |
|
|
480
|
+
|-------|-|
|
|
481
|
+
| [Custom UI](./CUSTOM-UI.md) | Build rich interactive interfaces with `window.photon` |
|
|
482
|
+
| [OAuth](./AUTH.md) | Built-in OAuth 2.1 with Google, GitHub, Microsoft |
|
|
483
|
+
| [Daemon Pub/Sub](./DAEMON-PUBSUB.md) | Real-time cross-process messaging |
|
|
484
|
+
| [Webhooks](./WEBHOOKS.md) | HTTP endpoints for external services |
|
|
485
|
+
| [Locks](./LOCKS.md) | Distributed locks for exclusive access |
|
|
486
|
+
| [Advanced Patterns](./ADVANCED.md) | Lifecycle hooks, dependency injection, interactive workflows |
|
|
487
|
+
| [Deployment](./DEPLOYMENT.md) | Docker, Cloudflare Workers, AWS Lambda, Systemd |
|
|
1336
488
|
|
|
1337
|
-
|
|
489
|
+
**Operate:**
|
|
1338
490
|
|
|
1339
|
-
|
|
491
|
+
| Topic | |
|
|
492
|
+
|-------|-|
|
|
493
|
+
| [Security](./SECURITY.md) | Best practices and audit checklist |
|
|
494
|
+
| [Marketplace Publishing](./MARKETPLACE-PUBLISHING.md) | Create and share team marketplaces |
|
|
495
|
+
| [Best Practices](./PHOTON_BEST_PRACTICES.md) | Patterns for production photons |
|
|
496
|
+
| [Comparison](./COMPARISON.md) | Benchmarks vs official MCP implementations |
|
|
1340
497
|
|
|
1341
|
-
|
|
1342
|
-
- **[ADVANCED.md](ADVANCED.md)** - Lifecycle hooks, performance, production deployment
|
|
1343
|
-
- **[COMPARISON.md](COMPARISON.md)** - Detailed comparison vs traditional MCP
|
|
1344
|
-
- **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)** - Common issues and solutions
|
|
1345
|
-
- **[CHANGELOG.md](CHANGELOG.md)** - Version history
|
|
498
|
+
**Reference:** [Architecture](./ARCHITECTURE.md) ยท [Changelog](./CHANGELOG.md) ยท [Contributing](./CONTRIBUTING.md)
|
|
1346
499
|
|
|
1347
500
|
---
|
|
1348
501
|
|
|
1349
502
|
## Contributing
|
|
1350
503
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
---
|
|
504
|
+
If you find a bug, or if my code offends you, feel free to open an issue or a PR. See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
1354
505
|
|
|
1355
|
-
##
|
|
506
|
+
## License
|
|
1356
507
|
|
|
1357
|
-
|
|
1358
|
-
- **@modelcontextprotocol/sdk** - Official MCP TypeScript SDK
|
|
508
|
+
[MIT](./LICENSE). Do what you want with it.
|
|
1359
509
|
|
|
1360
510
|
---
|
|
1361
511
|
|
|
1362
|
-
|
|
512
|
+
<div align="center">
|
|
1363
513
|
|
|
1364
|
-
|
|
514
|
+
*Singular focus. Precise target.*
|
|
1365
515
|
|
|
1366
|
-
|
|
516
|
+
Made by [Portel](https://github.com/portel-dev)
|
|
1367
517
|
|
|
1368
|
-
|
|
518
|
+
</div>
|
|
1369
519
|
|
|
1370
|
-
Made with โ๏ธ by [Portel](https://github.com/portel-dev)
|