Expose env-alias tier (substituteEnvVars / gatherUserConfig) publicly
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api
Research direction
Start in packages/sdk-typescript/src/mpakSDK.ts and read the private static substituteEnvVars and gatherUserConfig methods, then check how prepareServer calls them. Decide which of the two proposed public API shapes best fits the existing SDK before changing the API. Done means hosts can use the env alias tier without prepareServer; verify the exported API and its behavior with the relevant SDK tests.
Written by the indexing model from the issue text.
Description
Context
Mpak.substituteEnvVars and Mpak.gatherUserConfig are private static in the mpak SDK (see packages/sdk-typescript/src/mpakSDK.ts ≈ lines 1036, 1160 in 0.5.0). prepareServer uses them to resolve ${user_config.*} placeholders against declared mcp_config.env aliases (the env-alias tier) and substitute into the spawn env.
Host runtimes that need substitution without going through prepareServer — e.g. because they load an unpacked bundle directory instead of a .mcpb archive — currently have to reimplement the tier themselves.
Prior art in NimbleBrain
NimbleBrainInc/nimblebrain#44 adds substituteUserConfigFromEnv() in src/bundles/startup.ts for the local-path branch of startBundleSource. It's a ~50-line inline replica of the SDK's env-alias tier + placeholder substitution. The helper's existence is explicitly documented as a duplication that should be deleted once the SDK exposes the tier publicly.
Proposal
One of:
- Expose
substituteEnvVarsas a public static onMpak— takes(env: Record<string, string>, userConfigValues: Record<string, string>) => Record<string, string>. Hosts still computeuserConfigValuesthemselves if they need different tiering. - Expose a higher-level helper —
Mpak.resolveEnv(manifest, userConfig, processEnv)that wraps the env-alias tier + substitution for hosts that want the full SDK resolution without the filesystem-cache/archive plumbing ofprepareServer.
(1) is the smaller API surface; (2) is more useful but couples the shape to host use cases.
Impact
- Unblocks deleting
substituteUserConfigFromEnvfrom nimblebrain after the SDK bump - Other mpak host runtimes get the same benefit
- No breaking change; additive public API
Related
- NimbleBrainInc/nimblebrain#44 — contains the duplicated helper pending this API
- Dominant language
- TypeScript
- Stars
- 14
- Forks
- 13
- Avg merge
- 16m
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NimbleBrainInc/mpak
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
NimbleBrainInc/mpak#180 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NimbleBrainInc/mpak#175 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
NimbleBrainInc/mpak#159 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
NimbleBrainInc/mpak#120 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NimbleBrainInc/mpak#112 ·
All issues in NimbleBrainInc/mpak
Similar issues
-
bug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Potential Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Comfy-Org/ComfyUI_frontend#23773 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
lingdojo/kana-dojo#34301 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/gh-aw-firewall#11797 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
code-yeongyu/senpi#7007 ·
Maintainers usually reply within 1 day