Scripthold

io.github.zoster81Published by GitHub account zoster81v4.0.1Updated Oct 26, 2026

Secure encoding-aware local workspace runtime for AI agents

VerifiedSTDIODesktop onlyFiles & StorageDeveloper Tools

Overview

AI-generated overview

Local MCP server giving agents controlled, encoding-aware access to explicitly authorized workspace directories for reading, editing, searching and backing up…

What you can do
  • Read, write, edit and grep text files, with multi-file patch packages and one-shot confirmation of prepared changes
  • List directories, build trees, search paths, fingerprint and verify file state
  • Detect and convert text encodings, line endings and BOMs across 168 registered encodings
  • Navigate source code structurally and run structural queries without a compiler or language server
  • Read, create and edit Markdown documents through preview-then-confirm workflows
  • Run durable background tasks, manage persistent backups, and check allowed directories and updates
When to use it
Useful when an agent must work inside specific local project folders and correctness of text encoding, safe previewed edits, backups or source navigation matters. It suits desktop and CLI setups where you want file changes gated by explicit approval rather than free-form writes.
Requirements
Runs as a local process over stdio (or authenticated Streamable HTTP) from a published binary or a Go build; each authorized directory is passed as a startup argument. HTTP mode needs a bearer token via MCP_HTTP_TOKEN_FILE or MCP_HTTP_TOKEN. Optional features need MCP_BACKUP_STORE_DIR, MCP_TASK_STORE_DIR or MCP_DEFERRED_STORE_DIR.
Before you install
It can write, edit and delete files inside authorized roots, and multi-file changes are not transactional rollback. Script and shell execution via task_run is off by default and enabled by MCP_ENABLE_RUN_SCRIPT, MCP_ENABLE_SHELL or MCP_ENABLE_EXECUTION. HTTP mode requires a bearer token and should stay on loopback; non-loopback exposure needs MCP_HTTP_ALLOW_NON_LOOPBACK plus TLS or a trusted proxy. Keep tokens and API keys out of committed files.

Installation

In SourceWeft

  1. Open Scripthold in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

Scripthold — Secure MCP Server for Local Workspaces

[Test Suite] [CodeQL] [OpenSSF Scorecard] [GitHub Release] [Release downloads] [Go] [License: GPL-3.0] [MCP Registry] [AgentHub 已收录:Scripthold] [Glama]

Code from the web. Work locally. Recover safely.

Scripthold is a Model Context Protocol (MCP) server that gives web, desktop, and CLI agents controlled access to explicitly authorized local workspaces. It safely handles legacy text encodings, deterministic file changes, source navigation, backups, and optional durable local execution over stdio or authenticated Streamable HTTP.

AI clients see Настройки — not ???? or Íàñòðîéêè.

Start here: Quick start · Find a tool · All documentation · Security policy.

What Scripthold provides

Scripthold 4.x provides 36 tools and 3 guided prompts; see GitHub Releases for the latest published version. Clients upgrading from 3.x should follow the 4.0 migration guide for the unified confirmation tool. In 4.0.1, the source_symbols outline response defaults to a compact tree; pass presentation: "detailed" to retain the earlier files and symbols fields.

  • 168 registered text encodings with content-based detection, UTF-32 LE/BE support, and conservative ambiguity handling.
  • 100 active Source Intelligence providers for bounded declaration navigation, structural search, selected project relations, and verified context assembly.
  • Secure workspace boundaries with canonical-root containment, Windows reparse/junction handling, deterministic traversal, and missing-path validation.
  • Approval-bound mutations using preview/apply capabilities, exact fingerprints, conflict checks, staged writes, and truthful partial-state reporting.
  • Optional persistent backups with history, compare, audit, restore, explicit garbage collection, pinning, and exact-ID deletion.
  • Durable asynchronous tasks with idempotency, persistent state, bounded logs, recovery, locks, and cancellation.
  • Reliable long-running read-only calls through optional deferred-operation storage and bounded retained-result retrieval.
  • Authenticated Streamable HTTP with loopback defaults, bearer authentication, Host/Origin validation, resource limits, and explicit TLS/proxy requirements for non-loopback exposure.

