Skip to content
phamanh1289Public
forked from yyjeqhc/webcodex

About

Self-hosted runtime for exposing controlled project tools to ChatGPT GPT Actions and MCP clients.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

WebCodex

English | 简体中文

CI npm License

Latest release · 0.3.3 release notes · Documentation

Turn your online AI chat into a personal assistant connected to your own machines.

WebCodex connects ChatGPT, Claude, and other MCP clients to local repositories, workstations, and servers. From the chat window you already use, the assistant can inspect and edit files, run commands and tests, work with Git, and use the toolchains installed on the machine that owns the project.

Work from ChatGPT over MCP Inspect changes and runtime state
MCP session WebCodex console

Quick start

Supported package platforms are Linux x64, Linux arm64, macOS arm64, and Windows x64. The npm installer requires Node.js 18 or newer.

npm install -g @yyjeqhc/webcodex
cd /path/to/your/repository
webcodex connect https://sg4.yyjeqhc.cn

connect uses the current directory as the project, creates a local profile, starts a detached Runner, and prints the MCP URL and generated key. Add those values to ChatGPT or Claude, then ask for a real task, for example:

Find the first failing test, fix the cause, and run the relevant test suite again.

The generated key is printed in full only when it is first created. Keep it and the generated agent.toml out of Git. Closing the terminal does not stop the Runner; after a machine reboot, rerun the same connect command or use the profile shown by the first run:

webcodex agent start --profile <profile>

Temporary local sharing

If you do not have a hosted Server and only need temporary access to the current computer, use webcodex share. The default path uses a Cloudflare Quick Tunnel, which does not require a Cloudflare account.

Install cloudflared first if needed. These commands follow Cloudflare's official installation instructions:

# macOS
brew install cloudflared

# Debian / Ubuntu: one copy-paste command using Cloudflare's official APT repository
sudo mkdir -p --mode=0755 /usr/share/keyrings && curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null && echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main" | sudo tee /etc/apt/sources.list.d/cloudflared.list >/dev/null && sudo apt-get update && sudo apt-get install -y cloudflared

Then share the current project:

cd /path/to/your/repository
webcodex share

share performs the idempotent project setup when needed, starts the local Server and Agent, creates a separate temporary Project Connector credential, and exposes /mcp through the Quick Tunnel. WebCodex does not silently install system packages. The printed HTTPS URL and Bearer credential are valid only for that share session; Ctrl-C stops the runtime and tunnel and removes the temporary credential.

In ChatGPT Developer Mode, create a custom app with the printed /mcp URL. If your workspace offers Access token/API key authentication, choose it, paste the temporary Bearer credential, and run Scan Tools. ChatGPT UI labels and availability can vary by workspace and rollout. Treat this credential as live coding access: anyone who has it can modify this project and run commands allowed by the share runtime while the session is active. Keep it private and stop sharing when finished.

Use webcodex share --tunnel none for local-only debugging. Quick Tunnels are for development and testing, not stable production deployment. If Quick Tunnel startup fails and ~/.cloudflared/config.yaml already exists, Cloudflare does not currently support Quick Tunnels with that default config present; use a separate Quick Tunnel environment or temporarily move the file out of the way.

See AI Onboarding for managed accounts, custom servers, and other connection paths.

What WebCodex can do

  • Read, search, create, and edit files inside registered projects.
  • Run builds, tests, package scripts, and bounded shell commands.
  • Inspect Git status and diffs, and help prepare focused commits.
  • Keep long-running jobs and coding context available across chat turns.
  • Connect multiple projects or machines to the same online assistant.
  • Serve both MCP clients and OpenAPI-based GPT Actions.

The exact tools available depend on the Server surface, Runner capabilities, and permissions you configure. WebCodex supports direct project operations as well as optional task and review workflows; it is not limited to a single approval model.

How it works

ChatGPT / Claude / another MCP client
                 │ HTTPS: MCP or GPT Actions
                 ▼
          WebCodex Server
                 │ authenticated Runner transport
                 ▼
     Runner on your workstation or server
                 │
                 └── files · Git · commands · tests · local toolchains

The Server coordinates clients, credentials, and tool requests. The Runner does the actual work on the machine that owns the repository. Repositories and local toolchains stay on that Runner host; only the requested tool inputs and results travel through the connection.

Choose a setup

Goal Recommended path
Connect one project through the hosted service Use webcodex connect <server>. Only the Runner runs locally.
Temporarily expose the current local project to ChatGPT/MCP Use webcodex share; it starts local Server + Agent and a temporary Quick Tunnel.
Keep everything local without public access Use webcodex setup + webcodex run (or webcodex share --tunnel none for share debugging).
Run a stable long-lived deployment Self-host the Server with a stable HTTPS domain/tunnel, service management, and OAuth as needed.
Use managed users, device enrollment, revocation, and audit Use webcodex login and the managed deployment flow.

