Skip to main content
Glama
HJeon139

Out of Context

by HJeon139

Out of Context

An MCP (Model Context Protocol) server for managing context using simple CRUD operations. Stores contexts as markdown files (.mdc) with YAML frontmatter, allowing agents to save, retrieve, search, and manage context by name.


Features

  • Simple CRUD Operations: 5 basic tools for context management (put, list, get, search, delete)

  • Markdown Storage: Contexts stored as .mdc files (markdown with YAML frontmatter)

  • Agent-Recognizable Names: Use meaningful names instead of UUIDs

  • Bulk Operations: Support for bulk put, get, and delete operations with robust parameter handling

  • Pydantic Validation: Type-safe parameter validation with automatic schema generation

  • Text Search: Search contexts by query string across metadata and content

  • MCP Integration: Works with any MCP-compatible platform (Cursor, Claude Desktop, etc.)


Related MCP server: Markdown MCP Server

Quick Start

Installation

pip install hjeon139-mcp-outofcontext

MCP Server Configuration

Add to your MCP platform configuration (e.g., Cursor or Claude Desktop):

{
  "mcpServers": {
    "out-of-context": {
      "command": "hjeon139_mcp_outofcontext",
      "env": {
        "OUT_OF_CONTEXT_STORAGE_PATH": "out_of_context"
      }
    }
  }
}

Verify Installation

In your MCP platform, check that tools like put_context, list_context, get_context, search_context, and delete_context are available.


Usage Examples

Add Context

Single operation:

{
  "tool": "put_context",
  "arguments": {
    "name": "api-design-notes",
    "text": "# API Design Notes\n\nKey decisions about the REST API...",
    "metadata": {
      "type": "note",
      "tags": ["api", "design"]
    }
  }
}

Bulk operation:

{
  "tool": "put_context",
  "arguments": {
    "contexts": [
      {
        "name": "context-1",
        "text": "First context",
        "metadata": {"type": "note"}
      },
      {
        "name": "context-2",
        "text": "Second context"
      }
    ]
  }
}

List Contexts

{
  "tool": "list_context",
  "arguments": {
    "limit": 10
  }
}

Returns list of contexts sorted by creation date (newest first).

Get Context

Single operation:

{
  "tool": "get_context",
  "arguments": {
    "name": "api-design-notes"
  }
}

Bulk operation:

{
  "tool": "get_context",
  "arguments": {
    "names": ["context-1", "context-2", "context-3"]
  }
}

Search Contexts

{
  "tool": "search_context",
  "arguments": {
    "query": "API design",
    "limit": 5
  }
}

Searches in both YAML frontmatter (metadata) and markdown body (text content).

Delete Context

Single operation:

{
  "tool": "delete_context",
  "arguments": {
    "name": "old-context"
  }
}

Bulk operation:

{
  "tool": "delete_context",
  "arguments": {
    "names": ["context-1", "context-2"]
  }
}

Storage Format

Contexts are stored as .mdc files (markdown with YAML frontmatter) in the out_of_context/contexts/ directory.

File format:

---
name: api-design-notes
created_at: 2025-12-14T12:51:27.123456
type: note
tags: [api, design]
---

# API Design Notes

Key decisions about the REST API design...

- Use RESTful conventions
- Version in URL path

Name requirements:

  • Filename-safe: alphanumeric characters, hyphens, and underscores only

  • Unique: overwriting an existing name replaces the old context (with warning)


Documentation


Key Concepts

  • Context: A markdown document with YAML frontmatter (metadata) and markdown body (content)

  • Name: Agent-recognizable identifier (e.g., "api-design-notes", "bug-fix-context")

  • Storage: Individual .mdc files in out_of_context/contexts/ directory

  • Bulk Operations: Process multiple contexts in a single call (put, get, delete)


Architecture

The server provides a simple file-based storage system built with FastMCP:

Key Components:

  • FastMCP Server: Modern MCP server implementation with middleware support

  • MDCStorage: Manages .mdc file operations (save, load, list, search, delete)

  • CRUD Tools: 5 tool handlers using @mcp.tool() decorators for automatic registration

  • AppStateMiddleware: Dependency injection pattern for clean state management

