Metadata-Version: 2.4
Name: zenofmcp
Version: 0.1.0
Summary: The Zen of MCP: principles for designing tools that models can use well. Printed on import.
Author-email: Anuj Sadani <anuj.sadani3@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/asadani/zenofmcp
Project-URL: Issues, https://github.com/asadani/zenofmcp/issues
Project-URL: Changelog, https://github.com/asadani/zenofmcp/blob/main/CHANGELOG.md
Keywords: MCP,Model Context Protocol,AI agents,tool design,LLM,Zen
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# zenofmcp

[![CI](https://github.com/asadani/zenofmcp/actions/workflows/ci.yml/badge.svg)](https://github.com/asadani/zenofmcp/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/zenofmcp)](https://pypi.org/project/zenofmcp/)

### The Zen of MCP: principles for designing tools that models can use well.

A model is only as good as the tools you hand it. These principles cover how to design, describe, protect and operate tools for models, whether you build them with the Model Context Protocol (MCP) or anything else.

`import this` gave Python a shared mindset. `import zenofmcp` does the same for this corner of AI engineering: 15 short principles you can remember, cite by number and argue about.

> Written against the MCP specification as of 2026-07-28 (stateless, no protocol sessions). The principles themselves don't depend on any spec version.

```bash
pip install zenofmcp         # or: uv pip install zenofmcp / uv add zenofmcp
uvx zenofmcp --random        # run the CLI without installing (uv)
```

```python
>>> import zenofmcp
The Zen of MCP, by Anuj Sadani

1. Each tool should do one thing—and its name should say which.
2. Few sharp tools are better than many blunt ones.
...
```

---

## The principles

Numbers are stable across releases, so "see principle 3" in a review always means the same thing.

### Design
1. Each tool should do one thing—and its name should say which.
2. Few sharp tools are better than many blunt ones.
3. Design for the job, not the endpoint.

### Describe
4. The description is the interface.
5. Schemas guide; validation guards.
6. Errors should point the way forward.
7. In the face of missing input, refuse the temptation to guess.

### State
8. Keep the server stateless; let handles carry the state.
9. Long work should return a receipt, not a wait.
10. Every call may arrive twice—make sure it only counts once.

### Protect
11. Borrow the caller's authority; never exceed it.
12. The irreversible should never be implicit.
13. Never pass outside text off as your own.

### Operate
14. Enough is better than everything.
15. A published tool is a public API.

Every principle comes with an explanation and a concrete do/don't example: `zenofmcp --examples`.

---

## Usage

### On import

```python
import zenofmcp               # prints the principles
from zenofmcp import verbose  # prints them with explanations
```

Set `ZENOFMCP_QUIET=1` to import without printing.

### Command line

```bash
zenofmcp               # the principles
zenofmcp --verbose     # with explanations
zenofmcp --examples    # with a do/don't example for each
zenofmcp --themes      # grouped by theme
zenofmcp -n 3          # one principle in full
zenofmcp --random      # one at random: a daily reminder for your shell profile
zenofmcp --checklist   # Markdown checklist for PRs and agent instructions
zenofmcp --json        # machine-readable
```

`python -m zenofmcp` works the same way.

### As data

```python
import os; os.environ["ZENOFMCP_QUIET"] = "1"
import zenofmcp

zenofmcp.get(3).text            # "Design for the job, not the endpoint."
zenofmcp.by_theme("design")    # list of Principle objects
[p.text for p in zenofmcp.PRINCIPLES]
```

---

## Putting it into your workflow

A slogan is not a process. The principles help most where decisions are made:

- **Pull requests.** Paste `zenofmcp --checklist` into `.github/pull_request_template.md`. Reviewers can then point to a principle by number.
- **Coding agents.** Add the checklist (or `zenofmcp --themes`) to `AGENTS.md`, `CLAUDE.md` or your editor's rules file, so your agent works by the same standard you review by.
- **Onboarding.** `zenofmcp --examples` is a short read for anyone new to the team's approach.

---

## What this is, and isn't

- It **is** a compact, opinionated philosophy and a shared vocabulary for teams.
- It **isn't** a linter, a framework or a replacement for engineering judgment.
- It's **vendor-neutral**: no principle depends on a particular model, framework or vendor.

---

## Contributing

The principles should evolve through discussion, not by decree. Propose a new principle, a rewording or a better example by opening an issue. See [CONTRIBUTING.md](CONTRIBUTING.md).

## License

[MIT](LICENSE)
