# Ks Cookbook

> Developer acceleration layer for enterprise RAG + agent pipelines. 32 production-style flagships on LangChain, LangGraph, CrewAI, Temporal, OpenAI Agents SDK, pydantic-ai. Permission-aware retrieval, chunk-level citations, schema-enforced output. Built on Model Context Protocol (MCP).

- **Type:** MCP server
- **Install:** `agentstack add mcp-knowledgestack-ks-cookbook`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [knowledgestack](https://agentstack.voostack.com/s/knowledgestack)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [knowledgestack](https://github.com/knowledgestack)
- **Source:** https://github.com/knowledgestack/ks-cookbook
- **Website:** https://knowledgestack.ai

## Install

```sh
agentstack add mcp-knowledgestack-ks-cookbook
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Knowledge Stack Cookbook

### **Focus on agents. We handle document intelligence.**

**32 production-style flagship agents + 100+ recipes for enterprise RAG — built on [MCP](https://modelcontextprotocol.io/), works with every major agent framework.**

[](https://github.com/knowledgestack/ks-cookbook/stargazers)
[](https://discord.gg/McHmxUeS)

[](LICENSE)
[](https://www.python.org/)
[](flagships/)
[](recipes/)
[](https://modelcontextprotocol.io/)
[](https://www.langchain.com/)
[](https://langchain-ai.github.io/langgraph/)
[](https://www.crewai.com/)
[](https://temporal.io/)

[**Quickstart**](#quickstart) · [**Flagships**](#flagships-by-vertical) · [**Recipes**](recipes/INDEX.md) · [**Wiki**](https://github.com/knowledgestack/ks-cookbook/wiki) · [**Discord**](https://discord.gg/McHmxUeS)

---

Knowledge Stack is the document intelligence layer behind your agents — ingestion, chunking, permissions, versioning, citations — exposed as a stable **MCP** surface that plugs into [LangChain](https://www.langchain.com/), [LangGraph](https://langchain-ai.github.io/langgraph/), [CrewAI](https://www.crewai.com/), [Temporal](https://temporal.io/), [OpenAI Agents SDK](https://github.com/openai/openai-agents-python), [pydantic-ai](https://ai.pydantic.dev/), [Claude Desktop](https://claude.ai/download), [Cursor](https://cursor.com/), and anything else that speaks [MCP](https://modelcontextprotocol.io/). **Every flagship runs under every framework** — same prompt + schema, framework swaps in.

You focus on agent logic. KS manages the knowledge layer.

→ **New here?** Jump to the [Quickstart](#quickstart) below, or browse the [flagships by vertical](#flagships-by-vertical).

## Index

- 🚀 [Quickstart](#quickstart) — `git clone` → first recipe in ~5 min
- 🧭 [Flagships by vertical](#flagships-by-vertical) — 32 production-style agents, grouped by industry
- 📚 [Recipes index](recipes/INDEX.md) — 100+ ≤100-LOC single-file patterns
- 🔌 Framework integrations: [LangChain](https://www.langchain.com/) · [LangGraph](https://langchain-ai.github.io/langgraph/) · [CrewAI](https://www.crewai.com/) · [Temporal](https://temporal.io/) · [OpenAI Agents SDK](https://github.com/openai/openai-agents-python) · [pydantic-ai](https://ai.pydantic.dev/) · [Claude Desktop](https://claude.ai/download) · [Cursor](https://cursor.com/)
- 🛠 [MCP tools used](#mcp-tools-used) — the 10 read-only tools every flagship calls
- ✍️ [Contributing](CONTRIBUTING.md) · [Industries roadmap](INDUSTRIES.md) · [Wiki](https://github.com/knowledgestack/ks-cookbook/wiki)

## Quickstart

`git clone` → first cited recipe in ~5 minutes.

**Prereqs:** Python `3.11+`, [`uv`](https://docs.astral.sh/uv/), a Knowledge Stack API key (sign in at ), and an OpenAI key (`gpt-4o`; `gpt-4o-mini` skips grounding and emits empty citations).

```bash
git clone https://github.com/knowledgestack/ks-cookbook.git
cd ks-cookbook
cp .env.example .env       # then fill in KS_API_KEY + OPENAI_API_KEY
make setup                 # installs every workspace package + validates env
```

Run your first recipe:

```bash
uv run python recipes/icd10_coder/recipe.py \
    --note-file recipes/icd10_coder/sample_inputs/deid_visit_001.txt
```

The agent makes ~10–20 MCP tool calls (`search_knowledge`, `read`, …), then emits a JSON `CodingResult` with real `chunk_id`s pointing into your tenant.

Other quick wins:

```bash
uv run python recipes/clause_extractor/recipe.py --contract "Apple 2024 proxy"
uv run python recipes/contract_renewal_checker/recipe.py --contract "Donna Huang software development"
uv run python recipes/aml_sar_narrative/recipe.py --case-id "structuring-cash-deposits"
make help                  # list every demo target
```

Each recipe folder has its own `README.md` with a captured live output and troubleshooting. To adapt a flagship to your own tenant, override `CORPUS_FOLDER_ID`:

```bash
CORPUS_FOLDER_ID=your-folder-id make demo-credit-memo
```

## Flagships by vertical

32 flagships. Each links to its own README with the expected corpus, a sample input, and a captured sample output — open one to see exactly what it does before running.

Jump to: [Banking](#banking--financial-services) · [Legal](#legal) · [Accounting & tax](#accounting--tax) · [Healthcare](#healthcare) · [Insurance](#insurance) · [Real estate](#real-estate) · [Sales & revenue](#sales--revenue) · [HR](#hr) · [Engineering](#engineering-product--sre) · [Government, pharma, energy](#government-pharma--energy)

### Banking & financial services

- **[Credit memo drafter](flagships/credit_memo_drafter/)** — Cited credit memo from your bank's policy + a borrower's financials.Tags: `banking` `credit-risk` `underwriting` `commercial-lending`
- **[Loan covenant monitor](flagships/loan_covenant_monitor/)** — Flag covenant breaches from quarterly financials.Tags: `banking` `covenant-monitoring` `credit-risk`
- **[KYC onboarding review](flagships/kyc_onboarding_review/)** — CDD checklist + risk tier against your KYC policy.Tags: `banking` `kyc` `aml` `compliance`
- **[Earnings risk analyzer](flagships/earnings_risk_analyzer/)** — Hebbia-style 10-K risk-flag memo with chunk citations.Tags: `finance` `sec-filings` `10-k` `investment-research`

### Legal

- **[Contract obligation extractor](flagships/contract_obligation_extractor/)** — Every `shall`/`must`/`will` obligation from a contract, categorized + cited.Tags: `legal` `contracts` `msa` `obligations`
- **[MSA redline vs. playbook](flagships/msa_redline_vs_playbook/)** — Compare an inbound MSA clause-by-clause against your playbook.Tags: `legal` `contracts` `redline` `negotiations`
- **[Privacy impact assessment](flagships/privacy_impact_assessment/)** — PIA memo citing GDPR Article 35 + company template.Tags: `legal` `privacy` `gdpr` `security`

### Accounting & tax

- **[Rev-rec memo (ASC 606)](flagships/rev_rec_memo/)** — Five-step revenue-recognition memo grounded in policy.Tags: `accounting` `asc-606` `revenue-recognition` `memos`
- **[Audit workpaper drafter](flagships/audit_workpaper_drafter/)** — Tie a GL balance to source docs with PCAOB AS 1215 cites.Tags: `accounting` `audit` `pcaob` `workpapers`
- **[Tax position memo](flagships/tax_position_memo/)** — Tax memo citing IRC sections + Treasury Regs.Tags: `tax` `irc` `research` `memos`

### Healthcare

- **[Prior-authorization letter](flagships/prior_auth_letter/)** — Cited prior-auth or appeal letter grounded in payer medical policy.Tags: `healthcare` `prior-auth` `payer` `clinical`
- **[Clinical trial eligibility](flagships/clinical_trial_eligibility/)** — Match a patient against I/E criteria from a real protocol.Tags: `healthcare` `clinical-trials` `eligibility` `ctms`

### Insurance

- **[Claim adjudication memo](flagships/claim_adjudication_memo/)** — Coverage-analysis memo for a P&C claim.Tags: `insurance` `claims` `coverage-analysis` `p-and-c`
- **[Subrogation opportunity review](flagships/subrogation_opportunity_review/)** — Recovery potential, citing NAIC Model 902.Tags: `insurance` `subrogation` `claims`
- **[Insurance policy comparison](flagships/insurance_policy_comparison/)** — Side-by-side analysis with explicit coverage gaps.Tags: `insurance` `policy-comparison` `coverage`

### Real estate

- **[Lease abstract](flagships/lease_abstract/)** — One-page cited abstract (term, rent, renewals, CAM, exclusives).Tags: `real-estate` `leases` `commercial`
- **[Zoning compliance check](flagships/zoning_compliance_check/)** — Proposed use vs. local Land Development Code.Tags: `real-estate` `zoning` `compliance` `municipal`

### Sales & revenue

- **[CSV enrichment](flagships/csv_enrichment/)** — Enrich every CSV row with a short summary from your KB.Tags: `sales` `data-enrichment` `batch` `operations`
- **[Research brief](flagships/research_brief/)** — Cited `.docx` research brief from your tenant.Tags: `research` `reports` `analyst`
- **[RFP first draft](flagships/rfp_first_draft/)** — RFP responses grounded in past proposals + capability docs.Tags: `sales` `rfp` `proposals` `go-to-market`
- **[Sales battlecard](flagships/sales_battlecard/)** — Differentiators, objection handlers, win themes.Tags: `sales` `competitive` `enablement`
- **[Compliance questionnaire filler](flagships/compliance_questionnaire/)** — Auto-complete CAIQ / SIG from your policy docs.Tags: `security` `compliance` `caiq` `sig` `questionnaires`

### HR

- **[Employee handbook Q&A](flagships/employee_handbook_qa/)** — Cited answers from the company handbook.Tags: `hr` `handbook` `q-and-a`
- **[Job description generator](flagships/job_description_generator/)** — JD grounded in leveling + comp bands.Tags: `hr` `recruiting` `job-descriptions`

### Engineering, product & SRE

- **[Incident runbook lookup](flagships/incident_runbook_lookup/)** — PagerDuty alert → runbook + cited remediation.Tags: `engineering` `sre` `runbooks` `incident-response`
- **[API doc generator](flagships/api_doc_generator/)** — Endpoint → developer docs from OpenAPI + style guide.Tags: `engineering` `api` `documentation` `devex`
- **[Release notes generator](flagships/release_notes_generator/)** — Customer-facing notes from specs + migration guide.Tags: `product` `engineering` `release-notes`
- **[SOW scope validator](flagships/sow_scope_validator/)** — SOW completeness vs. template + methodology.Tags: `proserv` `sow` `scope-management`

### Government, pharma & energy

- **[Grant compliance checker](flagships/grant_compliance_checker/)** — Sub-awardee activity vs. NOFO + 2 CFR 200.Tags: `government` `grants` `compliance` `cfr`
- **[FOIA response drafter](flagships/foia_response_drafter/)** — FOIA letter with exemption analysis.Tags: `government` `foia` `public-records`
- **[Adverse event narrative](flagships/adverse_event_narrative/)** — CIOMS-style AE narrative from drug label + PV SOP.Tags: `pharma` `pharmacovigilance` `cioms` `safety`
- **[NERC CIP evidence pack](flagships/nerc_compliance_evidence/)** — Compliance evidence memo for a NERC CIP requirement.Tags: `energy` `nerc-cip` `compliance` `utilities`

## Browse by tag

Tags are first-class metadata declared in each flagship's `pyproject.toml` `[project] keywords`. To find every flagship that uses a given tag, search the repo:

```bash
grep -l '"banking"' flagships/*/pyproject.toml
```

To **add or change tags on a flagship**: edit `keywords = [...]` in its `pyproject.toml`, then run `make tags`.

See [INDUSTRIES.md](INDUSTRIES.md) for the broader roadmap and proposed next flagships.

## Recipes

Short (≤100 LOC) single-file patterns across LangGraph, raw OpenAI, raw Anthropic, and MCP-only — see [`recipes/INDEX.md`](recipes/INDEX.md).

## MCP tools used

Every flagship and recipe in this repo is read-only against your tenant. The 10 MCP tools the agents are allowed to call:

`search_knowledge` · `search_keyword` · `read` · `read_around` · `list_contents` · `find` · `get_info` · `view_chunk_image` · `get_organization_info` · `get_current_datetime`

That's the full contract. Writes are intentionally not exposed.

## Community

- 💬 [**Discord**](https://discord.gg/McHmxUeS) — fastest place to get implementation and architecture help.
- 🗣️ [**GitHub Discussions**](https://github.com/knowledgestack/ks-cookbook/discussions) — long-form questions, propose flagships.
- 🐛 [**Issues**](https://github.com/knowledgestack/ks-cookbook/issues/new/choose) — bugs, [flagship requests](https://github.com/knowledgestack/ks-cookbook/issues/new?template=flagship_request.yml), [recipe requests](https://github.com/knowledgestack/ks-cookbook/issues/new?template=recipe_request.yml), [framework integrations](https://github.com/knowledgestack/ks-cookbook/issues/new?template=framework_integration.yml).
- 🔒 Security: see [SECURITY.md](SECURITY.md). Do **not** open public issues for vulnerabilities.

## Star history

If this repo helps you ship, **[star it](https://github.com/knowledgestack/ks-cookbook)** — it's the single biggest signal we use to decide which flagships, frameworks, and verticals to prioritize next.

  
    
    
  

## License

MIT. See [LICENSE](LICENSE).

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [knowledgestack](https://github.com/knowledgestack)
- **Source:** [knowledgestack/ks-cookbook](https://github.com/knowledgestack/ks-cookbook)
- **License:** MIT
- **Homepage:** https://knowledgestack.ai

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-knowledgestack-ks-cookbook
- Seller: https://agentstack.voostack.com/s/knowledgestack
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
