dynamic-context-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dynamic-context-mcpget context for src/components/Button.tsx"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Dynamic Context MCP Server
A Model Context Protocol (MCP) server that injects "Just-in-Time" context into AI conversations based on file paths and glob patterns.
🚀 What is this?
When coding with AI, you often have specific guidelines, architectural patterns, or database schemas that apply only to certain parts of your codebase.
Dynamic Context MCP allows you to define these rules in Markdown files with glob pattern headers. When the AI agent (like Claude or Gemini) looks at a specific file path, this tool automatically injects the relevant context for that file.
Example Flow:
You are working on
src/backend/api.ts.The AI calls this tool with that path.
This server finds
backend-guidelines.md(which matchessrc/backend/**/*.ts).The server also finds
general-ts-guidelines.md(which matches*.ts)It combines all matching context files and delivers the result to your AI agent before it generates code
Related MCP server: Filesystem MCP Server
📦 usage
Quick Start (instead of manual setup)
Run the init command to automatically detect your framework (Laravel, Next.js, Python), create starter rules in .agent/rules, and append (NOT OVERWRITE) your primary context files (like GEMINI.md, CLAUDE.md, or .cursorrules) with the necessary instructions.
npx dynamic-context-mcp init1. Prepare your Context Directory
Create a folder (default is .agent/rules) in your project root. Add markdown files with YAML frontmatter containing globs (either a single string or a list).
Example 1: Single Glob
File: .agent/rules/styles.md
---
trigger: glob
globs: "**/*.css"
---
# CSS Rules
- Use flexbox layout.Example 2: Multiple Globs & Brace Expansion
File: .agent/rules/frontend.md
---
trigger: glob
globs:
- "src/helpers/**/*.ts"
- "resources/js/**/*.{vue,ts}" # Matches both .vue and .ts files
---
# Frontend Rules
- Ensure strict type checking.
- Prefer Composition API for Vue files.Example 3: Always Trigger
Use this for high-level rules that should apply to every file, such as general coding standards or project philosophy.
File: .agent/rules/general.md
---
trigger: always
---
# General Guidelines
- Write clean, commented code.
- Follow SOLID principles.2. Configure your AI Client
Add this to your MCP configuration file (e.g., claude_desktop_config.json):
{
"mcpServers": {
"dynamic-context": {
"command": "npx",
"args": [
"-y",
"dynamic-context-mcp",
"/optional/absolute/path/to/your/project/.agent/rules"
]
}
}
}Note: The last argument is optional. If omitted, it looks for .agent/rules in the directory where the MCP server runs.
3. IMPORTANT: Agent Configuration
To ensure your AI agent uses this tool effectively, add the following instruction to your agent's system prompt or custom instructions (e.g., in GEMINI.md, CLAUDE.md, or your agent's settings):
<!-- DYNAMIC CONTEXT MCP GUIDELINES START -->
<CRITICAL_INSTRUCTION>
## DYNAMIC CONTEXT INSTRUCTIONS
This project uses dynamic context mcp to deliver "just in time" context for files that you are about to read, create, or edit.
**CRITICAL GUIDANCE**
- Before you read, create, or edit a file, check for dynamic context by requesting the `dynamic-context.get_context_for_file` tool with the file path as input.
- If dynamic context is available, read it carefully to understand important details about how to work with that file.
- dynamic context mcp takes a file path as input and goes through all context files that match that path (by glob patterns) to compile relevant context for that file
- file paths must be relative to the project root i.e. `resources/js/components/MyComponent.vue` and NOT `/absolute/path/to/project/resources/js/components/MyComponent.vue`
- dynamic context mcp does NOT take a folder path as input. If no file exists at that path, then you can create a fake file name and extension like `path/to/fakefile.txt` to check for context for that folder.
- Group context for files that have the same path and extension. If you are working with multiple files that have the same path and extension then assume that the compiled context is the same every time and use the same context for all of them.
</CRITICAL_INSTRUCTION>
<!-- DYNAMIC CONTEXT MCP GUIDELINES END -->🛠 Local Development
If you want to modify or contribute to this project:
Clone the repo:
git clone [https://github.com/yourusername/dynamic-context-mcp.git](https://github.com/yourusername/dynamic-context-mcp.git) cd dynamic-context-mcpInstall dependencies:
npm installBuild the project:
npm run buildTest locally: You can run the compiled script directly:
node dist/index.js ./path/to/test/context-folder
🤝 Contributing
Contributions are welcome!
Fork the Project
Create your Feature Branch (
git checkout -b feature/AmazingFeature)Commit your Changes (
git commit -m 'Add some AmazingFeature')Push to the Branch (
git push origin feature/AmazingFeature)Open a Pull Request
📄 License
Distributed under the MIT License.
Available Tools
1 toolget_context_for_fileA
Retrieves coding guidelines and context based on the file path provided. Call this before editing code.
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | The file or folder path you are about to edit or create |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. 'Retrieves' implies a read operation, but no details on side effects, permissions, or return structure. Adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with purpose, no wasted words. Efficient and clear.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simple tool (1 param, no siblings, no output schema), the description fully covers purpose and usage. No gaps for intended function.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline 3. The description adds no extra meaning beyond what the schema provides for 'filePath'.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves coding guidelines and context based on a file path, with a specific verb and resource. No sibling tools exist, so no differentiation needed.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly advises 'Call this before editing code,' providing clear when-to-use guidance. No sibling tools to contrast.
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. Dates show when Glama detected each change.
1 tool update
v1.0.12- First observed
get_context_for_file
TDQS
Only one tool exists, so there is no possibility of confusion between tools. The tool's purpose is clearly described.
With a single tool, naming consistency is not an issue. The name 'get_context_for_file' follows a clear snake_case verb_noun pattern.
A single tool is thin for most servers, but may be acceptable if the server's sole purpose is to retrieve context for a file path. However, it feels minimal.
The server covers only one operation (getting context). Missing operations like listing contexts, setting contexts, or clearing contexts create significant gaps for a complete context management surface.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Share one project context across ChatGPT, Claude, Telegram and any MCP client.
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseBqualityFmaintenanceA Model Context Protocol server that enables LLMs to read, search, and analyze code files with advanced caching and real-time file watching capabilities.61939MIT
- FlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that extends AI capabilities by providing file system access and management functionalities to Claude or other AI assistants.2425-
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).1123Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that analyzes application codebases with real-time file watching, providing AI assistants like Claude with deep insights into project structure, code patterns, and architecture.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nathanbarrett/dynamic-context-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server