by portel-dev
Define intent once. Photon turns a single TypeScript file into CLI tools, MCP servers, and web interfaces.
# Add to your Claude Code skills
git clone https://github.com/portel-dev/photonGuides for using mcp servers skills like photon.
photon is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by portel-dev. Define intent once. Photon turns a single TypeScript file into CLI tools, MCP servers, and web interfaces. It has 101 GitHub stars.
photon's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/portel-dev/photon" and add it to your Claude Code skills directory (see the Installation section above).
photon is primarily written in TypeScript. It is open-source under portel-dev on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh photon against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
Photon is the fastest way to turn a small, verified TypeScript method into something humans can operate and agents can trust. Write the capability once; Photon derives the interfaces, contracts, and runtime behavior around it:
Photon is free and open source software released under the MIT license. Full documentation lives at photon.portel.dev.
Related Portel project: NCP gives agents one natural MCP interface to discover and run tools across a whole tool ecosystem. Photon builds reliable agent-facing capabilities; NCP helps agents find and use them alongside every other MCP.
Try it in two minutes:
bun add -g @portel/photon
photon new my-tool
photon
That opens Beam, the generated human UI. Add photon mcp install my-tool when
you want the same capability inside Claude Desktop or another MCP client.
Interfaces are optional. Intent is mandatory.
gh repo star portel-dev/photon
The weather example is intentionally small: one TypeScript method, a few
docblock tags, and one @ui HTML asset. Photon turns that into a CLI command,
Beam UI, MCP tool, and embedded app surface for MCP app-capable chat clients.
Claude Desktop can run it from a local stdio MCP command; ChatGPT developer
mode can connect to the same Photon over a public HTTPS /mcp endpoint.
Real clients, same Photon:
Follow the step-by-step tutorial
or open the runnable example in
examples/weather-showcase.
The tutorial also includes Beam, CLI, and a concept animation for the full
transformation.
Photon is the modern dev stack for the agentic age: each photon is a small, auditable brick that can be used by humans, agents, schedulers, webhooks, and apps without rewriting the same capability for every interface.
That is the core idea: tiny trusted capabilities compose into larger systems. A photon can start as a helper method, become a CLI command, render as an app, run on a schedule, accept webhooks, and still expose a clean agent-readable contract.
// hello.photon.ts
export default class Hello {
greet(name: string) {
return `Hello, ${name}!`;
}
}
That's a complete photon. From this single file you get:
$ photon cli hello greet --name Ada # CLI
$ photon # Web UI at localhost:3008
$ photon mcp hello # MCP server for Claude, Cursor, etc.
No decorators. No registration. No server boilerplate. Just define the intent. Photon handles the rest.
From zero to an MCP server connected to Claude Desktop in three commands:
bun add -g @portel/photon
photon new my-tool # Scaffolds ./my-tool.photon.ts in your CWD
photon mcp install my-tool # Registers it in Claude Desktop's config
# Restart Claude Desktop. Your tool is live.
Prefer the web dashboard? Skip step 3 and run photon instead — it opens Beam, the auto-generated UI.
Or try without installing globally:
bunx @portel/photon new my-tool
bunx @portel/photon mcp install my-tool
# pnpm users can use pnpm dlx instead:
pnpm dlx @portel/photon new my-tool
pnpm dlx @portel/photon mcp install my-tool
Requires Node.js 20+. TypeScript is compiled internally; no
tsconfig.jsonneeded.Where do photon files live?
./(a project directory you cd into) or~/.photon/(global, auto-discovered). User settings persist under~/.photon/state/<photon>/. See Where things live.
You write a TypeScript class. Methods are your capabilities. Types describe what's valid. Comments explain the intent. Photon reads all of it and generates three interfaces from one file. Same logic. Same validation. Same data.
analytics.photon.ts → Beam · Web app · Webhook · WebSocket · CLI · MCP
The more you express, the more Photon derives:
| What you write | What Photon derives |
|---|---|
| Method signatures | Tool definitions: names, inputs, outputs |
| Type annotations | Input validation rules, UI field types |
| JSDoc comments | Documentation for AI clients and human users |
| Constructor parameters | Config UI, environment variable mapping, runtime injection (Photon, Cloudflare, CloudflareEnv) |
@tags |
Validation, formatting, scheduling, webhooks, and HTTP routes |
When you add a @param city {@pattern ^[a-zA-Z\s]+$} annotation, Beam validates it in the form, the CLI validates it before running, and the MCP schema enforces it for the AI. One annotation. Three consumers.
extends Photon is one shape. You can also inject Photon as a constructor parameter when you already extend something else, or compose without inheritance — same API either way. CF resources reach the photon through a separate Cloudflare injection so portable photons stay portable. See docs/guides/PHOTON-INJECTION.md.
Existing Photons can also be application dependencies. Load their source through the public API and call methods from your own Node code:
import { createPhotonRuntime } from '@portel/photon';
const runtime = createPhotonRuntime();
try {
const todo = await runtime.photon<{
add(text: string): Promise<unknown>;
}>('./todo.photon.ts', { baseDir: '/srv/my-app/photons' });
await todo.add('Review the release');
} finally {
await runtime.close();
}
This manages initialization and shutdown without starting a server. It executes trusted code in your application process; the host owns authorization. The object is separate from a live Beam/daemon instance. Use MCP when your application needs to operate on that same live instance. For source resolution, persistence, and constructor-dependency lifecycle limits, see Photon as a library.
Run the shared task-board walkthrough to see a human and an MCP client operate the same state.
Beam is the web dashboard. Every photon becomes an interactive form automatically. Run photon. That's the whole command.
The UI is fully auto-generated from your method signatures: field types, validation, defaults, layouts. You never write frontend code. When you add a {@choice a,b,c} tag to a parameter, Beam renders a dropdown. When you mark a string as {@format email}, the field validates email format. The UI evolves as your code does.
When forms aren't the right interface for what you're building, you can replace Beam's auto-generated view with your own HTML. A global named after your photon i