mcp-template 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_template-0.1.0/PKG-INFO +285 -0
- mcp_template-0.1.0/README.md +263 -0
- mcp_template-0.1.0/pyproject.toml +55 -0
- mcp_template-0.1.0/setup.cfg +4 -0
- mcp_template-0.1.0/src/mcp_template.egg-info/PKG-INFO +285 -0
- mcp_template-0.1.0/src/mcp_template.egg-info/SOURCES.txt +20 -0
- mcp_template-0.1.0/src/mcp_template.egg-info/dependency_links.txt +1 -0
- mcp_template-0.1.0/src/mcp_template.egg-info/entry_points.txt +2 -0
- mcp_template-0.1.0/src/mcp_template.egg-info/top_level.txt +1 -0
- mcp_template-0.1.0/src/mcp_template_cli/__init__.py +3 -0
- mcp_template-0.1.0/src/mcp_template_cli/__main__.py +5 -0
- mcp_template-0.1.0/src/mcp_template_cli/cli.py +405 -0
- mcp_template-0.1.0/src/mcp_template_cli/data/examples/claude_code_mcp.sample.json +16 -0
- mcp_template-0.1.0/src/mcp_template_cli/data/examples/claude_desktop_config.sample.json +17 -0
- mcp_template-0.1.0/src/mcp_template_cli/data/python-cli-template/.dockerignore +5 -0
- mcp_template-0.1.0/src/mcp_template_cli/data/python-cli-template/Dockerfile +23 -0
- mcp_template-0.1.0/src/mcp_template_cli/data/python-cli-template/bin/project-cli +14 -0
- mcp_template-0.1.0/src/mcp_template_cli/data/python-cli-template/doctor.py +254 -0
- mcp_template-0.1.0/src/mcp_template_cli/data/python-cli-template/server.py +206 -0
- mcp_template-0.1.0/tests/test_doctor.py +161 -0
- mcp_template-0.1.0/tests/test_init_python_cli_template.py +363 -0
- mcp_template-0.1.0/tests/test_server_template.py +134 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-template
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Starter CLI for generating MCP wrappers around existing command-line tools.
|
|
5
|
+
Author: kraftaa
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kraftaa/mcp-templates
|
|
8
|
+
Project-URL: Repository, https://github.com/kraftaa/mcp-templates
|
|
9
|
+
Project-URL: Issues, https://github.com/kraftaa/mcp-templates/issues
|
|
10
|
+
Keywords: mcp,templates,cli,ai,tooling
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# MCP Templates
|
|
24
|
+
|
|
25
|
+
Production-style starter templates for turning existing CLIs into MCP servers quickly, safely, and with minimal deployment friction.
|
|
26
|
+
|
|
27
|
+
If you already have a useful command-line tool, script, or internal binary, this repo helps you expose it to MCP clients without rewriting the tool from scratch.
|
|
28
|
+
|
|
29
|
+
The path is intentionally simple:
|
|
30
|
+
|
|
31
|
+
`existing CLI -> generated MCP wrapper -> validation -> client config -> working tool`
|
|
32
|
+
|
|
33
|
+
## Who This Is For
|
|
34
|
+
|
|
35
|
+
This repo is built for:
|
|
36
|
+
|
|
37
|
+
- platform teams exposing internal tools to MCP clients
|
|
38
|
+
- developers with a working CLI who want MCP support fast
|
|
39
|
+
- AI enablement teams that need safe, debuggable tool wrappers
|
|
40
|
+
- consultants or builders packaging an existing workflow for Claude Desktop, Claude Code, or similar clients
|
|
41
|
+
|
|
42
|
+
If MCP is new to you, start with [`docs/MCP_PRIMER.md`](/Users/maria/Documents/GitHub/extra/mcp-templates/docs/MCP_PRIMER.md).
|
|
43
|
+
|
|
44
|
+
## Positioning
|
|
45
|
+
|
|
46
|
+
Most MCP examples prove that a server can run. This repo is aimed at the harder problem: getting a real internal tool wrapped, validated, and ready to ship without rebuilding it from scratch.
|
|
47
|
+
|
|
48
|
+
The core bet is simple:
|
|
49
|
+
|
|
50
|
+
- reuse the CLI you already have
|
|
51
|
+
- add safety guardrails by default
|
|
52
|
+
- keep the server transport/client agnostic
|
|
53
|
+
- make local setup and deployment boring
|
|
54
|
+
|
|
55
|
+
## Why This Is Different
|
|
56
|
+
|
|
57
|
+
- Safer than toy examples: templates start with path allowlists, timeout handling, arg validation, and structured JSON output.
|
|
58
|
+
- Faster than framework-heavy rewrites: wrap an existing binary instead of reimplementing business logic in a new server stack.
|
|
59
|
+
- More portable than client-specific setups: the same server can be registered in Claude Desktop, Claude Code, and other MCP clients.
|
|
60
|
+
- Closer to production: examples are designed around real subprocess execution, explicit env configuration, and predictable failure modes.
|
|
61
|
+
|
|
62
|
+
## Why This Beats Existing Options
|
|
63
|
+
|
|
64
|
+
For the right audience, this is better than most existing MCP starter options because it optimizes for migration, not greenfield demos.
|
|
65
|
+
|
|
66
|
+
- Most examples show how to build an MCP server from scratch. This helps you keep the CLI you already trust.
|
|
67
|
+
- Many wrappers stop at "it runs." This repo includes validation, generated configs, CI smoke tests, and packaging paths.
|
|
68
|
+
- Client-specific examples often trap you in one setup. This stays transport- and client-agnostic.
|
|
69
|
+
- Framework-heavy approaches can force a rewrite too early. This keeps the MCP layer thin until the workflow proves valuable.
|
|
70
|
+
|
|
71
|
+
If someone already has a working CLI, the comparison should not be "template versus template." It should be:
|
|
72
|
+
|
|
73
|
+
`rewrite the tool` vs `wrap the tool safely and ship sooner`
|
|
74
|
+
|
|
75
|
+
## What You Get In Practice
|
|
76
|
+
|
|
77
|
+
With the current Python template, you can:
|
|
78
|
+
|
|
79
|
+
- generate a project-specific MCP wrapper with renamed placeholders
|
|
80
|
+
- point it at a real binary instead of a toy example
|
|
81
|
+
- get project-specific sample client config files during bootstrap, already pointed at the generated `server.py`
|
|
82
|
+
- get a starter `.gitignore` in the copied wrapper
|
|
83
|
+
- get a starter `Makefile` with common wrapper commands
|
|
84
|
+
- get a starter `requirements.txt` in the copied wrapper
|
|
85
|
+
- get placeholder sample input/output files for first local tests
|
|
86
|
+
- get a generated `.env.example` with the renamed runtime variables, and auto-load `.env` if present
|
|
87
|
+
- get a generated `USAGE.md` with first-run steps for the copied wrapper
|
|
88
|
+
- validate setup with `doctor.py` before opening a client
|
|
89
|
+
- validate setup with `doctor.py` before opening a client, including machine-readable `--json` output for CI or setup tooling
|
|
90
|
+
- use a real `mcp-template` command from the repo root instead of calling an internal script path
|
|
91
|
+
- package it with Docker
|
|
92
|
+
- verify the template itself in CI with bootstrap, syntax, and smoke checks
|
|
93
|
+
|
|
94
|
+
## 30-Second Quickstart
|
|
95
|
+
|
|
96
|
+
If you already have a CLI, the basic flow is:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
./mcp-template generate /path/to/your-project/mcp \
|
|
100
|
+
--server-name your-project \
|
|
101
|
+
--tool-name run_profile \
|
|
102
|
+
--binary-name your-cli
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If you want a different env namespace than the server slug, add:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
--env-prefix YOUR_TEAM_TOOL
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If you want to preview the generated output first, add:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
--dry-run
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
If you already know the real executable path, add:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
--bin-path /abs/path/to/your-cli
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
If you want the generated client config to use a specific Python interpreter, add:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
--python-path /abs/path/to/python
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
If you want to prefill allowed directories too, add:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
--read-dirs /abs/path/to/data,/abs/path/to/profiles \
|
|
133
|
+
--write-dirs /abs/path/to/artifacts
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Then:
|
|
137
|
+
|
|
138
|
+
1. replace the placeholder command mapping in `server.py`
|
|
139
|
+
2. replace the stub binary in `bin/`
|
|
140
|
+
3. fill in `.env.example`
|
|
141
|
+
4. read `USAGE.md`
|
|
142
|
+
5. adapt one of the generated sample configs in `examples/`
|
|
143
|
+
6. run `doctor.py`
|
|
144
|
+
7. call `version` and `paths`
|
|
145
|
+
8. validate with `healthcheck`
|
|
146
|
+
|
|
147
|
+
## Install Options
|
|
148
|
+
|
|
149
|
+
Use one of these depending on how you want to adopt the tool:
|
|
150
|
+
|
|
151
|
+
- From a clone right now: `./mcp-template generate ...`
|
|
152
|
+
- Local pip install from a clone: `python -m pip install .`
|
|
153
|
+
- Local isolated install from a clone: `pipx install .`
|
|
154
|
+
|
|
155
|
+
After the package is published, the intended install command is:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
pipx install mcp-template
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Then the command stays the same everywhere:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
mcp-template generate /path/to/your-project/mcp --server-name your-project
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## How It Fits Together
|
|
168
|
+
|
|
169
|
+
```mermaid
|
|
170
|
+
flowchart LR
|
|
171
|
+
A["Existing CLI or binary"] --> B["Generated MCP wrapper"]
|
|
172
|
+
B --> C["doctor.py validation"]
|
|
173
|
+
B --> D["Claude Desktop / Claude Code / other MCP client"]
|
|
174
|
+
D --> B
|
|
175
|
+
B --> E["Allowed read/write dirs"]
|
|
176
|
+
B --> F["Structured JSON results"]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Included
|
|
180
|
+
|
|
181
|
+
- `python-cli-template/`: production-style Python MCP wrapper for any CLI tool
|
|
182
|
+
- `python-cli-template/bin/project-cli`: stub binary used only for template smoke testing
|
|
183
|
+
- `python-cli-template/doctor.py`: preflight checker for Python, env vars, paths, and client config JSON
|
|
184
|
+
- `python-cli-template/Dockerfile`: minimal container target for packaging the Python template
|
|
185
|
+
- `mcp-template`: repo-local launcher for the public CLI
|
|
186
|
+
- `src/mcp_template_cli/`: installable `mcp-template` CLI package
|
|
187
|
+
- `scripts/init_python_cli_template.py`: compatibility shim for the public CLI
|
|
188
|
+
- `.github/workflows/python-template-smoke.yml`: CI smoke test for syntax, preflight validation, and container build
|
|
189
|
+
- `examples/claude_desktop_config.sample.json`: local Claude Desktop config example
|
|
190
|
+
- `examples/claude_code_mcp.sample.json`: generic Claude Code-style config example
|
|
191
|
+
- `docs/QUICKSTART.md`: 10-minute setup flow
|
|
192
|
+
- `docs/MCP_PRIMER.md`: short explanation of what MCP is and why this repo exists
|
|
193
|
+
- `docs/EXAMPLE_ADAPTER.md`: concrete walkthrough for wrapping a real CLI command
|
|
194
|
+
- `docs/LAUNCH_CHECKLIST.md`: rollout checklist for validating a wrapper before production use
|
|
195
|
+
|
|
196
|
+
## How To Use
|
|
197
|
+
|
|
198
|
+
1. Run the repo-local generator with `./mcp-template generate`.
|
|
199
|
+
2. Generate a project-specific copy.
|
|
200
|
+
3. Replace the stub binary and adjust the command mapping.
|
|
201
|
+
4. Adapt one of the generated sample configs in `examples/` for your client.
|
|
202
|
+
5. Set env vars (`*_BIN`, allowed read/write dirs).
|
|
203
|
+
6. Run `doctor.py` to catch binary, Python, path, and config issues early.
|
|
204
|
+
7. Register server in your MCP client config.
|
|
205
|
+
8. Test with `version`, `paths`, and `healthcheck` first.
|
|
206
|
+
|
|
207
|
+
## Best Fit
|
|
208
|
+
|
|
209
|
+
This repo is a strong fit when you already have:
|
|
210
|
+
|
|
211
|
+
- a working CLI or script that solves the real problem
|
|
212
|
+
- a need to expose it to an MCP client without a full rewrite
|
|
213
|
+
- requirements around file access boundaries, predictable execution, and debuggable failures
|
|
214
|
+
|
|
215
|
+
It is less useful if you want a full hosted platform, a managed registry, or opinionated cloud infrastructure out of the box.
|
|
216
|
+
|
|
217
|
+
## When Not To Use This
|
|
218
|
+
|
|
219
|
+
This repo is probably the wrong fit if:
|
|
220
|
+
|
|
221
|
+
- you need a hosted control plane, not a local or self-managed MCP server
|
|
222
|
+
- you do not already have a working CLI, script, or binary to wrap
|
|
223
|
+
- you want a full product UI before you have validated the tool workflow
|
|
224
|
+
- your use case requires broad unrestricted filesystem access with minimal guardrails
|
|
225
|
+
|
|
226
|
+
In those cases, a different architecture may be a better starting point than a thin wrapper around an existing command.
|
|
227
|
+
|
|
228
|
+
## Quick Example
|
|
229
|
+
|
|
230
|
+
If you already have something like:
|
|
231
|
+
|
|
232
|
+
- `inventory-cli run --input profiles/acme.toml --out artifacts/report.json`
|
|
233
|
+
|
|
234
|
+
you can use this repo to generate an MCP wrapper, map that command shape in `server.py`, lock access to the right directories, and expose it to an MCP client with a minimal config entry.
|
|
235
|
+
|
|
236
|
+
That is the core use case: keep the real tool, add a thin MCP layer, and make the setup repeatable.
|
|
237
|
+
|
|
238
|
+
For a more concrete walkthrough, see [`docs/EXAMPLE_ADAPTER.md`](/Users/maria/Documents/GitHub/extra/mcp-templates/docs/EXAMPLE_ADAPTER.md).
|
|
239
|
+
Before rollout, use [`docs/LAUNCH_CHECKLIST.md`](/Users/maria/Documents/GitHub/extra/mcp-templates/docs/LAUNCH_CHECKLIST.md).
|
|
240
|
+
|
|
241
|
+
## Design Principles
|
|
242
|
+
|
|
243
|
+
- strict arg validation
|
|
244
|
+
- path allowlists
|
|
245
|
+
- no `shell=True`
|
|
246
|
+
- subprocess timeout
|
|
247
|
+
- structured JSON responses
|
|
248
|
+
|
|
249
|
+
## Notes
|
|
250
|
+
|
|
251
|
+
- Template is transport/runner-agnostic: same server can be used by Claude Desktop, Claude Code, and other MCP clients.
|
|
252
|
+
- Each client still needs its own config entry pointing to the server command.
|
|
253
|
+
- The included Dockerfile is intentionally minimal: you still need to copy your real CLI into the image and set `PROJECT_BIN`.
|
|
254
|
+
- The smoke-test workflow uses a stub CLI so the template can be validated in CI without your real binary.
|
|
255
|
+
- The repo now includes package metadata and bundled template assets so `mcp-template` can be distributed as a pip package, not only used from source.
|
|
256
|
+
|
|
257
|
+
## FAQ
|
|
258
|
+
|
|
259
|
+
**Do I need a desktop app for this?**
|
|
260
|
+
|
|
261
|
+
No. The template is designed to stay headless and MCP-focused. A desktop app could be a future companion for setup or demos, but it is not required to use the template.
|
|
262
|
+
|
|
263
|
+
**Can this wrap a compiled binary instead of a Python tool?**
|
|
264
|
+
|
|
265
|
+
Yes. The template wraps a command-line executable through subprocess calls. Your real tool can be a Python CLI, shell-backed binary, Rust binary, Go binary, or another executable, as long as you map the command shape correctly.
|
|
266
|
+
|
|
267
|
+
**Why not just build a custom MCP server from scratch?**
|
|
268
|
+
|
|
269
|
+
If you already trust the CLI, a thin wrapper is usually faster to ship, easier to debug, and less likely to create a second implementation that drifts from the original tool.
|
|
270
|
+
|
|
271
|
+
## CI Coverage
|
|
272
|
+
|
|
273
|
+
The starter workflow currently verifies the template in three layers:
|
|
274
|
+
|
|
275
|
+
- bootstrap generation rewrites the template as expected
|
|
276
|
+
- Python files compile cleanly
|
|
277
|
+
- `doctor.py` passes in a normal runner environment
|
|
278
|
+
- the Docker image builds and can run `doctor.py` inside the container
|
|
279
|
+
|
|
280
|
+
## Near-Term Roadmap
|
|
281
|
+
|
|
282
|
+
To make this easier to deploy than other MCP starter options, the next high-value additions are:
|
|
283
|
+
|
|
284
|
+
- example hosting configs for common runtimes
|
|
285
|
+
- more reference adapters for common CLI patterns so users copy less and customize less
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# MCP Templates
|
|
2
|
+
|
|
3
|
+
Production-style starter templates for turning existing CLIs into MCP servers quickly, safely, and with minimal deployment friction.
|
|
4
|
+
|
|
5
|
+
If you already have a useful command-line tool, script, or internal binary, this repo helps you expose it to MCP clients without rewriting the tool from scratch.
|
|
6
|
+
|
|
7
|
+
The path is intentionally simple:
|
|
8
|
+
|
|
9
|
+
`existing CLI -> generated MCP wrapper -> validation -> client config -> working tool`
|
|
10
|
+
|
|
11
|
+
## Who This Is For
|
|
12
|
+
|
|
13
|
+
This repo is built for:
|
|
14
|
+
|
|
15
|
+
- platform teams exposing internal tools to MCP clients
|
|
16
|
+
- developers with a working CLI who want MCP support fast
|
|
17
|
+
- AI enablement teams that need safe, debuggable tool wrappers
|
|
18
|
+
- consultants or builders packaging an existing workflow for Claude Desktop, Claude Code, or similar clients
|
|
19
|
+
|
|
20
|
+
If MCP is new to you, start with [`docs/MCP_PRIMER.md`](/Users/maria/Documents/GitHub/extra/mcp-templates/docs/MCP_PRIMER.md).
|
|
21
|
+
|
|
22
|
+
## Positioning
|
|
23
|
+
|
|
24
|
+
Most MCP examples prove that a server can run. This repo is aimed at the harder problem: getting a real internal tool wrapped, validated, and ready to ship without rebuilding it from scratch.
|
|
25
|
+
|
|
26
|
+
The core bet is simple:
|
|
27
|
+
|
|
28
|
+
- reuse the CLI you already have
|
|
29
|
+
- add safety guardrails by default
|
|
30
|
+
- keep the server transport/client agnostic
|
|
31
|
+
- make local setup and deployment boring
|
|
32
|
+
|
|
33
|
+
## Why This Is Different
|
|
34
|
+
|
|
35
|
+
- Safer than toy examples: templates start with path allowlists, timeout handling, arg validation, and structured JSON output.
|
|
36
|
+
- Faster than framework-heavy rewrites: wrap an existing binary instead of reimplementing business logic in a new server stack.
|
|
37
|
+
- More portable than client-specific setups: the same server can be registered in Claude Desktop, Claude Code, and other MCP clients.
|
|
38
|
+
- Closer to production: examples are designed around real subprocess execution, explicit env configuration, and predictable failure modes.
|
|
39
|
+
|
|
40
|
+
## Why This Beats Existing Options
|
|
41
|
+
|
|
42
|
+
For the right audience, this is better than most existing MCP starter options because it optimizes for migration, not greenfield demos.
|
|
43
|
+
|
|
44
|
+
- Most examples show how to build an MCP server from scratch. This helps you keep the CLI you already trust.
|
|
45
|
+
- Many wrappers stop at "it runs." This repo includes validation, generated configs, CI smoke tests, and packaging paths.
|
|
46
|
+
- Client-specific examples often trap you in one setup. This stays transport- and client-agnostic.
|
|
47
|
+
- Framework-heavy approaches can force a rewrite too early. This keeps the MCP layer thin until the workflow proves valuable.
|
|
48
|
+
|
|
49
|
+
If someone already has a working CLI, the comparison should not be "template versus template." It should be:
|
|
50
|
+
|
|
51
|
+
`rewrite the tool` vs `wrap the tool safely and ship sooner`
|
|
52
|
+
|
|
53
|
+
## What You Get In Practice
|
|
54
|
+
|
|
55
|
+
With the current Python template, you can:
|
|
56
|
+
|
|
57
|
+
- generate a project-specific MCP wrapper with renamed placeholders
|
|
58
|
+
- point it at a real binary instead of a toy example
|
|
59
|
+
- get project-specific sample client config files during bootstrap, already pointed at the generated `server.py`
|
|
60
|
+
- get a starter `.gitignore` in the copied wrapper
|
|
61
|
+
- get a starter `Makefile` with common wrapper commands
|
|
62
|
+
- get a starter `requirements.txt` in the copied wrapper
|
|
63
|
+
- get placeholder sample input/output files for first local tests
|
|
64
|
+
- get a generated `.env.example` with the renamed runtime variables, and auto-load `.env` if present
|
|
65
|
+
- get a generated `USAGE.md` with first-run steps for the copied wrapper
|
|
66
|
+
- validate setup with `doctor.py` before opening a client
|
|
67
|
+
- validate setup with `doctor.py` before opening a client, including machine-readable `--json` output for CI or setup tooling
|
|
68
|
+
- use a real `mcp-template` command from the repo root instead of calling an internal script path
|
|
69
|
+
- package it with Docker
|
|
70
|
+
- verify the template itself in CI with bootstrap, syntax, and smoke checks
|
|
71
|
+
|
|
72
|
+
## 30-Second Quickstart
|
|
73
|
+
|
|
74
|
+
If you already have a CLI, the basic flow is:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
./mcp-template generate /path/to/your-project/mcp \
|
|
78
|
+
--server-name your-project \
|
|
79
|
+
--tool-name run_profile \
|
|
80
|
+
--binary-name your-cli
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If you want a different env namespace than the server slug, add:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
--env-prefix YOUR_TEAM_TOOL
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If you want to preview the generated output first, add:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
--dry-run
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If you already know the real executable path, add:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
--bin-path /abs/path/to/your-cli
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If you want the generated client config to use a specific Python interpreter, add:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
--python-path /abs/path/to/python
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
If you want to prefill allowed directories too, add:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
--read-dirs /abs/path/to/data,/abs/path/to/profiles \
|
|
111
|
+
--write-dirs /abs/path/to/artifacts
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Then:
|
|
115
|
+
|
|
116
|
+
1. replace the placeholder command mapping in `server.py`
|
|
117
|
+
2. replace the stub binary in `bin/`
|
|
118
|
+
3. fill in `.env.example`
|
|
119
|
+
4. read `USAGE.md`
|
|
120
|
+
5. adapt one of the generated sample configs in `examples/`
|
|
121
|
+
6. run `doctor.py`
|
|
122
|
+
7. call `version` and `paths`
|
|
123
|
+
8. validate with `healthcheck`
|
|
124
|
+
|
|
125
|
+
## Install Options
|
|
126
|
+
|
|
127
|
+
Use one of these depending on how you want to adopt the tool:
|
|
128
|
+
|
|
129
|
+
- From a clone right now: `./mcp-template generate ...`
|
|
130
|
+
- Local pip install from a clone: `python -m pip install .`
|
|
131
|
+
- Local isolated install from a clone: `pipx install .`
|
|
132
|
+
|
|
133
|
+
After the package is published, the intended install command is:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pipx install mcp-template
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Then the command stays the same everywhere:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
mcp-template generate /path/to/your-project/mcp --server-name your-project
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## How It Fits Together
|
|
146
|
+
|
|
147
|
+
```mermaid
|
|
148
|
+
flowchart LR
|
|
149
|
+
A["Existing CLI or binary"] --> B["Generated MCP wrapper"]
|
|
150
|
+
B --> C["doctor.py validation"]
|
|
151
|
+
B --> D["Claude Desktop / Claude Code / other MCP client"]
|
|
152
|
+
D --> B
|
|
153
|
+
B --> E["Allowed read/write dirs"]
|
|
154
|
+
B --> F["Structured JSON results"]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Included
|
|
158
|
+
|
|
159
|
+
- `python-cli-template/`: production-style Python MCP wrapper for any CLI tool
|
|
160
|
+
- `python-cli-template/bin/project-cli`: stub binary used only for template smoke testing
|
|
161
|
+
- `python-cli-template/doctor.py`: preflight checker for Python, env vars, paths, and client config JSON
|
|
162
|
+
- `python-cli-template/Dockerfile`: minimal container target for packaging the Python template
|
|
163
|
+
- `mcp-template`: repo-local launcher for the public CLI
|
|
164
|
+
- `src/mcp_template_cli/`: installable `mcp-template` CLI package
|
|
165
|
+
- `scripts/init_python_cli_template.py`: compatibility shim for the public CLI
|
|
166
|
+
- `.github/workflows/python-template-smoke.yml`: CI smoke test for syntax, preflight validation, and container build
|
|
167
|
+
- `examples/claude_desktop_config.sample.json`: local Claude Desktop config example
|
|
168
|
+
- `examples/claude_code_mcp.sample.json`: generic Claude Code-style config example
|
|
169
|
+
- `docs/QUICKSTART.md`: 10-minute setup flow
|
|
170
|
+
- `docs/MCP_PRIMER.md`: short explanation of what MCP is and why this repo exists
|
|
171
|
+
- `docs/EXAMPLE_ADAPTER.md`: concrete walkthrough for wrapping a real CLI command
|
|
172
|
+
- `docs/LAUNCH_CHECKLIST.md`: rollout checklist for validating a wrapper before production use
|
|
173
|
+
|
|
174
|
+
## How To Use
|
|
175
|
+
|
|
176
|
+
1. Run the repo-local generator with `./mcp-template generate`.
|
|
177
|
+
2. Generate a project-specific copy.
|
|
178
|
+
3. Replace the stub binary and adjust the command mapping.
|
|
179
|
+
4. Adapt one of the generated sample configs in `examples/` for your client.
|
|
180
|
+
5. Set env vars (`*_BIN`, allowed read/write dirs).
|
|
181
|
+
6. Run `doctor.py` to catch binary, Python, path, and config issues early.
|
|
182
|
+
7. Register server in your MCP client config.
|
|
183
|
+
8. Test with `version`, `paths`, and `healthcheck` first.
|
|
184
|
+
|
|
185
|
+
## Best Fit
|
|
186
|
+
|
|
187
|
+
This repo is a strong fit when you already have:
|
|
188
|
+
|
|
189
|
+
- a working CLI or script that solves the real problem
|
|
190
|
+
- a need to expose it to an MCP client without a full rewrite
|
|
191
|
+
- requirements around file access boundaries, predictable execution, and debuggable failures
|
|
192
|
+
|
|
193
|
+
It is less useful if you want a full hosted platform, a managed registry, or opinionated cloud infrastructure out of the box.
|
|
194
|
+
|
|
195
|
+
## When Not To Use This
|
|
196
|
+
|
|
197
|
+
This repo is probably the wrong fit if:
|
|
198
|
+
|
|
199
|
+
- you need a hosted control plane, not a local or self-managed MCP server
|
|
200
|
+
- you do not already have a working CLI, script, or binary to wrap
|
|
201
|
+
- you want a full product UI before you have validated the tool workflow
|
|
202
|
+
- your use case requires broad unrestricted filesystem access with minimal guardrails
|
|
203
|
+
|
|
204
|
+
In those cases, a different architecture may be a better starting point than a thin wrapper around an existing command.
|
|
205
|
+
|
|
206
|
+
## Quick Example
|
|
207
|
+
|
|
208
|
+
If you already have something like:
|
|
209
|
+
|
|
210
|
+
- `inventory-cli run --input profiles/acme.toml --out artifacts/report.json`
|
|
211
|
+
|
|
212
|
+
you can use this repo to generate an MCP wrapper, map that command shape in `server.py`, lock access to the right directories, and expose it to an MCP client with a minimal config entry.
|
|
213
|
+
|
|
214
|
+
That is the core use case: keep the real tool, add a thin MCP layer, and make the setup repeatable.
|
|
215
|
+
|
|
216
|
+
For a more concrete walkthrough, see [`docs/EXAMPLE_ADAPTER.md`](/Users/maria/Documents/GitHub/extra/mcp-templates/docs/EXAMPLE_ADAPTER.md).
|
|
217
|
+
Before rollout, use [`docs/LAUNCH_CHECKLIST.md`](/Users/maria/Documents/GitHub/extra/mcp-templates/docs/LAUNCH_CHECKLIST.md).
|
|
218
|
+
|
|
219
|
+
## Design Principles
|
|
220
|
+
|
|
221
|
+
- strict arg validation
|
|
222
|
+
- path allowlists
|
|
223
|
+
- no `shell=True`
|
|
224
|
+
- subprocess timeout
|
|
225
|
+
- structured JSON responses
|
|
226
|
+
|
|
227
|
+
## Notes
|
|
228
|
+
|
|
229
|
+
- Template is transport/runner-agnostic: same server can be used by Claude Desktop, Claude Code, and other MCP clients.
|
|
230
|
+
- Each client still needs its own config entry pointing to the server command.
|
|
231
|
+
- The included Dockerfile is intentionally minimal: you still need to copy your real CLI into the image and set `PROJECT_BIN`.
|
|
232
|
+
- The smoke-test workflow uses a stub CLI so the template can be validated in CI without your real binary.
|
|
233
|
+
- The repo now includes package metadata and bundled template assets so `mcp-template` can be distributed as a pip package, not only used from source.
|
|
234
|
+
|
|
235
|
+
## FAQ
|
|
236
|
+
|
|
237
|
+
**Do I need a desktop app for this?**
|
|
238
|
+
|
|
239
|
+
No. The template is designed to stay headless and MCP-focused. A desktop app could be a future companion for setup or demos, but it is not required to use the template.
|
|
240
|
+
|
|
241
|
+
**Can this wrap a compiled binary instead of a Python tool?**
|
|
242
|
+
|
|
243
|
+
Yes. The template wraps a command-line executable through subprocess calls. Your real tool can be a Python CLI, shell-backed binary, Rust binary, Go binary, or another executable, as long as you map the command shape correctly.
|
|
244
|
+
|
|
245
|
+
**Why not just build a custom MCP server from scratch?**
|
|
246
|
+
|
|
247
|
+
If you already trust the CLI, a thin wrapper is usually faster to ship, easier to debug, and less likely to create a second implementation that drifts from the original tool.
|
|
248
|
+
|
|
249
|
+
## CI Coverage
|
|
250
|
+
|
|
251
|
+
The starter workflow currently verifies the template in three layers:
|
|
252
|
+
|
|
253
|
+
- bootstrap generation rewrites the template as expected
|
|
254
|
+
- Python files compile cleanly
|
|
255
|
+
- `doctor.py` passes in a normal runner environment
|
|
256
|
+
- the Docker image builds and can run `doctor.py` inside the container
|
|
257
|
+
|
|
258
|
+
## Near-Term Roadmap
|
|
259
|
+
|
|
260
|
+
To make this easier to deploy than other MCP starter options, the next high-value additions are:
|
|
261
|
+
|
|
262
|
+
- example hosting configs for common runtimes
|
|
263
|
+
- more reference adapters for common CLI patterns so users copy less and customize less
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mcp-template"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Starter CLI for generating MCP wrappers around existing command-line tools."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = []
|
|
12
|
+
license = "MIT"
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "kraftaa"},
|
|
15
|
+
]
|
|
16
|
+
keywords = ["mcp", "templates", "cli", "ai", "tooling"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Software Development :: Code Generators",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/kraftaa/mcp-templates"
|
|
31
|
+
Repository = "https://github.com/kraftaa/mcp-templates"
|
|
32
|
+
Issues = "https://github.com/kraftaa/mcp-templates/issues"
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
mcp-template = "mcp_template_cli.cli:main"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools]
|
|
38
|
+
package-dir = {"" = "src"}
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.dynamic]
|
|
41
|
+
version = {attr = "mcp_template_cli.__version__"}
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["src"]
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
mcp_template_cli = [
|
|
48
|
+
"data/python-cli-template/.dockerignore",
|
|
49
|
+
"data/python-cli-template/Dockerfile",
|
|
50
|
+
"data/python-cli-template/doctor.py",
|
|
51
|
+
"data/python-cli-template/server.py",
|
|
52
|
+
"data/python-cli-template/bin/project-cli",
|
|
53
|
+
"data/examples/claude_code_mcp.sample.json",
|
|
54
|
+
"data/examples/claude_desktop_config.sample.json",
|
|
55
|
+
]
|