MCP server that exposes .context/ folder files as resources in Claude Code
Project description
project-context-mcp
Give Claude Code instant access to your project's institutional knowledge.
An MCP server that makes your project documentation instantly accessible in Claude Code through @ mentions. Create a .context/ folder, add your docs, and watch Claude become an expert on your codebase.
The Problem
You're working with Claude Code on a complex project. Claude is smart, but it doesn't know:
- Your team's coding conventions
- Why you chose that weird architecture
- The gotchas in your database schema
- Your API design patterns
- That one thing that breaks if you don't do it just right
You end up copy-pasting the same context into every conversation. Or worse, Claude makes suggestions that violate your project's conventions.
The Solution
Create a .context/ folder in your project. Drop in your documentation. Now when you type @ in Claude Code, your context files appear right alongside your source files:
┌─────────────────────────────────────────────────────────────┐
│ > Help me add a new API endpoint @ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Suggestions: │ │
│ │ 📄 src/api/routes.py │ │
│ │ 📄 src/models/user.py │ │
│ │ 📘 architecture.md <- Your context! │ │
│ │ 📘 api-patterns.md <- Your context! │ │
│ │ 📘 conventions.md <- Your context! │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
One @api-patterns.md mention and Claude knows exactly how you structure endpoints.
Quick Start
1. Install the MCP server (one time)
claude mcp add project-context -s user -- uvx project-context-mcp
That's it. The server is now available in all your Claude Code sessions.
2. Create a .context/ folder in your project
my-project/
├── .context/ <- Create this folder
│ ├── architecture.md
│ ├── conventions.md
│ └── api-patterns.md
├── src/
├── tests/
└── ...
3. Use @ to include context
> Help me refactor this function @conventions.md
> Add a new database table @database-schema.md @naming-conventions.md
> Why is this test failing? @architecture.md @testing-patterns.md
What to Put in .context/
Your .context/ folder is for institutional knowledge — the stuff that isn't obvious from reading the code.
Recommended Files
| File | What to Include |
|---|---|
architecture.md |
System overview, component relationships, data flow diagrams |
conventions.md |
Coding standards, naming conventions, file organization |
api-patterns.md |
Endpoint structure, authentication, error handling patterns |
database-schema.md |
Table relationships, naming conventions, migration patterns |
testing-patterns.md |
Test organization, mocking strategies, fixture patterns |
deployment.md |
Environment setup, deployment procedures, rollback steps |
gotchas.md |
Known issues, workarounds, "don't do this" warnings |
glossary.md |
Domain-specific terms, abbreviations, business logic |
Example: conventions.md
# Coding Conventions
## Naming
- Files: `snake_case.py`
- Classes: `PascalCase`
- Functions: `snake_case`
- Constants: `UPPER_SNAKE_CASE`
## Error Handling
- Use custom exceptions from `src/exceptions.py`
- Always log with context: `logger.error("Failed to process", extra={"user_id": id})`
- API endpoints return `{"error": {"code": "...", "message": "..."}}`
## Testing
- One test file per module: `test_<module_name>.py`
- Use fixtures from `conftest.py`, don't create new ones without discussion
- Mock external services, never hit real APIs in tests
Example: architecture.md
# Architecture Overview
## System Components
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Next.js │────▶│ FastAPI │────▶│ PostgreSQL │
│ Frontend │ │ Backend │ │ Database │
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐
│ Redis │
│ Cache │
└─────────────┘
## Key Design Decisions
1. **Why FastAPI over Flask?**
- Native async support for high-concurrency endpoints
- Automatic OpenAPI documentation
- Pydantic validation built-in
2. **Why Redis for caching?**
- Session storage for horizontal scaling
- Rate limiting with sliding windows
- Pub/sub for real-time features
Supported File Types
The server exposes files with these extensions:
| Category | Extensions |
|---|---|
| Documentation | .md, .txt, .rst, .asciidoc, .adoc |
| Data/Config | .yaml, .yml, .json, .toml, .xml, .csv, .ini, .cfg, .conf |
| Code Examples | .py, .js, .ts, .jsx, .tsx, .html, .css, .sql, .sh |
Automatically excluded: Hidden files (.foo), __pycache__, node_modules, .git, .DS_Store
Features
Smart Resource Names
The server extracts human-readable names from your files:
- Markdown files: Uses the first
# Headingas the name - Other files: Converts filename to title case (
api-patterns.md→ "Api Patterns")
Automatic Descriptions
First paragraph of each file becomes the description shown in autocomplete, helping you pick the right context quickly.
Nested Folders
Organize complex documentation with subfolders:
.context/
├── architecture.md
├── api/
│ ├── authentication.md
│ ├── pagination.md
│ └── error-codes.md
├── database/
│ ├── schema.md
│ └── migrations.md
└── frontend/
├── components.md
└── state-management.md
All files are discovered recursively and accessible via @.
Zero Configuration
No config files. No setup. No environment variables. Just create .context/ and go.
How It Works
┌──────────────────┐ ┌─────────────────────┐
│ Claude Code │◀───────▶│ project-context-mcp │
│ │ MCP │ │
│ You type: @ │ Protocol│ 1. Finds .context/ │
│ │ │ 2. Lists all files │
│ Server returns │◀────────│ 3. Returns as │
│ your docs as │ │ MCP resources │
│ suggestions │ │ │
└──────────────────┘ └─────────────────────┘
- On startup: MCP server checks current directory for
.context/ - On
@keystroke: Claude Code requests available resources - Server responds: List of files with names, descriptions, and URIs
- On selection: File content is fetched and included in your prompt
URI Scheme
Resources use the context:// scheme:
.context/architecture.md→context://architecture.md.context/api/patterns.md→context://api/patterns.md
Use Cases
Onboarding New Team Members
Share your .context/ folder in your repo. New developers get the same Claude experience as veterans — Claude knows the conventions from day one.
Enforcing Consistency
Instead of hoping everyone remembers the coding standards, put them in .context/conventions.md. Claude will suggest code that matches your patterns.
Complex Domains
Working in healthcare? Finance? Legal tech? Put your domain glossary and business rules in .context/. Claude won't confuse your specific terminology.
Legacy Codebases
Document the "why" behind legacy decisions. When Claude suggests a refactor, you can include @legacy-decisions.md to explain constraints.
Multi-Service Architecture
Keep architecture docs in context. Claude can help you make changes that respect service boundaries and communication patterns.
Comparison
| Approach | Pros | Cons |
|---|---|---|
| Copy-paste context | No setup | Tedious, inconsistent, clutters prompt |
| CLAUDE.md file | Auto-included | Single file, always included even when not relevant |
.context/ folder |
Organized, selective, discoverable | Requires explicit @ mention |
This tool is ideal when you have multiple context documents and want to selectively include the relevant ones for each task.
Installation Options
Recommended: uvx (no install needed)
claude mcp add project-context -s user -- uvx project-context-mcp
Alternative: pip install
pip install project-context-mcp
claude mcp add project-context -s user -- project-context-mcp
Development: from source
git clone https://github.com/ericbrown/project-context-mcp.git
cd project-context-mcp
pip install -e .
claude mcp add project-context -s user -- python -m project_context_mcp.server
Troubleshooting
Context files not appearing?
- Check the folder name: Must be exactly
.context/(with the dot) - Check file extensions: Only supported types are included
- Restart Claude Code: MCP servers initialize on startup
- Check server is registered: Run
claude mcp list
Want to see what's discovered?
Run the server directly to see logs:
cd your-project
python -m project_context_mcp.server
You'll see:
INFO:project-context-mcp:Starting project-context-mcp server
INFO:project-context-mcp:Working directory: /path/to/your-project
INFO:project-context-mcp:Looking for context in: /path/to/your-project/.context
INFO:project-context-mcp:Found 5 context resources
Contributing
Contributions welcome! Ideas for improvements:
- File watching for hot reload
-
context.yamlmanifest for custom metadata - Search tool to find content across context files
- Support for remote context (URLs, Notion, Confluence)
- Team sync via cloud storage
Development Setup
git clone https://github.com/ericbrown/project-context-mcp.git
cd project-context-mcp
pip install -e .
Running Tests
cd examples/sample-project
python -m project_context_mcp.server
License
MIT License — see LICENSE for details.
Related
- Model Context Protocol — The protocol this server implements
- Claude Code — Anthropic's CLI for Claude
- MCP Servers — Other MCP server implementations
Built for developers who are tired of repeating themselves.
Star this repo if it saves you time!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file project_context_mcp-1.0.0.tar.gz.
File metadata
- Download URL: project_context_mcp-1.0.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e456bb8d123c3facdab44852c193547964d44532038d5458831359eb78a8b7c5
|
|
| MD5 |
a61f8ef5cce282fdfcb2352e9dfd37e6
|
|
| BLAKE2b-256 |
b9b1af763709b4d76f9ba222fd1357e44872e2ccd8c055f9636d86f16c983917
|
Provenance
The following attestation bundles were made for project_context_mcp-1.0.0.tar.gz:
Publisher:
publish.yml on ericbrown/project-context-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
project_context_mcp-1.0.0.tar.gz -
Subject digest:
e456bb8d123c3facdab44852c193547964d44532038d5458831359eb78a8b7c5 - Sigstore transparency entry: 823930579
- Sigstore integration time:
-
Permalink:
ericbrown/project-context-mcp@d43885473e0278cb2e0c125b7312433116d74ccb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ericbrown
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d43885473e0278cb2e0c125b7312433116d74ccb -
Trigger Event:
push
-
Statement type:
File details
Details for the file project_context_mcp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: project_context_mcp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b4fe1fc2d186357acf194e51d16193a0d2475a21c3b01c1f2956c646ad39cf4
|
|
| MD5 |
e27e15f5fee0a87acdc7dfd3aaf3f739
|
|
| BLAKE2b-256 |
727dd3fcf500613eb126a9898794aab6209ba5b481486a1af1c2afd51675e66e
|
Provenance
The following attestation bundles were made for project_context_mcp-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on ericbrown/project-context-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
project_context_mcp-1.0.0-py3-none-any.whl -
Subject digest:
0b4fe1fc2d186357acf194e51d16193a0d2475a21c3b01c1f2956c646ad39cf4 - Sigstore transparency entry: 823930697
- Sigstore integration time:
-
Permalink:
ericbrown/project-context-mcp@d43885473e0278cb2e0c125b7312433116d74ccb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ericbrown
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d43885473e0278cb2e0c125b7312433116d74ccb -
Trigger Event:
push
-
Statement type: