Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Commit f21c641

Browse files
committed
docs: add user_config and config commands documentation
1 parent ff12b7c commit f21c641

1 file changed

Lines changed: 55 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ This is a standalone CLI that uses only the public v1 API. It has no dependencie
1616
| `src/commands/packages/search.ts` | Search command implementation |
1717
| `src/commands/packages/show.ts` | Show/info command implementation |
1818
| `src/commands/packages/pull.ts` | Pull/install command implementation |
19-
| `src/commands/packages/run.ts` | Run command implementation (caching, extraction, execution) |
19+
| `src/commands/packages/run.ts` | Run command implementation (caching, extraction, execution, user_config substitution) |
20+
| `src/commands/config.ts` | Config commands (set, get, list, clear) |
2021
| `src/utils/config-manager.ts` | Config file handling (~/.mpak/config.json) |
2122

2223
### Type Generation
@@ -123,6 +124,59 @@ git push && git push --tags
123124
| `pull <package>` | Download a bundle |
124125
| `install <package>` | Alias for pull |
125126
| `run <package>` | Run an MCP server (pulls, caches, executes) |
127+
| `config set <pkg> <k=v...>` | Store config values for a package |
128+
| `config get <pkg>` | Show stored config (values masked) |
129+
| `config list` | List packages with stored config |
130+
| `config clear <pkg> [key]` | Clear stored config |
131+
132+
## User Config (MCPB v0.3)
133+
134+
Packages can declare `user_config` in their manifest for values like API keys:
135+
136+
```json
137+
{
138+
"user_config": {
139+
"api_key": {
140+
"type": "string",
141+
"title": "API Token",
142+
"sensitive": true,
143+
"required": false
144+
}
145+
},
146+
"server": {
147+
"mcp_config": {
148+
"env": {
149+
"API_TOKEN": "${user_config.api_key}"
150+
}
151+
}
152+
}
153+
}
154+
```
155+
156+
When `mpak run` executes, it substitutes `${user_config.*}` placeholders with actual values.
157+
158+
### Value Resolution Priority
159+
160+
1. **Stored config**: `~/.mpak/config.json` (set via `mpak config set`)
161+
2. **Environment variable**: `MPAK_CONFIG_<KEY>` (e.g., `MPAK_CONFIG_API_KEY`)
162+
3. **Default value**: From manifest's `user_config.*.default`
163+
4. **Interactive prompt**: If terminal is interactive and value is required
164+
165+
### Examples
166+
167+
```bash
168+
# Pre-configure a package
169+
mpak config set @nimblebraininc/ipinfo api_key=your_token
170+
171+
# Run uses stored config automatically
172+
mpak run @nimblebraininc/ipinfo
173+
174+
# Or use environment variable
175+
MPAK_CONFIG_API_KEY=your_token mpak run @nimblebraininc/ipinfo
176+
177+
# View stored config (values masked)
178+
mpak config get @nimblebraininc/ipinfo
179+
```
126180

127181
## Design Decisions
128182

0 commit comments

Comments
 (0)