Self-host the Server with Docker

The repository includes a server-only Dockerfile and Compose deployment. It runs webcodex-server plus the administrative webcodex CLI; it intentionally does not contain the Runner, project repositories, or language toolchains.

git clone https://github.com/yyjeqhc/webcodex.git
cd webcodex
./deploy/docker/bootstrap.sh https://webcodex.example.com
docker compose ps

The default port binding is 127.0.0.1:8080. Put an HTTPS reverse proxy in front of it, then create a short-lived pairing code and enroll the machines that hold your repositories.

The current Compose file builds the image from the checked-out source. A registry image can be published separately without changing the server-only architecture. See Docker deployment for the full setup and Deployment for systemd, OAuth, and production operations.

Run the Runner as a user service

On a managed or self-hosted Server, run webcodex login as the ordinary user who owns the repositories. The login output reports the generated Agent config. Install it as a user service without sudo:

webcodex agent install --scope user \
  --config /path/reported/by/login/agent.toml
webcodex agent status --scope user \
  --config /path/reported/by/login/agent.toml

See Build and Install for system services and advanced overrides.

Client access

  • ChatGPT over MCP: create a Developer Mode custom app that points to the Server /mcp endpoint. For webcodex share, choose Access token/API key when that option is available and paste the temporary Bearer credential. Managed and self-hosted HTTPS Servers can use OAuth; the setup below shows that long-lived ChatGPT flow.
  • Other MCP clients: use the Server /mcp endpoint with the credential produced by the selected setup flow. See MCP.
  • GPT Actions: OpenAPI-based GPT Actions remain available as an alternative integration path. See GPT Actions.
  • Browser console: open /console for connection details, runtime status, and available review or operations controls.

ChatGPT OAuth (Developer Mode)

For a managed or self-hosted WebCodex Server with public HTTPS and OAuth enabled:

  1. In ChatGPT, open Settings → Apps → Create, set the Server URL to https://your-domain.example/mcp, choose OAuth, and select the user-defined/custom OAuth client option. Copy the callback URL shown by ChatGPT; it is specific to that app configuration.

  2. Register that exact callback URL as a WebCodex OAuth client. Keep the returned client_secret: it is shown only once.

    curl -fsS -X POST https://your-domain.example/api/oauth/clients/create \
      -H "Authorization: Bearer $WEBCODEX_PAT" \
      -H "Content-Type: application/json" \
      -d '{
        "name":"ChatGPT MCP",
        "redirect_uris":["https://chatgpt.com/connector/oauth/<callback-id>"],
        "allowed_scopes":["runtime:read","project:read","project:write","job:run"]
      }'
  3. Enter the returned client ID and secret in ChatGPT and choose client_secret_post for token-endpoint authentication. Select only the WebCodex permissions the app needs. For the ordinary coding setup that is runtime:read, project:read, project:write, and job:run. Keep account:manage disabled unless the app really needs account administration. Leave offline_access enabled when ChatGPT offers it: WebCodex advertises it as a protocol-level refresh-token scope, and it does not grant an extra WebCodex permission or belong in the client's allowed_scopes list.

  4. Run Scan Tools. On the WebCodex authorization page, sign in with a normal WebCodex PAT, review the requested scopes, choose Allow, and wait for the tool scan to finish.

ChatGPT OAuth client setup

After Scan Tools succeeds, ChatGPT should show the discovered WebCodex operations on the app page.

ChatGPT UI labels can change. If OAuth discovery metadata changes, recreate the ChatGPT app so it fetches the new metadata. See MCP, Deployment, and the OAuth2 smoke test for the server-side details.

Security boundary

WebCodex can modify files and execute commands, so treat a connected client as a development assistant with real access to the configured machines.

  • Register only project roots the assistant should use.
  • Keep shared keys, user tokens, Agent tokens, and generated config files out of prompts, logs, and Git.
  • Use version control and recoverable backups before enabling write or command capabilities.
  • Prefer an ordinary OS user for the Runner; root execution requires explicit configuration.

Read SECURITY.md for the complete model.

Documentation

Build from source

cargo build --release --workspace --bins
export PATH="$PWD/target/release:$PATH"

Disclaimer

WebCodex is provided for research and learning. It can read and modify files and execute commands within configured project boundaries. Use it only on systems and repositories you are prepared to recover. The author is not responsible for filesystem damage, data loss, or other consequences arising from use of the software.

Acknowledgements

Thanks to the LINUX DO community for its welcoming space for technical discussion and support for open-source sharing.

License

Licensed under the Apache License, Version 2.0. See LICENSE.

About

Self-hosted runtime for exposing controlled project tools to ChatGPT GPT Actions and MCP clients.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages