Package Exports
- mcp-prompt-fetcher
- mcp-prompt-fetcher/server.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mcp-prompt-fetcher) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
MCP Prompt Fetcher
A powerful MCP (Model Context Protocol) server that provides intelligent development prompts for Cursor, VS Code, and other IDE tools. Supports GitHub, GitLab, and local directory sources with automatic platform detection.
๐ Features
- ๐ Multi-Platform Support: GitHub, GitLab, and local directories
- โก Auto-Detection: Automatically detects platform from
PROMPT_PATH - ๐ Unified Authentication: Single
GIT_TOKENfor both GitHub and GitLab - ๐๏ธ Flexible Dialogs: Native system dialogs and web-based interfaces
- ๐ฆ Zero Configuration: Works out-of-the-box with intelligent defaults
- ๐ Smart Caching: Optimized remote file fetching with TTL-based caching (3-hour default)
- โก Lazy Loading: Prompt content loaded on-demand to minimize API calls
- ๐ก๏ธ Rate Limit Protection: Automatic fallback to cached data and graceful degradation
- ๐ฏ Efficient API Usage: Only fetches file lists on startup, content on tool invocation
- ๐ Cross-Platform: Full macOS and Linux compatibility
๐ฆ Installation
# Install globally (recommended)
npm install -g mcp-prompt-fetcher
# Or install locally
npm install mcp-prompt-fetcherโ๏ธ Quick Setup
1๏ธโฃ Simple Configuration (Only 2 environment variables needed!)
Add to your IDE's MCP configuration file (e.g., ~/.cursor/mcp.json):
GitHub Repository
{
"mcpServers": {
"mcp-prompt-fetcher": {
"command": "mcp-prompt-fetcher",
"env": {
"PROMPT_PATH": "username/repository",
"GIT_TOKEN": "ghp_your_github_token_here"
}
}
}
}GitLab Repository
{
"mcpServers": {
"mcp-prompt-fetcher": {
"command": "mcp-prompt-fetcher",
"env": {
"PROMPT_PATH": "https://gitlab.com/group/project",
"GIT_TOKEN": "glpat-your_gitlab_token_here"
}
}
}
}Local Directory
{
"mcpServers": {
"mcp-prompt-fetcher": {
"command": "mcp-prompt-fetcher",
"env": {
"PROMPT_PATH": "/path/to/your/prompts"
}
}
}
}Local Test by Source
{
"osp-prompt": {
"command": "node",
"args": [
"/Users/penuel/workspace_script/osp-prompt/dev-mcp/server.js"
],
"env": {
"PROMPT_PATH": "https://gitlab.com/test-group/test-repo/-/tree/master",
"GIT_TOKEN": "your-actual-git-token",
"CACHE_TTL_SEC": "10800",
"AUTOMATED_MODE": "false",
"DEBUG_LOG": "true"
}
}
}2๏ธโฃ Universal URL Parser - Handle Any Complex URL!
Our advanced URL parser supports any complex GitLab and GitHub repository structure:
Complex URL Examples That Work:
# GitLab with multi-level projects and complex branches
"https://gitlab.com/Keccac256-evg/opensocial/osp-prompt/-/tree/master/dev-arch"
"https://gitlab.com/group/subgroup/project/-/tree/feature/new-ui/src/components"
"https://gitlab.com/company/team/service/-/tree/v1.2.3/docs/api"
# GitHub with deep nested paths and feature branches
"https://github.com/feast-dev/feast/tree/master/examples/java-demo/feature_repo/data"
"https://github.com/microsoft/vscode/tree/main/src/vs/editor/contrib"
"https://github.com/facebook/react/tree/feature/concurrent/packages/react/src"Auto-Detection Results:
| PROMPT_PATH Format | Platform | Parsed As |
|---|---|---|
user/repo |
GitHub | user/repo@main:dev-arch |
https://github.com/owner/repo/tree/branch/path/to/files |
GitHub | owner/repo@branch:path/to/files |
https://gitlab.com/group/project/-/tree/branch/path |
GitLab | group/project@branch:path |
https://gitlab.com/a/b/c/-/tree/feature/x/deep/nested/path |
GitLab | a/b/c@feature/x:deep/nested/path |
/absolute/path |
Local | Local filesystem |
./relative/path |
Local | Local filesystem |
Smart Features:
- โ
Multi-level projects:
group/subgroup/project - โ
Complex branch names:
feature/new-ui,hotfix/urgent-fix - โ
Deep file paths:
src/main/java/com/example/service - โ
Version tags:
v1.2.3,release/2024.1 - โ Automatic API URL generation for both platforms
๐ Usage
Once configured, the following tools become available in your IDE:
dev-feature- ๐ Complete feature development (TDD workflow)dev-design- ๐ System architecture design and planningdev-refactor- ๐ง Code refactoring and optimizationdev-small- โก Quick development and bug fixesdev-tests- ๐งช Test coverage implementation (90%+ coverage)dev-bugfix- ๐ Precise problem analysis and minimal-impact fixesdev-manual- ๐ Manual development type selectiondev-feedback- ๐ Interactive step-by-step confirmation
Command Examples
dev-feature: Implement user authentication with email/phone login
dev-design: Design microservices architecture for e-commerce platform
dev-refactor: Improve code readability in user management module
dev-small: Fix login button display issue in Safari browser
dev-tests: Achieve 90%+ test coverage for user registration feature
dev-bugfix: Debug intermittent session loss during user login๐ง Environment Variables
| Variable | Default | Description |
|---|---|---|
PROMPT_PATH |
(required) | Platform will be auto-detected from this path |
GIT_TOKEN |
(required for remote) | GitHub (ghp_...) or GitLab (glpat-...) token |
DIALOG_MODE |
auto |
Dialog mode: auto|native|browser |
AUTOMATED_MODE |
true |
false=interactive confirmation, true=auto-execute |
CACHE_TTL_SEC |
86400 |
Cache TTL in seconds (24 hours) |
FORCE_UPDATE |
false |
true=force remote fetch, bypass cache |
DEBUG_LOG |
false |
Enable detailed logging |
๐งช Testing
Verify Installation
# Test local mode
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | PROMPT_PATH="./dev-arch" mcp-prompt-fetcher
# Test GitHub mode
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | PROMPT_PATH="user/repo" GIT_TOKEN="your_token" mcp-prompt-fetcher
# Test GitLab mode
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | PROMPT_PATH="https://gitlab.com/group/project" GIT_TOKEN="your_token" mcp-prompt-fetcherRun Test Suite
npm testinstall npm
<!-- ่ชๅจ้ๅขๆๅ
ๅนถๆgit tag -->
npm version patch|minor|major
<!-- ๆฌๅฐๆๅ
ๆฅ็ๅณๅฐๅๅธ็ๅ
ๅฎน -->
npm pack --dry-run
<!-- ่ทๆต่ฏ + ๅฎก่ฎก่ๆฌ -->
npm run test:all
npm run audit:security
<!-- ๅๅธๅ
-->
npm publish --access public
<!-- ๆฅ็็ปๆ -->
npm info mcp-prompt-fetcher๐ Directory Structure
For local mode, your prompt directory should contain .prompt.md files:
dev-arch/
โโโ feature.prompt.md # โ dev-feature tool
โโโ design.prompt.md # โ dev-design tool
โโโ refactor.prompt.md # โ dev-refactor tool
โโโ small.prompt.md # โ dev-small tool
โโโ tests.prompt.md # โ dev-tests tool
โโโ bugfix.prompt.md # โ dev-bugfix tool๐ฏ Best Practices
Recommended Configurations
| Use Case | Configuration | Benefits |
|---|---|---|
| Local Development | Local mode + Native dialogs | Fast response, offline ready |
| Team Collaboration | Remote mode + Browser dialogs | Beautiful UI, centralized management |
| CI/CD Pipeline | Remote mode + AUTOMATED_MODE=true |
No GUI dependencies |
| Step-by-Step Development | Any mode + AUTOMATED_MODE=false |
Interactive confirmation |
Token Permissions
GitHub Token Requirements:
public_repo(for public repositories)repo(for private repositories)
GitLab Token Requirements:
read_repositoryread_api
๐ Troubleshooting
Common Issues
| Problem | Symptoms | Solution |
|---|---|---|
| Tools not responding | Click tool, no response | 1. Check MCP config syntax 2. Restart IDE 3. Verify token validity |
| Dialog not showing | Tool calls but no GUI | 1. Check DIALOG_MODE setting2. Try browser mode 3. Check system permissions |
| Invalid content returned | Wrong prompt content | 1. Check repository permissions 2. Verify branch and file paths 3. Clear cache |
| API Rate Limit (429 errors) | Service starts with basic tools only | Normal behavior - basic tools work offline, cached content used when available |
| Slow first-time loading | Long delay on first tool call | Expected - prompt content fetched on-demand, then cached for 3 hours |
Cache Management
# Clear cache
rm -rf ~/.cache/prompts/*.md
# Or force update
export FORCE_UPDATE=trueDebug Mode
Set DEBUG_LOG=true to see detailed execution logs for troubleshooting.
๐ API Reference
MCP Methods
initialize- MCP protocol handshaketools/list- Get available tools (config-driven)tools/call- Execute specific tool
Tool Schema
Each tool follows this input schema:
{
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "Development requirements or task description"
}
},
"required": ["source"]
}๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
- Documentation: Check this README and inline code comments
- Issues: GitHub Issues
- Discussions: GitHub Discussions
๐ Happy Coding with Intelligent Prompts!