Matías Context MCP
A thin, local, read-only MCP gateway that exposes governed context documents and producer manifests as logical resources, enabling AI clients to access them without arbitrary filesystem access.
README
Matías Context MCP
A thin, local, read-only MCP gateway over an existing ecosystem of governed context documents and producer manifests.
The gateway exposes logical resources through MCP without granting arbitrary filesystem access or duplicating the source systems' contracts.
Why this exists
The underlying systems already produce and govern:
- context-source metadata;
- integration contracts;
- run records;
- manifests;
- evidence-selection artifacts;
- provenance and checksums.
Before this gateway, every AI client needed repository-specific path knowledge and custom adapters.
This project adds a narrow MCP interface:
MCP client
→ logical resource URI
→ registry lookup
→ authorization
→ canonical path containment
→ bounded read
→ normalization
→ provenance-rich response
The source repositories remain authoritative.
Current status
resource-only v0.1 MVP: CLOSED
Working:
- Python MCP server over local
stdio; - MCP initialization and capability negotiation;
- resources capability only;
- generated four-source catalog;
- source descriptors;
- governed context-document reads;
- explicit logical-document mappings;
- canonical root-containment checks;
- symlink-escape rejection;
- bounded UTF-8 Markdown and JSON reads;
- SHA-256, size, authority and modification metadata;
- deterministic domain errors;
- real read from KB Contracts;
- everyday and acceptance-probe MCP clients over real
stdiosessions; - no tools, prompts, writes or arbitrary filesystem access.
Resource namespace
matias-context://catalog/sources
matias-context://source/{source_id}
matias-context://source/{source_id}/document/{document_id}
matias-context://manifest/{producer_id}/{manifest_id}
The client never supplies or receives a physical filesystem path.
Integrated systems
| Source | Gateway role |
|---|---|
| Context Routing | Published routing projection |
| KB Contracts | Authoritative integration contracts |
| Knowledge Inspect | Run and manifest producer |
| KB Artifacts | Governed evidence-selection producer |
Trust boundary
The gateway is structurally read-only.
It does not provide:
- raw path parameters;
- recursive directory browsing;
- arbitrary filesystem reads;
- shell or subprocess execution;
- SQL;
- vector-store access;
- repository mutations;
- manifest repair;
- pipeline execution;
- prompts, tools, sampling or elicitation;
- HTTP transport or cloud deployment.
Every filesystem-backed read passes through:
- strict URI parsing;
- registry lookup;
- explicit logical mapping;
- canonical path resolution;
- root-containment validation;
- regular-file and format checks;
- size enforcement;
- bounded binary reading;
- strict UTF-8 and format normalization.
Requirements
- Python 3.10+
- MCP Python SDK 1.28.1
- local checkouts of the configured sources
Installation
python3 -m pip install -e '.[dev]'
Configuration
The server reads a server-owned JSON mount configuration:
export MATIAS_CONTEXT_GATEWAY_CONFIG="$PWD/config/sources.example.json"
export CONTEXT_ROUTING_ROOT="$HOME/repos/context"
export KB_CONTRACTS_ROOT="$HOME/repos/kb-contracts"
export KNOWLEDGE_INSPECT_ROOT="$HOME/repos/knowledge-inspect"
export KB_ARTIFACTS_ROOT="$HOME/repos/gpt-digests"
These roots are operator configuration. They are not MCP client roots and cannot be changed by a client.
Run the server
python3 -m matias_context_mcp
The server uses MCP over stdio. Protocol traffic is the only permitted output on stdout; operational diagnostics go to stderr.
Read resources from the shell
mctx is the everyday client. Each command starts the configured server, initializes a real MCP session, performs one resource operation, and prints formatted JSON to stdout:
mctx list
mctx templates
# Catalog and source descriptor
mctx read 'matias-context://catalog/sources'
mctx read 'matias-context://source/kb-contracts'
# Governed context document
mctx read \
'matias-context://source/knowledge-inspect/document/artifact-surface'
# Producer manifests (replace IDs with configured, existing run IDs)
mctx read \
'matias-context://manifest/knowledge-inspect/2026-07-27T180000Z'
mctx read \
'matias-context://manifest/kb-artifacts/selection-2026-07-27T180000Z'
# Extract the normalized document body
mctx read \
'matias-context://source/knowledge-inspect/document/artifact-surface' \
| jq -r '.data.text'
# Ordinary shell redirection remains available to the operator
mctx read 'matias-context://catalog/sources' > catalog.json
Successful resource envelopes go to stdout; diagnostics, server logs, and structured failures go to stderr. The client itself does not create output files—the final example uses shell redirection explicitly.
Diagnostic and acceptance clients
The three command surfaces have deliberately different purposes:
scripts/read_resource.py
direct kernel diagnostic
mctx
everyday real-MCP client
scripts/probe_mcp.py
full acceptance and evidence probe
For a direct kernel diagnostic:
python3 scripts/read_resource.py \
'matias-context://catalog/sources'
python3 scripts/read_resource.py \
'matias-context://source/kb-contracts/document/manual-overview'
For the acceptance and evidence probe:
python3 scripts/probe_mcp.py \
--output-dir artifacts/mvp-evidence
The probe records machine-readable initialization, capabilities, listed resources, templates, successful reads and rejection evidence.
Tests
python3 -m pytest -q
Architecture
Thin MCP facade
|
v
Resource kernel
├── frozen exposure profile
├── source registry
├── URI resolver
├── policy gate
├── bounded filesystem adapter
└── normalizer
|
v
Explicitly mounted source roots
The kernel does not import MCP SDK types and can be reused by a CLI or another transport.
Design choices
- resources before tools;
- local
stdiobefore remote transport; - explicit mappings before dynamic discovery;
- producer-owned manifests before a universal gateway schema;
- bounded reads before broad format support;
- fail closed rather than guess;
- thin adapter rather than a new knowledge platform.
Related systems
- KB Contracts: https://github.com/matuteiglesias/kb-contracts
- Knowledge Inspect: https://github.com/matuteiglesias/knowledge-inspect
- KB Artifacts: https://github.com/matuteiglesias/gpt-digests
Portfolio summary
Designed and implemented a read-only MCP gateway over an existing ecosystem of governed context sources and producer manifests. The gateway uses logical resource URIs, explicit allowlists, canonical path containment, bounded reads, provenance-rich responses and a transport-independent kernel. It is validated end to end with a real MCP client over local stdio, including capability negotiation and unauthorized-access rejection.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。