Scripthold originated from the original mcp-file-tools project, created by Dimitar Grigorov, and retains its GPL-3.0 lineage. See Project Direction.

Quick start

Choose a published binary or build from source, then configure your MCP client to grant access only to the directories you intend to share. HTTP and container deployments have additional setup below.

Use a published release

Download the asset for your platform from the latest release and verify it against checksums.txt. Releases also attach a signed Sigstore build-provenance bundle for the normal GoReleaser assets.

Build from source

bash
git clone https://github.com/zoster81/scripthold.gitcd scriptholdgo test ./...go build -o scripthold ./cmd/scripthold

The module path is github.com/zoster81/scripthold.

Local stdio client

Pass each authorized directory as a startup argument:

json
{  "mcpServers": {    "scripthold": {      "type": "stdio",      "command": "C:\\Tools\\scripthold_windows_amd64.exe",      "args": ["D:\\Projects"]    }  }}

Startup roots are authoritative. A roots-capable stdio client may supply dynamic roots only when the process starts without directory arguments.

Verified self-update

Supported standalone installations can opt in to self-update. Stop other Scripthold processes using the same binary before running scripthold update --adopt. Adoption prepares local state without downloading or replacing the executable.

After adoption, run scripthold update to verify and dispatch an available release. Use scripthold update status to confirm completion; only run scripthold update recover when status offers recovery. These actions have different safety and verification requirements.

See the Verified Self-update Guide for supported installations, exact commands, failure handling, and recovery rules.

Streamable HTTP

HTTP requires exactly one bearer-token source. A minimal loopback PowerShell launch is:

powershell
$tokenPath = Join-Path $env:TEMP "scripthold.token"$bytes = New-Object byte[] 32$rng = [System.Security.Cryptography.RandomNumberGenerator]::Create()try { $rng.GetBytes($bytes) } finally { $rng.Dispose() }[System.IO.File]::WriteAllText($tokenPath, [Convert]::ToBase64String($bytes), [System.Text.UTF8Encoding]::new($false))
$env:MCP_HTTP_TOKEN_FILE = $tokenPath$env:MCP_HTTP_ADDR = "127.0.0.1:8765".\scripthold_windows_amd64.exe --transport=streamable-http D:\Projects

The MCP endpoint is http://127.0.0.1:8765/mcp; /healthz and /readyz expose liveness/readiness. Send the token as Authorization: Bearer <token> on every MCP request.

Do not expose HTTP beyond loopback without reading HTTP Security. Non-loopback use requires explicit opt-in and TLS or a trusted proxy boundary.

OpenAI Secure MCP Tunnel

Sanitized PowerShell examples are available under examples/:

Copy an example outside the checkout before replacing placeholders. Never commit Runtime API keys, Tunnel IDs, bearer tokens, or private state paths.

Container

bash
docker build --build-arg VERSION=dev -t scripthold:dev .
docker run --rm -i \  --read-only \  --cap-drop=ALL \  --security-opt=no-new-privileges \  --tmpfs /tmp:rw,noexec,nosuid,size=64m \  --mount type=bind,source=/absolute/project,target=/data \  scripthold:dev --transport=stdio /data

The image runs as unprivileged UID/GID 10001.

Tool groups

TOOLS.md is the detailed public reference for schemas, parameters, examples, limits, and error behavior. The table below describes the 4.x catalog (36 tools). Clients upgrading from 3.3.6 must migrate the eight former apply commands to confirm_verified_operation.

Source Intelligence

Source Intelligence helps agents navigate source code without running it or requiring an external compiler, parser, or language server. Use source_symbols to map project files with digest presentation: "compact", browse a tree-structured file outline by default (or request presentation: "detailed" for the previous outline JSON structure), and inspect a selected symbol; use source_query for structural search, supported project relationships, dependency graphs, and verified context. Use grep_text_files when looking for arbitrary text or code behavior that is not represented by structural symbols.

