Context Engineering MCP server
Commit Nov 13, 2026Offers companion code examples for building LLM systems with instructions, retrieval, tools, memory, and orchestration.
Also known as bonigarcia/context-engineering
- Stars
- 187
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 13, 2026
- License
- Apache-2.0
What is Context Engineering MCP?
Context Engineering offers companion code examples for building LLM systems with instructions, retrieval, tools, memory, and orchestration.
Summary generated from the project's README
About Context Engineering MCP server
Building consistent and predictable AI systems through structured information design is what this resource enables for developers and practitioners. It provides a comprehensive collection of companion code examples that serve as a practical reference for implementing context engineering principles. The repository includes implementations in Python, JavaScript, Java, and Jupyter Notebooks, covering a wide range of model providers such as OpenAI, Anthropic, Google Gemini, and local options like Ollama.
Users can explore specific patterns for managing instructions, external knowledge, and agentic memory. The examples cover advanced techniques like Retrieval-Augmented Generation (RAG), function calling, and long-term memory using tools like Mem0 or Cognee. It also addresses complex orchestration tasks through multi-agent patterns and context compression. By providing concrete code for everything from basic streaming interactions to sophisticated evaluation frameworks like DeepEval and LangSmith, it helps developers move beyond simple prompt engineering toward building complete, context-aware AI agents.
Written from the project's README. Every use case is checked against a quote from it.
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablebonigarcia/context-engineering is public and reachablegithub.com/bonigarcia/context-engineering ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-13github.com/bonigarcia/context-engineering ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubContext Engineering 
Context engineering can be defined as the practice of designing systems that provide a Large Language Model (LLM) and AI agents with all the necessary information to complete a task effectively. It goes beyond prompt engineering since it focuses on building a comprehensive and structured context from various sources like instructions, external knowledge, memory, tools, and state. The central idea is that the success of a complex LLM-based system depends more on the quality and completeness of the context provided than on the specific wording of the prompt itself.
Tobi Lütke, the CEO of Shopify, coined the term context engineering in a tweet on June 19, 2025. He defined context engineering as the art of providing all the context for the task to be plausibly solvable by the LLM. This novel concept captures the essence of the current evolution of LLM-based systems, inspiring others (like me) to understand and define this emerging discipline. Since then, I've been working on a book entitled Context Engineering: Build Consistent, Accurate, Predictable AI Systems, published by Manning. Currently, the early access version of the book is available, and you can get it here.
This GitHub repository is intended to be a companion resource for this book and a reference for practitioners looking to understand and adopt the context engineering principles.
Table of contents
This book aims to provide a strong, general-purpose theoretical foundation for context engineering, supported by hands-on examples. Its table of contents is the following:
- Introduction to context engineering
- Instructions for AI agents
- External knowledge and retrieval
- Tools in AI agents
- Memory and state in agentic systems
- User prompts for LLMs
- Context management and orchestration
- Evaluation and observability
- Governance and operations
- AI frameworks for context engineering
- Context engineering for software development
- The state of the art in context engineering
Appendix A. The AI ecosystem
Appendix B. References and further reading
Each chapter of this book begins by explaining the underlying principles and patterns of each thematic block. The final part of each chapter then presents specific examples, all of which are available in this GitHub repository. New examples will continue to be added, and existing ones maintained, even after the book is published. The goal is to provide an open-source, up-to-date reference for everyone interested in context engineering.
Examples
This repository organizes examples by chapter to help you explore context engineering concepts in practice.
Chapter 1. Introduction to context engineering
This chapter provides the foundations for interacting with different model providers:
- Basic interaction (OpenAI): Python · Jupyter · JavaScript · Java
- Streaming (OpenAI): Python · Jupyter · JavaScript · Java
- Basic interaction (Anthropic): Python · Jupyter · JavaScript · Java
- Streaming (Anthropic): Python · Jupyter · JavaScript · Java
- Basic interaction (Google): Python · Jupyter · JavaScript · Java
- Streaming (Google): Python · Jupyter · JavaScript · Java
- Basic interaction (Ollama): Python · Jupyter · JavaScript · Java
- Streaming (Ollama): Python · Jupyter · JavaScript · Java
Chapter 2. Instructions for AI agents
This chapter covers the definition and usage of instructions (system prompts, agent skills, instructions artifacts) as a foundation layer to shape the model behavior:
- System prompts (OpenAI): Python · Jupyter · JavaScript · Java
- System prompts (Anthropic): Python · Jupyter · JavaScript · Java
- System prompts (Google): Python · Jupyter · JavaScript · Java
- System prompts (Ollama): Python · Jupyter · JavaScript · Java
- Agent skills: project-notetaker
- Instruction artifacts: task-tracker
Chapter 3. External knowledge and retrieval
This chapter explores different patterns for providing external knowledge to a model:
- Retrieval-Augmented Generation (RAG): OpenAI (Python) · OpenAI (Jupyter) · Hugging Face (Python) · Hugging Face (Jupyter)
- Advanced RAG: LangChain · Qdrant · PageIndex (Python) · PageIndex (Jupyter) · RAGFlow
- Context stuffing: System prompt (Python) · System prompt (Jupyter) · User prompt (Python) · User prompt (Jupyter)
- Cache-Augmented Generation (CAG): Python · Jupyter
Chapter 4. Tools in AI agents
This chapter focuses on extending the capabilities of AI agents through tools:
- Function calling: Python · JavaScript · Java
- Command-Line Interface (CLI): workspace-analyzer
- Model Context Protocol (MCP) server: Python · JavaScript · Java
Chapter 5. Memory and state in agentic systems
This chapter explores how to maintain information across interactions using memory and state:
- Session memory: Python
- Long-term memory (Mem0): Python · JavaScript · Java
- Long-term memory (Cognee): Python
- Memory coach: Python
- Session state: Python · JavaScript · Java
- Workflow state: Python · JavaScript · Java
Chapter 6. User prompts for LLMs
This chapter focuses on the design and optimization of user prompts, including techniques like few-shot prompting, prompt chaining, Chain-of-Thought, or ReAct:
- Few-shot prompting: Python · Jupyter · JavaScript · Java
- Prompt chaining: Python · Jupyter · JavaScript · Java
- Chain-of-Thought vs ReAct (DSPy): Python · Jupyter
Chapter 7. Context management and orchestration
This chapter focuses on managing and orchestrating context in complex agentic systems, including context compression, hierarchical context, or multi-agent patterns:
- Context compression: LLMLingua
- Filesystem context: OpenViking
- Collaborative agents: CrewAI
- Multi-agent router: LangGraph
- Orchestration: DeepAgents
- Agent-to-Agent (A2A): Python
Chapter 8. Evaluation and observability
This chapter covers evaluation and observability for context-aware systems:
- Metrics: DeepEval
- Evals: Promptfoo
- LLM-as-judge: Ragas
- Observability: Langfuse
- Observability: LangSmith
Chapter 9. Governance and operations
This chapter covers governance, human oversight, and operational patterns for context-aware systems:
- Personally Identifiable Information (PII) redaction: Microsoft Presidio
- Output validation: Pydantic
- Bias detection: Fairlearn
- AI gateway: LiteLLM
- Human-in-the-loop: Python
- Model fine-tuning: Python
- Context as code: Python
Chapter 10. AI frameworks for context engineering
This chapter covers specific AI frameworks that facilitate context engineering, including application frameworks, agent orchestration frameworks, and AI application platforms:
- AI application frameworks: LangChain · LlamaIndex · Haystack · Spring AI · LangChain4j · Pydantic AI · DSPy · AI SDK
- Agent orchestration frameworks: LangGraph · CrewAI · Agent Development Kit · Microsoft Agent Framework · Agno · Embabel · Parlant · DeepAgents · Claude Agent SDK
- AI application platforms: Zapier · n8n · OpenClaw · Temporal · Amazon Bedrock AgentCore · Gemini Enterprise Agent Platform
Chapter 11. Context engineering for software development
This chapter shows how context engineering supports the software development lifecycle (SDLC) through reusable skills, instruction artifacts, external documentation retrieval, orchestration layers, and specialized agents:
- Agent skills: Claude Code
- Instructions artifact: Cursor rules
- Documentation retrieval: Codex with Context7
- SDLC prompt library: SDLC prompt library
- Specification-driven development: Spec Kit
- Orchestration: OpenCode Superpowers · Antigravity Open GSD · BMAD specialized agents
Chapter 12. The state of the art in context engineering
This chapter covers mathematical foundations, open research challenges, technical innovation frontiers, domain-specific applications, and future directions:
- Technology radar: Context engineering radar
- Base knowledge: Graphify base knowledge
Online resources
This repository includes interactive web pages that complement the book and help you apply context engineering concepts in practice.
1. AI Ecosystem
🔗 https://bonigarcia.dev/context-engineering/ai-ecosystem.html
Curated collection of the AI ecosystem:
- Browse model families, agents, frameworks, and tooling in one place
- Search across the appendix snapshot by name, feature, license, or pricing
This page is a companion index for the Appendix A and is designed to stay easy to maintain as the ecosystem changes.
2. Context-Aware Prompt Builder
🔗 https://bonigarcia.dev/context-engineering/context-aware-prompt-builder.html
Design, compare, and reuse structured prompts across multiple frameworks and AI models:
- Build prompts using established frameworks (10-step, COSTAR, CRISPE, RTF, etc.)
- Switch frameworks dynamically while preserving intent
- Import/export prompts as JSON
- Measure approximate context usage for different models
- Load curated prompt samples for common SDLC roles
This tool is especially useful for creating and iterating on prompts in a structured, repeatable way.
3. SDLC Prompt Library
🔗 https://bonigarcia.dev/context-engineering/sdlc_prompt_library.html
Browse a curated library of prompts organized around the software development lifecycle (SDLC), including roles for architect, developer, debugger, reviewer, refactorer, tester, and documenter:
- Explore prompts visually using a card-based interface
- Filter by framework (10-step, COSTAR, CRISPE, RTF)
- Inspect full structured prompts for each role
- Copy prompts directly for reuse or adaptation
This tool is designed as a reference library, helping you understand how structured prompts vary across roles and frameworks.
4. Context Engineering Radar
🔗 https://bonigarcia.dev/context-engineering/context-engineering-radar.html
An interactive dashboard to explore and track concepts, sources, frameworks, and publications in the field of context engineering:
- Circular radar visualization using SVG geometry and polar coordinates mapping
- Classify resources across Primary, Secondary, and Tertiary ring levels
- Group items in distinct quadrants: Literature, Frameworks, Models, and Communities
- Dynamic searching, category filters, and detailed description modal overlays
5. Further Reading
🔗 https://bonigarcia.dev/context-engineering/references.html
Searchable catalog of articles, books, repositories, tutorials, and other references related to context engineering, prompting, agents, and AI engineering: context engineering, AI agents, machine learning, prompt engineering, RAG, generative AI, MCP, AI-assisted development, LLMs, memory, retrieval, multi-agent systems.
Contributing
If you think something should be improved or want to contribute to this repo, please open a pull request. Any comments or feedback are welcome.
About
context-engineering (Copyright © 2025-2026) is an open-source project created and maintained by Boni Garcia, licensed under the terms of Apache 2.0 License.
Context Engineering MCP questions
What is context engineering?
It is the practice of designing systems that give an LLM and AI agents all the information needed to complete a task effectively, going beyond prompt engineering.
What languages are the examples available in?
Examples are provided in Python, Jupyter, JavaScript, and Java across the chapters.