Storage:

  • Each context is one .mdc file

  • YAML frontmatter for metadata

  • Markdown body for content

  • Simple text-based search


Development

Setup

# Clone repository
git clone <repository-url>
cd out_of_context

# Create environment
hatch env create

# Install dependencies
hatch run update-deps

Run Tests

# Unit tests
hatch run pytest -m 'unit'

# Integration tests
hatch run pytest -m 'integration'

Code Quality

# Lint and format
hatch run lint-fix
hatch run fmt-fix

# Type check
hatch run typecheck

# Full release pipeline
hatch run release

See Development Guide for detailed setup and contribution guidelines.


Project Structure

out_of_context/
├── src/hjeon139_mcp_outofcontext/  # Main package
│   ├── fastmcp_server.py            # FastMCP instance + middleware
│   ├── main.py                      # Entry point
│   ├── tools/
│   │   ├── crud/                    # CRUD operations (put, get, delete)
│   │   └── query/                   # Query operations (list, search)
│   ├── storage/                     # MDC storage layer
│   ├── app_state.py                 # Application state
│   ├── config.py                    # Configuration
│   └── prompts.py                   # MCP prompts
├── tests/                           # Test files (195 tests)
├── docs/                            # Documentation
└── pyproject.toml                   # Project configuration

Contributing

Contributions welcome! Please:

  1. Follow Conventional Commits format

  2. Add tests for new functionality

  3. Update documentation as needed

  4. Run pre-commit checklist before submitting

See Development Guide for detailed contribution guidelines.


License

Apache 2.0 - See LICENSE file for details.


References


Status

Version: 1.0.0 (Launch Release)

Status: Production Ready

Features:

  • ✅ Basic CRUD operations (put, list, get, search, delete)

  • ✅ Markdown file storage (.mdc format)

  • ✅ Agent-recognizable names

  • ✅ Bulk operations support with robust parameter handling

  • ✅ Pydantic validation for type-safe parameters

  • ✅ Automatic JSON schema generation for MCP clients

  • ✅ Text search across metadata and content

  • ✅ Built with FastMCP for improved developer experience


Support

  • Documentation: See docs/ directory

  • Issues: Open an issue on GitHub

  • Questions: Use GitHub Discussions


Acknowledgments

Built with:

Available Tools

5 tools
delete_contextA

Delete context by name (forced eviction by agent). Supports both single and bulk operations.

Single: provide 'name' (str). Bulk: provide 'names' (list[str]) or 'name' as list[str]. For bulk operations, returns list of results with errors for missing contexts.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNo
namesNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions bulk returns errors for missing contexts and 'forced eviction,' but lacks details on reversibility, side effects, or authorization requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with purpose, no wasted words. Efficiently conveys all necessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given an output schema exists (context signal), description doesn't need to detail return format. It covers single/bulk behavior, parameter usage, and error handling. Missing some lifecycle implications but adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description must compensate. It explains that 'name' can be a string or list for bulk, and 'names' is an alternative list parameter. This adds valuable meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Delete' and resource 'context', and distinguishes from siblings (get, list, put, search). It specifies single and bulk operations, making the purpose unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use single vs bulk modes via parameter choice. However, it doesn't explicitly state when not to use this tool or provide alternatives, which would elevate it further.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_contextA

Get context by name. Supports both single and bulk operations.

Single: provide 'name' (str). Bulk: provide 'names' (list[str]) or 'name' as list[str]. Returns context with 'text' (markdown body) and 'metadata' (from frontmatter). For bulk operations, returns list of results with errors for missing contexts.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNo
namesNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description adequately covers behavior: returns context with text and metadata, and for bulk returns list with errors. It does not mention side effects or auth, but as a read operation, this is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with 7 sentences, starting with main purpose, then usage modes, then return format. It is informative without being overly verbose, though could be slightly more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the output schema exists, the description adds valuable context about return fields (text, metadata) and error handling for bulk. The tool is simple retrieval and the description is complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description compensates by explaining the 'name' parameter can be a string or list, and 'names' is a list for bulk. This adds essential meaning beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get context by name' and distinguishes between single and bulk operations. It differentiates from siblings like 'search_context' and 'list_context' by explicitly using retrieval by name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use single vs bulk and what to expect in terms of return format and error handling. However, it does not explicitly state when not to use this tool or mention alternatives among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_contextA