Unsupported or ambiguous relationships are rejected rather than guessed. Markdown files have their own document tools. Check the generated Language Capabilities matrix for available source providers and analysis coverage.

Markdown documents

Markdown files use dedicated tools rather than Source Intelligence providers. Read a document with markdown_read, or inspect links and relationships across files with the read-only markdown_workspace tool.

To change a document, prepare a preview with markdown_edit (or markdown_create for a new file), review the proposed content, and pass its previewId to confirm_verified_operation. Unsafe, conflicting, or stale changes are rejected instead of being silently rewritten.

For examples and the exact operation forms, see the Markdown tool reference. For Markdown semantics, supported encodings, and the Marksplice integration boundary, see Markdown Intelligence.

Safety model

  • File access is limited to explicitly authorized roots after canonical path validation.
  • Symlink, junction, reparse-point, alias, and missing-path escapes fail closed.
  • Encoding detection uses bytes and decoded-content evidence, never filenames or extensions.
  • Mutations stage and revalidate before commit; initially missing destinations use no-replace semantics.
  • Preview/apply workflows bind the approved operation to a one-shot capability so mutation parameters cannot be changed at apply time.
  • Multi-file mutations do not claim transactional rollback; failures report committed/unchanged/unknown state where applicable.
  • The optional backup store is a separate protected authority outside public roots.
  • task_run execution is disabled by default. Shell and script execution require explicit authorization; HTTP requires an additional HTTP execution opt-in.
  • HTTP is authenticated and loopback-only by default.

Current architectural boundaries are summarized in Architecture.

Key configuration

Most installations need only a small subset of environment variables:

VariablePurposeDefault
MCP_TRANSPORTstdio or streamable-httpstdio
MCP_DEFAULT_ENCODINGEncoding for new text filesutf-8
MCP_HTTP_ADDRHTTP listen address127.0.0.1:8765
MCP_HTTP_TOKEN_FILE / MCP_HTTP_TOKENMutually exclusive bearer-token sourcesunset
MCP_HTTP_ALLOW_NON_LOOPBACKPermit non-loopback binding when other security requirements are metdisabled
MCP_BACKUP_STORE_DIREnable the persistent backup storeunset
MCP_BACKUP_DEFAULT_POLICYDefault persistent backup policy for eligible approval-bound mutationsdisabled
MCP_TASK_STORE_DIREnable durable task persistenceunset
MCP_DEFERRED_STORE_DIREnable durable ownership for eligible long-running read-only callsunset
MCP_ENABLE_RUN_SCRIPTAllow task_run kind=scriptdisabled
MCP_ENABLE_SHELLAllow task_run kind=shelldisabled
MCP_ENABLE_EXECUTIONAllow both task kindsdisabled
MCP_HTTP_ENABLE_EXECUTIONAdditional HTTP execution gatedisabled

Detailed limits and subsystem-specific options are documented where they are used: TOOLS.md, Durable Tasks, and HTTP Security.

Documentation

Use the Documentation Guide to find instructions by task, whether you are configuring a client, choosing a tool, securing a deployment, or contributing to the project.

Development

The required Go version is declared by go.mod.

bash
go mod verifygo test ./...golangci-lint run ./...go build -o scripthold ./cmd/scripthold

See CONTRIBUTING.md before proposing changes.

License

GPL-3.0 — see LICENSE.

Source: README.md at commit f8029dd

Tools

0
SourceWeft started this package once in an isolated sandbox, without credentials, to list its tools. That failed: the package type cannot run in the sandbox.

Version history

8
  1. v4.0.1LatestOct 26, 2026
  2. v4.0.0Oct 26, 2026
  3. v3.3.6Oct 25, 2026
  4. v3.3.5Oct 25, 2026
  5. v3.3.3Oct 23, 2026
  6. v3.3.0Sep 29, 2026
  7. v3.2.1Sep 16, 2026
  8. v3.2.0Sep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts