Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ All notable changes to this project will be documented in this file. The format

- [#200](https://github.com/mohanagy/miftah/issues/200) Reworked the README into a task-oriented first-use guide with complete Claude Desktop setup, authentication-path selection, generic MCP onboarding, profile-management tools, native versus upstream-owned OAuth, dashboard lifecycle, everyday diagnostics/audit commands, and focused security-control guidance; corrected stale configuration-version guidance to identify v3 as current while preserving an explicit v1/v2 removal window.

### Fixed

- [#217](https://github.com/mohanagy/miftah/issues/217) Windows STDIO launch now resolves only direct `.exe`/`.com` commands before the MCP SDK, rejects command shims and shell executables, and refuses npx-backed presets on Windows rather than silently falling back to `cmd.exe`.

## [0.4.0] - 2026-07-23

### Added
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Start with the row that describes how your upstream MCP authenticates.

Miftah requires Node.js 20 or newer. Each upstream keeps its own runtime and installation requirements; for example, the GitHub preset requires Docker and the Google Search Console adapter requires Python 3.11 or newer plus `uvx`.

On Windows, `generic`, `sentry`, and `generic-npx` are unavailable. npm's `npx` runner itself requires a command shell on Windows; Miftah refuses them instead of invoking `cmd.exe`. Use a direct `.exe` or `.com` local executable, a direct-executable adapter such as `uvx.exe` or `docker.exe`, or a remote MCP instead.

Shell examples below use POSIX syntax, including `~`, `$HOME`, and `\` line continuations. On Windows, run the same Miftah options from PowerShell with Windows paths and PowerShell line continuation, or put the command on one line.

### Prefer guided setup?
Expand Down Expand Up @@ -192,7 +194,7 @@ miftah init analytics \
--client claude-desktop
```

Replace the example package, version, and variable name with the upstream's documented values. An exact version is required. Run `validate`, `doctor`, `test-profile`, and `list-tools` before adding the printed client JSON.
Replace the example package, version, and variable name with the upstream's documented values. An exact version is required. This package-runner preset is available on macOS and Linux, not Windows: npm's `npx` runner uses a command shell there, and Miftah refuses it rather than invoking `cmd.exe`. On Windows, use a reviewed direct `.exe` or `.com` executable, a direct-executable adapter, or a remote MCP. Run `validate`, `doctor`, `test-profile`, and `list-tools` before adding the printed client JSON.

### Reviewed local executable template

Expand Down
4 changes: 2 additions & 2 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ The Console API is versioned under `/api/v1` and uses exact Host checks, exact l

### `init` presets and paths

`--preset` defaults to `generic`. The strict catalog accepts `generic`, `github`, `sentry`, `google-search-console`, `generic-npx`, `generic-docker`, `local-stdio`, and `streamable-http`; an unrecognized preset is a usage error. `--output` defaults to `<name>.miftah.json`. Miftah resolves the output path from the current working directory, creates missing parent directories, and refuses to overwrite an existing file. Quote shell paths and names containing spaces:
On macOS and Linux, `--preset` defaults to `generic`. On Windows, `--preset` is required for noninteractive `init`; there is no implicit generic preset. The strict catalog accepts `generic`, `github`, `sentry`, `google-search-console`, `generic-npx`, `generic-docker`, `local-stdio`, and `streamable-http`; an unrecognized preset is a usage error. `--output` defaults to `<name>.miftah.json`. Miftah resolves the output path from the current working directory, creates missing parent directories, and refuses to overwrite an existing file. Quote shell paths and names containing spaces:

```sh
miftah init "work wrapper" --preset github --output "$HOME/Miftah configs/work wrapper.json"
miftah validate --config "$HOME/Miftah configs/work wrapper.json"
```

`generic-npx` requires `--npm-package` with exact package SemVer; `generic-docker` requires a canonical digest in `--docker-image`; `streamable-http` requires `--url` plus optional credential environment/header metadata; and one-account noninteractive `google-search-console` requires `--oauth-client-secrets-file` with an absolute path. `local-stdio` requires `--local-command` and `--accept-local-command`; it accepts repeated literal `--arg` values, optional native absolute `--cwd`, and optional `--credential-env`. Use `--arg=--flag` for a value that begins with a dash. On Windows, the local executable must be an absolute `.exe` or `.com` binary; bare commands and `.cmd`/`.bat` shims are rejected so the direct argv path never uses a command processor. It rejects shell executables and wrappers, URL-like commands, environment references, controls, and credential-shaped command or argument values. It writes a read-only profile, treats unknown tools as destructive, and does not launch a generic local executable during `init` or `setup`. Guided GSC setup can collect one or more named accounts, their client-secrets paths, and an explicit default profile. `--credential-env` is optional where supported. The GSC adapter prints credential/browser/identity ownership without printing a configured path. See [preset and client compatibility](presets-and-clients.md) for exact inputs, pins, provenance, and client snippets, and [provider adapters](provider-adapters.md) for the upstream-owned OAuth boundary.
`generic-npx` requires `--npm-package` with exact package SemVer; `generic-docker` requires a canonical digest in `--docker-image`; `streamable-http` requires `--url` plus optional credential environment/header metadata; and one-account noninteractive `google-search-console` requires `--oauth-client-secrets-file` with an absolute path. `local-stdio` requires `--local-command` and `--accept-local-command`; it accepts repeated literal `--arg` values, optional native absolute `--cwd`, and optional `--credential-env`. Use `--arg=--flag` for a value that begins with a dash. On Windows, the local executable must be an absolute `.exe` or `.com` binary; bare commands and `.cmd`/`.bat` shims are rejected so the direct argv path never uses a command processor. On Windows, `generic`, `sentry`, and `generic-npx` are unavailable because npm's `npx` runner requires a command shell. It rejects shell executables and wrappers, URL-like commands, environment references, controls, and credential-shaped command or argument values. It writes a read-only profile, treats unknown tools as destructive, and does not launch a generic local executable during `init` or `setup`. Guided GSC setup can collect one or more named accounts, their client-secrets paths, and an explicit default profile. `--credential-env` is optional where supported. The GSC adapter prints credential/browser/identity ownership without printing a configured path. See [preset and client compatibility](presets-and-clients.md) for exact inputs, pins, provenance, and client snippets, and [provider adapters](provider-adapters.md) for the upstream-owned OAuth boundary.

`--interactive` uses a wizard only when both input and output are TTYs. EOF or Ctrl-C while it is collecting initial configuration data cancels without writing a config. It asks for variable names and safe metadata, never secret values. For `local-stdio`, it asks for one argv element at a time and prints only a bounded count-based review summary before the acknowledgement; it does not echo arguments or credential values. For Google Search Console it asks for each account's profile name, optional description, and client-secrets path, then an explicit default profile. `miftah setup --verify` is an explicit opt-in to run each selected adapter's declared safe read-only check after the configuration write. It never accepts a tool name or arguments from the operator, never guesses a health command, does not auto-approve a policy confirmation, and returns only bounded status rather than provider output. The check runs only while the selected profile still matches the adapter's reviewed launch envelope; otherwise it reports a bounded unsupported status without launching the provider. If the post-write readiness prompt is cancelled, Miftah keeps the configuration, reports incomplete verification, and exits 1. A non-ready `setup --verify` result also keeps the configuration and exits 1. `init` is network-free and does not accept `--verify` or client-entry import flags. In noninteractive use, `init` creates only the config unless `--client` is supplied. `--client` prints JSON with absolute Node and compiled Miftah paths; it does not write a host config. For `claude-code` or `all`, it also prints a separate, exact management-tool `permissions.ask` fragment for manual merge into Claude Code settings; it never writes or overwrites those settings. Regenerate the snippets after moving or upgrading Miftah or changing the config path.

Expand Down
8 changes: 4 additions & 4 deletions docs/presets-and-clients.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Miftah itself requires Node.js `>=20`. That does not establish an upstream serve

| Catalog key | Exact generated command or required input | Upstream requirements and security boundary |
| --- | --- | --- |
| `generic` | `npx --yes @modelcontextprotocol/server-everything@2026.7.4 stdio` | This is the MCP reference/test server, not a production-ready provider recommendation. Its npm metadata declares no upstream Node engine floor. An optional `--credential-env <name>` adds only a `${ENV_NAME}` reference. |
| `generic` | `npx --yes @modelcontextprotocol/server-everything@2026.7.4 stdio` | This is the MCP reference/test server, not a production-ready provider recommendation. Its npm metadata declares no upstream Node engine floor. An optional `--credential-env <name>` adds only a `${ENV_NAME}` reference. Unavailable on Windows because npm's `npx` runner requires a command shell. |
| `github` | Docker STDIO: `docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server:v1.5.0 stdio --read-only --toolsets=repos,issues,pull_requests` | Docker is required. Supply least-privilege GitHub provider tokens through the generated environment references. The catalog intentionally pins a tag, **not** an invented OCI digest. Before a reproducible production deployment, use an authenticated registry process to promote the approved tag, inspect and record its resolved digest in deployment records, then deploy that recorded digest according to the [GitHub digest guidance](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#pull-by-digest). |
| `sentry` | `npx --yes @sentry/mcp-server@0.36.0 --skills=inspect`; generated environment reference: `SENTRY_ACCESS_TOKEN` | The upstream package requires Node.js `>=20`. Use least-privilege Sentry token scopes. `--skills=inspect` filters CLI skills; it is not provider-token authorization and is not a read-only flag or preset. Miftah local policy does not reduce provider token permissions. |
| `sentry` | `npx --yes @sentry/mcp-server@0.36.0 --skills=inspect`; generated environment reference: `SENTRY_ACCESS_TOKEN` | The upstream package requires Node.js `>=20`. Use least-privilege Sentry token scopes. `--skills=inspect` filters CLI skills; it is not provider-token authorization and is not a read-only flag or preset. Miftah local policy does not reduce provider token permissions. Unavailable on Windows because npm's `npx` runner requires a command shell. |
| `google-search-console` | Noninteractive one-account setup requires `--oauth-client-secrets-file <absolute-path>`; guided `miftah setup` supports one or more named accounts. Generated command: `uvx mcp-search-console@0.3.2`; generated environment: `GSC_OAUTH_CLIENT_SECRETS_FILE` and a distinct `GSC_CONFIG_DIR` per generated configuration file and profile. | Python `>=3.11` and `uvx` are required. OAuth, browser handoff, token cache, reauthentication, and revocation remain upstream/manual-owned. Miftah applies a read-only policy, does not set `GSC_ALLOW_DESTRUCTIVE`, and never reads the upstream cache. See the [provider-adapter contract](provider-adapters.md#google-search-console-pilot). |
| `generic-npx` | Required: `--npm-package <exact-package@x.y.z>`; optional `--credential-env <name>` | Only an exact npm package SemVer is accepted. The selected external package, not Miftah, declares its own Node requirement. |
| `generic-npx` | Required: `--npm-package <exact-package@x.y.z>`; optional `--credential-env <name>` | Only an exact npm package SemVer is accepted. The selected external package, not Miftah, declares its own Node requirement. Unavailable on Windows because npm's `npx` runner requires a command shell. |
| `generic-docker` | Required: `--docker-image <canonical-image@sha256:...>`; optional `--credential-env <name>` | Docker is required. Only a canonical image reference with a 64-hex-character `@sha256:` digest is accepted. |
| `local-stdio` | Required: `--local-command <bare-executable-or-native-absolute-path>` and `--accept-local-command`; optional repeated `--arg <value>`, `--cwd <native-absolute-directory>`, and `--credential-env <name>`. Use a bare executable or native absolute path on macOS/Linux, and a direct native absolute `.exe` or `.com` binary on Windows. | Each `--arg` is one literal argv element; use `--arg=--flag` when the value starts with a dash. Miftah never uses a shell, expands no environment references, rejects shell executables/wrappers, URLs, controls, and credential-shaped command or argument values, and never starts this generic local command during setup. Windows rejects bare commands and `.cmd`/`.bat` shims so direct argv execution cannot fall back to a command processor. The generated profile is read-only and unknown tools remain destructive until deliberately configured. Review the executable and its arguments yourself before acknowledging it. |
| `streamable-http` | Required: `--url <https-url>`; optional credential metadata: `--credential-env`, `--header-name`, and `--header-prefix` | The URL must be HTTPS and must not contain userinfo, a query, or a fragment. Credentials may appear only as `${ENV_NAME}` through validated header metadata; allowed prefixes are empty, `Bearer `, and `Sentry `. Never place a credential in a URL or URL component. |
Expand Down Expand Up @@ -51,7 +51,7 @@ Use the following upstream materials when assessing a pin or provider configurat

## First run

`init` and guided `setup` use the strict catalog. The default preset is `generic`; an unknown preset is rejected rather than falling back. (The legacy library-only `presetConfig` fallback does not describe CLI behavior.)
`init` and guided `setup` use the strict catalog. On macOS and Linux the default preset is `generic`; on Windows an explicit supported preset is required. An unknown preset is rejected rather than falling back. On Windows, choose a direct-executable or remote preset explicitly because the `generic`, `sentry`, and `generic-npx` npx-backed presets are refused rather than launched through a command shell. (The legacy library-only `presetConfig` fallback does not describe CLI behavior.)

```sh
miftah init [name] \
Expand Down
2 changes: 2 additions & 0 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Miftah is a credential broker, so safe defaults are part of the product contract

External secret providers execute only fixed programs with argument arrays and bounded stdout/stderr capture. Miftah does not expose provider output in an error, audit record, health entry, or doctor report. On Windows it resolves provider executables without current-directory lookup and uses a static System32 PowerShell launcher that joins a `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE` Job Object before creating the provider. Timeout, cancellation, output-limit, or launcher termination closes that job and terminates ordinary provider descendants as well. This process-tree guarantee does not cover providers that intentionally escape through services, scheduled tasks, elevation brokers, or WMI process creation.

Windows STDIO upstreams are resolved before the MCP SDK starts a child process. Miftah passes the SDK only an absolute direct `.exe` or `.com` path resolved from the configured command and final profile environment; it refuses `.cmd`/`.bat` shims and shell executables such as `cmd.exe`, PowerShell, and `pwsh` rather than relying on the SDK's Windows command-processor fallback. npm's `npx` runner itself uses a Windows command shell, so the `generic`, `sentry`, and `generic-npx` presets are unavailable on Windows. This does not remove direct Windows support for a reviewed local executable, `docker.exe`, `uvx.exe`, or other direct executables discoverable from an absolute PATH entry.

Allowlisted local plugins use the same bounded argument-array child-process path and Windows Job Object containment. Miftah preflights their API manifest before serving, verifies the resolved module remains below the configuration directory, scrubs the child environment, and gives secret providers only one canonical reference and routing matchers only a tool name plus bounded canonical signals. This isolates ordinary plugin failures and withholds Miftah's resolved configuration; it is not an operating-system sandbox for an arbitrary same-user Node module. A plugin can still make its own filesystem, process, or network calls, including actions affecting its parent or host, so every configured module and changes made after preflight must be reviewed and trusted by the operator. See [local plugins](plugins.md).

Profile credential isolation is a separate, opt-in boundary. On macOS and Linux it gives one profile/upstream target a marker-owned, owner-restricted runtime tree and copies only explicitly configured files from below the canonical configuration directory. Miftah never resolves, materializes, injects, or bind-mounts another profile's managed path. It does not make a hostile native STDIO process safe: a process running under the same OS user can still open another profile's absolute path. Stronger native containment needs a separate OS identity or a correctly configured OS sandbox.
Expand Down
Loading
Loading