Local Context
An MCP server that helps AI assistants work with GoLang third-party packages using your local Go module cache.
Installation
npx mcp-local-contextAsk AI about Local Context
Powered by Claude Β· Grounded in docs
I know everything about Local Context. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
mcp-local-context
What is it and why use this?
An MCP server that helps AI assistants work with GoLang third-party packages using your local Go module cache. Think of it as a free, local alternative to Context7.
- Free and unlimited - uses your existing GoLang cache, no API limits or costs
- Works with any module - supports public and private modules already in your cache
- Universal compatibility - works with all AI tools (Cursor, Claude, GitHub Copilot, etc.)
- Customizable - add your own prompts and instructions for AI agents
Quick Start
# Install
go install github.com/svetlyi/mcp-local-context@latest
# Find binary path
echo $(go env GOPATH)/bin/mcp-local-context
Add to your IDE (e.g., Cursor): Settings β MCP Servers β Add:
{
"mcpServers": {
"local-context": {
"command": "/path-to-the-binary/bin/mcp-local-context"
}
}
}
The server communicates via stdio (standard input/output).
Features
- Built-in & Custom Prompts: Built-in Go context prompt with automatic discovery of custom prompt files from
~/.mcp-local-context/prompts/*.md - Configurable & Extensible: JSON configuration file and easily add new prompt providers (e.g., JavaScript, Python)
Configuration (optional)
Create ~/.mcp-local-context/config.json (optional):
{
"log_level": "info",
"log_file": "~/mcp-local-context.log",
"custom_prompt_dirs": ["~/custom-prompts", "/path/to/other/prompts"]
}
Options:
log_level:debug,info,warn,error(default:info)log_file: Path to log file (supports~/expansion). Default: OS temp filecustom_prompt_dirs: Additional directories for custom prompts. The~/.mcp-local-context/prompts/directory is always included
Custom Prompts
Place Markdown files in ~/.mcp-local-context/prompts/. Each .md file is automatically discovered and loaded.
Prompt Configuration
You can configure prompts using key-value pairs at the start of the file. The configuration section ends with a blank line.
Supported configuration keys:
title: Custom title/description for the promptlang: Language identifier (e.g.,go,javascript,python)
Example with configuration: ~/.mcp-local-context/prompts/my-custom-prompt.md
title: My Custom Prompt Title
lang: go
# My Custom Prompt
This is my custom prompt that will be provided to AI assistants.
Example without configuration: ~/.mcp-local-context/prompts/simple-prompt.md
A description of my custom prompt.
# My Custom Prompt
This is my custom prompt that will be provided to AI assistants.
Note: If
titleis not specified, the first line is used as the prompt description. If the first line is a markdown heading (#), the heading markers are automatically removed.
The prompt will be available as a prompt named my-custom-prompt (derived from the filename) with the configured title or extracted description.
Usage
How to use
You can use the MCP in two ways:
Method 1: Directly reference a specific prompt
Manually invoke a specific prompt by name. This gives you precise control over which instructions are used.
For example, in Cursor, you can write:
Create something in Go, use the /local_context/golang-context-rule prompt
Method 2: Ask the AI to use the MCP tools
Ask the AI to use the MCP's automatic language detection tools. The AI will call list_supported_languages and then get_context_instructions with the appropriate language, which automatically provides the right context instructions.
For example:
Create something in Go, use the local-context MCP to get context instructions for Go
or more generally:
When working with third-party packages, use the local-context MCP to get the appropriate context instructions
Available Prompts
golang-context-rule
Systematic approach for working with third-party Go packages using the Go module cache. Guides AI assistants to:
- Identify the exact module version from
go.mod - Locate the Go module cache
- Explore the package structure
- Use
go docfor documentation - Read source code directly
Future work
- Module indexing: Index existing modules to find appropriate functionality more efficiently based on the task
- More languages: Add support for other languages, such as JavaScript, etc.
License
MIT License - see LICENSE file for details.
Contributing
π€ Contributions are welcome! Please feel free to submit a Pull Request.