List all contexts, sorted by creation date (newest first).

Returns list of contexts with 'name', 'created_at', and 'preview' (first 100 chars). Optional 'limit' parameter to limit number of results.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Given no annotations, the description explains return fields (name, created_at, preview with first 100 chars), sorting behavior, and optional limit parameter. It lacks details on authentication or rate limits, but for a read-only list operation this is acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences front-load the purpose and sorting, followed by return fields and parameter. No redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, the description provides a useful summary. It covers sorting, return fields, and parameter. A slight gap is lack of distinction from search_context, but otherwise complete for a list tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description explains the 'limit' parameter's purpose and optionality clearly, adding meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb 'List', the resource 'contexts', and the sorting order 'by creation date (newest first)'. This distinguishes it from sibling tools like delete, get, put, and search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for retrieving a list of contexts but does not explicitly state when to use this tool versus alternatives like search_context. No exclusions or when-not-to-use guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

put_contextA

Add or update context by name. Supports both single and bulk operations.

Single: provide 'name' (str), 'text' (str, markdown content), and optional 'metadata' (dict). Bulk: provide 'contexts' (list[dict]) where each dict has 'name', 'text', optional 'metadata'. Names must be filename-safe (alphanumeric, hyphens, underscores). Overwrites existing contexts with a warning. Contexts are stored as .mdc files (markdown with YAML frontmatter).

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNo
textNo
metadataNo
contextsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description discloses key behaviors: naming constraints (filename-safe), overwrite with warning, and storage as .mdc files. This adds significant context beyond the bare schema, though it could mention error handling or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (6 sentences) and well-structured with an initial summary followed by bullet-like points for single and bulk operations. Every sentence adds value, and it is front-loaded with the primary purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that an output schema exists (so return values are covered), the description covers all essential aspects: purpose, usage modes, naming rules, and storage details. It lacks information on limits, error cases, or async behavior, but overall it is sufficiently complete for a focused tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning by explaining the two modes (single with name/text/metadata, bulk with contexts list) and the structure of the contexts items. However, there is a slight inconsistency: the schema marks name and text as optional, but the description implies they are required for single mode.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool adds or updates context by name, supporting both single and bulk operations. It specifies the verb 'Add or update' and the resource 'context', and the purpose is distinct from siblings like delete_context and get_context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for adding or updating context but does not explicitly mention when not to use it or compare with siblings. The guidance is implied through the operation description but lacks explicit alternatives or exclusion criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_contextA

Search contexts by query string.

Searches in both YAML frontmatter (metadata) and markdown body (text content). Returns matching contexts with 'name', 'text', 'metadata', and 'matches' (where query was found). Optional 'limit' parameter to limit number of results.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. Description discloses search scope (frontmatter and body) and return fields but omits details like authentication needs, rate limits, or any side effects beyond read-only nature.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences with purpose immediately stated. No fluff, every sentence adds useful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With output schema existing, return values are covered. Description specifies returned fields. Minor gaps like pagination or case sensitivity, but overall sufficient for a simple search tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description adds value by explaining 'query' is the search string and 'limit' restricts results. No further format details, but adequate for simple parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it searches contexts by query string, covering both frontmatter and body. Differentiates from sibling tools (delete, get, list, put) which are not search-oriented.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage for searching contexts, but lacks explicit when-to-use or when-not-to-use guidance. However, sibling names help differentiate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv1.1.1
    • First observeddelete_context
    • First observedget_context
    • First observedlist_context
    • First observedput_context
    • First observedsearch_context

TDQS

A4.5/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a distinct purpose (delete, get, list, put, search) with no overlap, making it easy for an agent to select the correct one.

Naming Consistency5/5

All tools follow a consistent 'verb_context' pattern in snake_case, ensuring predictable and readable naming.

Tool Count5/5

With 5 tools, the set is well-scoped for managing contexts, covering CRUD and search without unnecessary bloat.

Completeness5/5

The tool surface is complete for the domain: create/update (put), read (get/list), delete, and search—no obvious gaps.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers