octocode-mcp 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -515
- package/build/index.js +43 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Octocode MCP
|
|
2
2
|
|
|
3
|
-
**AI-
|
|
3
|
+
**The Perfect AI Code Assistant - Advanced Search & Discovery Across GitHub & NPM**
|
|
4
4
|
|
|
5
5
|
<div>
|
|
6
6
|
<img src="./assets/logo.png">
|
|
@@ -10,590 +10,208 @@
|
|
|
10
10
|
[](https://modelcontextprotocol.io/)
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
- [✨ Overview](#-overview)
|
|
16
|
-
- [A New Take on Code Discovery MCP](#a-new-take-on-code-discovery-mcp)
|
|
17
|
-
- [🧠 AI-First Architecture](#-ai-first-architecture)
|
|
18
|
-
- [🔄 Intelligent Tool Chaining](#-intelligent-tool-chaining)
|
|
19
|
-
- [🎯 Smart Discovery Features](#-smart-discovery-features)
|
|
20
|
-
- [💡 Background & Motivation](#-background--motivation)
|
|
21
|
-
- [🔄 A Tool That Built Itself](#-a-tool-that-built-itself)
|
|
22
|
-
- [🎯 Innovation: NPM-Driven Repository Discovery](#-innovation-npm-driven-repository-discovery)
|
|
23
|
-
- [🌟 Example Use Cases](#-example-use-cases)
|
|
24
|
-
- [🎯 Features](#-features)
|
|
25
|
-
- [For Developers](#for-developers)
|
|
26
|
-
- [For Engineering Managers](#for-engineering-managers)
|
|
27
|
-
- [🛠 Available Tools](#-available-tools)
|
|
28
|
-
- [🔍 GitHub Code & Repository Search](#-github-code--repository-search)
|
|
29
|
-
- [📦 NPM & Package Ecosystem](#-npm--package-ecosystem)
|
|
30
|
-
- [📋 Development History & Collaboration](#-development-history--collaboration)
|
|
31
|
-
- [👥 User & Organization Management](#-user--organization-management)
|
|
32
|
-
- [🎯 Smart Features](#-smart-features)
|
|
33
|
-
- [📚 Usage Examples](#-usage-examples)
|
|
34
|
-
- [Basic Code Discovery](#basic-code-discovery)
|
|
35
|
-
- [Advanced Research](#advanced-research)
|
|
36
|
-
- [Learning & Documentation](#learning--documentation)
|
|
37
|
-
- [Historical Analysis](#historical-analysis)
|
|
38
|
-
- [Code Review & Improvement](#code-review--improvement)
|
|
39
|
-
- [💡 Tips for Effective Usage](#-tips-for-effective-usage)
|
|
40
|
-
- [🎯 Search Strategy Tips](#-search-strategy-tips)
|
|
41
|
-
- [📚 Documentation & Knowledge Management](#-documentation--knowledge-management)
|
|
42
|
-
- [⚡ Performance & Limitations](#-performance--limitations)
|
|
43
|
-
- [🔗 Cross-Repository Analysis](#-cross-repository-analysis)
|
|
44
|
-
- [🎨 Advanced Use Cases](#-advanced-use-cases)
|
|
45
|
-
- [🚀 Pro Tips](#-pro-tips)
|
|
46
|
-
- [🛠 Installation & Setup](#-installation--setup)
|
|
47
|
-
- [🚀 Works Out Of The Box (OOTB) - Any Environment!](#-works-out-of-the-box-ootb---any-environment)
|
|
48
|
-
- [Step 1: Install Prerequisites](#step-1-install-prerequisites)
|
|
49
|
-
- [Step 2: Authentication Setup](#step-2-authentication-setup)
|
|
50
|
-
- [Step 3: MCP Configuration](#step-3-mcp-configuration)
|
|
51
|
-
- [🎉 That's It! Ready To Use](#-thats-it-ready-to-use)
|
|
52
|
-
- [🌟 Alternative Installation Options](#-alternative-installation-options)
|
|
53
|
-
- [🔒 Privacy & Local Operation](#-privacy--local-operation)
|
|
54
|
-
- [🔒 Why Different Than Static PAT](#-why-different-than-static-pat)
|
|
55
|
-
- [License](#license)
|
|
56
|
-
- [⚙️ Advanced Configuration](#️-advanced-configuration)
|
|
57
|
-
- [Rate Limiting & Performance](#rate-limiting--performance)
|
|
58
|
-
- [Authentication Management](#authentication-management)
|
|
59
|
-
- [NPM Configuration](#npm-configuration)
|
|
60
|
-
- [🎯 Best Practices](#-best-practices)
|
|
61
|
-
- [Search Strategy](#search-strategy)
|
|
62
|
-
- [Performance Optimization](#performance-optimization)
|
|
63
|
-
- [Tool Chaining Best Practices](#tool-chaining-best-practices)
|
|
64
|
-
- [🐛 Troubleshooting](#-troubleshooting)
|
|
65
|
-
- [Authentication Issues](#authentication-issues)
|
|
66
|
-
- [Common Issues](#common-issues)
|
|
67
|
-
- [NPM Configuration Issues](#npm-configuration-issues)
|
|
68
|
-
- [Misconfigured .npmrc File](#misconfigured-npmrc-file)
|
|
69
|
-
- [Development Setup](#development-setup)
|
|
70
|
-
- [Disclaimer](#disclaimer)
|
|
71
|
-
|
|
72
|
-
## ✨ Overview
|
|
73
|
-
|
|
74
|
-
### A New Take on Code Discovery MCP
|
|
75
|
-
|
|
76
|
-
**Differences Between Traditional GitHub MCPs and Octocode MCP:**
|
|
77
|
-
- **Octocode MCP** = AI-Powered Research Assistant for Code Discovery
|
|
78
|
-
- **Traditional GitHub MCPs** = Traditional API Wrapper for CRUD Operations
|
|
79
|
-
|
|
80
|
-
### 🧠 **AI-First Architecture**
|
|
81
|
-
- **Chain-of-Thought Reasoning Framework**: 6-step reasoning methodology built into prompts
|
|
82
|
-
- **Teaching Methodology Integration**: AI education built into tool descriptions
|
|
83
|
-
- **Context-aware Search Optimization**: Quality validation pipelines for code discovery
|
|
84
|
-
- **Automatic Query Optimization**: Single-word prioritization strategy ("RAG" -> "Ranking" not "RAG Ranking")
|
|
85
|
-
|
|
86
|
-
### 🔄 **Intelligent Tool Chaining**
|
|
87
|
-
- **Automatic Organization Detection**: Smart tool chaining based on context
|
|
88
|
-
- **Package-to-Repository Mapping**: NPM mentions trigger automatic repository discovery
|
|
89
|
-
- **Cross-validation Workflows**: Multi-step research flows with tool interconnection
|
|
90
|
-
- **Progressive Search Refinement**: Phase-based search refinement (Broad -> Pattern -> Precise)
|
|
91
|
-
|
|
92
|
-
### 🎯 **Smart Discovery Features**
|
|
93
|
-
- **Semantic Landscape Mapping**: `search_github_topics` for ecosystem understanding
|
|
94
|
-
- **Community Knowledge Discovery**: `search_github_discussions` for Q&A and tutorials
|
|
95
|
-
- **Evolution Tracking**: `search_github_commits` for code history analysis
|
|
96
|
-
- **Private Repository Discovery**: `get_user_organizations` for enterprise access
|
|
97
|
-
- **Package Ecosystem Discovery**: `npm_search` and `npm_view` integration
|
|
98
|
-
|
|
99
|
-
## 💡 Background & Motivation
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
This project was born from a personal need while working at **Wix** - navigating and understanding large-scale repositories and codebases became increasingly challenging as projects grew in complexity. Traditional GitHub search and documentation often fell short when trying to:
|
|
103
|
-
|
|
104
|
-
- **Understand architectural decisions** across multiple repositories
|
|
105
|
-
- **Find real implementation examples** rather than just documentation
|
|
106
|
-
- **Track the evolution** of complex features and systems
|
|
107
|
-
- **Discover internal patterns** and best practices across teams
|
|
108
|
-
|
|
109
|
-
Beyond repository navigation, this tool has become essential for **keeping pace with the vast landscape of technology changes**. In today's rapidly evolving development ecosystem, staying current with new frameworks, libraries, and patterns is crucial for maintaining high development velocity.
|
|
110
|
-
|
|
111
|
-
What started as a side project to solve my own daily challenges evolved into a comprehensive AI-powered research assistant. The goal was simple: **make repository exploration and code discovery as intelligent and intuitive as having a senior developer guide you through any codebase.**
|
|
112
|
-
|
|
113
|
-
### 🔄 A Tool That Built Itself
|
|
114
|
-
|
|
115
|
-
In a fascinating turn of meta-development, **Octocode MCP actually helped create itself**. During development, I used the tool to:
|
|
116
|
-
|
|
117
|
-
- **Understand MCP APIs correctly** by analyzing existing MCP implementations and documentation
|
|
118
|
-
- **Compare features with other MCPs** to identify gaps and opportunities
|
|
119
|
-
- **Research best practices** from successful GitHub integrations
|
|
120
|
-
- **Study code patterns** from high-quality open source projects
|
|
121
|
-
|
|
122
|
-
This self-referential development process validated the tool's core value proposition: **enabling developers to learn from and build upon the collective intelligence of the entire GitHub ecosystem.**
|
|
123
|
-
|
|
124
|
-
### 🎯 Innovation: NPM-Driven Repository Discovery
|
|
125
|
-
|
|
126
|
-
One approach that emerged from my own search challenges: **using the NPM registry as a quality filter for repository discovery**. When searching through the vast GitHub landscape, finding high-quality, production-ready code was challenging.
|
|
127
|
-
|
|
128
|
-
The approach:
|
|
129
|
-
- **NPM as Quality Signal**: Published packages indicate battle-tested, production-ready code
|
|
130
|
-
- **Package-to-Repository Mapping**: Automatically link NPM packages to their GitHub repositories
|
|
131
|
-
- **Quality Amplification**: Focus on repositories that maintain published packages, ensuring real-world usage
|
|
132
|
-
- **Ecosystem Context**: Understand dependencies and relationships through package management
|
|
133
|
-
|
|
134
|
-
This methodology improved search result quality by leveraging the NPM ecosystem's inherent curation - if someone published it as a package, it's likely production-ready and well-maintained.
|
|
135
|
-
|
|
136
|
-
*Note: This is a personal side project and not an official Wix product.*
|
|
137
|
-
|
|
138
|
-
## 🌟 Example Use Cases
|
|
139
|
-
|
|
140
|
-
**AI agents can now ask questions like:**
|
|
141
|
-
|
|
142
|
-
- *"Show the langchain code examples from my organization"*
|
|
143
|
-
- *"From code and PRs, how did React implement concurrent rendering?"*
|
|
144
|
-
- *"Show examples of usage of this API: `import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';` Look at my code and suggest how I can improve it"*
|
|
145
|
-
- *"Best ways from code examples to use routing in Next.js"*
|
|
146
|
-
- *"Make docs of lodash"*
|
|
147
|
-
- *"Show progress of React project in the recent 5 years"*
|
|
148
|
-
- *"How is Vue rendering architecture different than React? Check from code"*
|
|
149
|
-
- *"Create development docs and guides about how wix ai gateway works"*
|
|
150
|
-
- *"How does SOME_REPOSITORY work?"*
|
|
151
|
-
- *"Summarise the main PRs on project X"*
|
|
152
|
-
- *"How do Vue and React render components? Which approach is more optimized?"*
|
|
153
|
-
|
|
154
|
-
## 🎯 Features
|
|
155
|
-
|
|
156
|
-
### For Developers
|
|
157
|
-
- **🔍 Intelligent Code Discovery**: Find implementations, patterns, and examples with AI-guided search
|
|
158
|
-
- **🔗 Cross-Repository Investigation**: Trace code patterns, dependencies, and implementations across multiple repositories
|
|
159
|
-
- **🏢 Cross-Organization Dependencies**: Understand dependencies and relationships across different organizations and teams
|
|
160
|
-
- **📚 Library & API Understanding**: Deep dive into libraries and APIs with examples from both internal and external repositories
|
|
161
|
-
- **🔎 Specific Code Usage Search**: Find exact code patterns, function implementations, and usage examples
|
|
162
|
-
- **🏷️ Topic Understanding**: Explore and understand technology topics, trends, and ecosystems
|
|
163
|
-
- **🏗️ Big Project Analysis**: Comprehensive analysis of large-scale projects and their architecture
|
|
164
|
-
- *"Create development docs and guides about how wix ai gateway works"*
|
|
165
|
-
- *"How does SOME_REPOSITORY work?"*
|
|
166
|
-
- **📈 Project Progress Analysis**: Track and summarize project evolution and key changes
|
|
167
|
-
- *"Summarise the main PRs on project X"*
|
|
168
|
-
- **🔬 Cross-Repository Analysis**: Compare approaches and implementations across different projects
|
|
169
|
-
- *"How do Vue and React render components? Which approach is more optimized?"*
|
|
170
|
-
- **📦 Smart Dependency Analysis**: Understand package relationships and find alternative libraries with automatic NPM integration
|
|
171
|
-
- **🐛 Advanced Bug Investigation**: Track issues, commits, and pull requests with multi-repository correlation
|
|
172
|
-
- **📚 Learning & Reference**: Access community discussions, documentation, and best practices with context-aware recommendations
|
|
173
|
-
- **🏗️ Architecture Understanding**: Explore repository structures and analyze codebases with intelligent navigation
|
|
174
|
-
- **📈 Historical Code Analysis**: Understand code evolution through commit history and PR reviews
|
|
175
|
-
- **💡 Code Insights**: Extract insights from code patterns, repository structures, and development practices
|
|
176
|
-
|
|
177
|
-
### For Engineering Managers
|
|
178
|
-
- **📊 Repository Health Assessment**: Assess the current status and health of repositories with comprehensive metrics
|
|
179
|
-
- **⚖️ Technology Assessment**: Evaluate libraries, frameworks, and tools adoption with trend analysis
|
|
180
|
-
- **🤝 Cross-Team Collaboration Analysis**: Track contributions, knowledge sharing, and code reuse patterns
|
|
181
|
-
- **💡 Knowledge Management**: Discover internal resources, documentation, and established patterns
|
|
182
|
-
- **📈 Competitive Analysis**: Research similar projects and industry trends with automated discovery
|
|
183
|
-
- **🛡️ Risk & Compliance Management**: Identify security vulnerabilities, licensing issues, and maintenance gaps
|
|
184
|
-
- **📋 Strategic Planning**: Analyze technology trends, migration patterns, and adoption metrics
|
|
185
|
-
|
|
186
|
-
## 🛠 Available Tools
|
|
187
|
-
|
|
188
|
-
### 🔍 **GitHub Code & Repository Search**
|
|
189
|
-
- **`search_github_code`**: Find specific implementations, functions, and patterns with semantic search
|
|
190
|
-
- **`search_github_repos`**: Progressive repository discovery with intelligent filtering
|
|
191
|
-
- **`fetch_github_file_content`**: Extract complete working code with full context
|
|
192
|
-
- **`view_repository_structure`**: Strategic repository exploration for code analysis
|
|
193
|
-
- **`view_repository`**: Discover default branch information (mandatory first step)
|
|
194
|
-
|
|
195
|
-
### 📦 **NPM & Package Ecosystem**
|
|
196
|
-
- **`npm_view`**: Transform package names into GitHub repositories for code analysis
|
|
197
|
-
- **`npm_search`**: Search NPM registry for packages by keywords with intelligent optimization
|
|
198
|
-
- **Package-to-Repository Mapping**: Automatic linking from NPM packages to their GitHub repositories
|
|
199
|
-
|
|
200
|
-
### 📋 **Development History & Collaboration**
|
|
201
|
-
- **`search_github_commits`**: Advanced GitHub commits search for development history analysis
|
|
202
|
-
- **`search_github_pull_requests`**: Code review and feature analysis with quality focus
|
|
203
|
-
- **`search_github_issues`**: Problem discovery and solution research with pattern analysis
|
|
204
|
-
- **`search_github_discussions`**: Community knowledge discovery for Q&A and tutorials
|
|
205
|
-
|
|
206
|
-
### 👥 **User & Organization Management**
|
|
207
|
-
- **`search_github_users`**: Advanced developer and organization discovery
|
|
208
|
-
- **`get_user_organizations`**: Automatic private repository discovery for enterprise environments
|
|
209
|
-
- **`search_github_topics`**: Vital foundation tool for effective GitHub discovery
|
|
210
|
-
|
|
211
|
-
### 🎯 **Smart Features**
|
|
212
|
-
- **Automatic Query Optimization**: Built-in search strategy optimization
|
|
213
|
-
- **Chain-of-Thought Reasoning**: 6-step reasoning methodology for complex queries
|
|
214
|
-
- **Teaching Methodology Integration**: AI education built into tool descriptions
|
|
215
|
-
- **Progressive Search Refinement**: Phase-based search from broad to precise
|
|
216
|
-
- **Cross-validation Workflows**: Multi-step research flows with tool interconnection
|
|
217
|
-
|
|
218
|
-
## 📚 Usage Examples
|
|
219
|
-
|
|
220
|
-
### Basic Code Discovery
|
|
221
|
-
```bash
|
|
222
|
-
# Find React hooks implementations
|
|
223
|
-
"Show me examples of custom React hooks for data fetching"
|
|
224
|
-
|
|
225
|
-
# Explore API patterns
|
|
226
|
-
"How do popular libraries implement rate limiting? Show code examples"
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Advanced Research
|
|
230
|
-
```bash
|
|
231
|
-
# Deep architectural analysis
|
|
232
|
-
"From code and PRs, how did React implement concurrent rendering?"
|
|
233
|
-
|
|
234
|
-
# Cross-repository investigation
|
|
235
|
-
"Show the langchain code examples from my organization"
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### Learning & Documentation
|
|
239
|
-
```bash
|
|
240
|
-
# Best practices discovery
|
|
241
|
-
"Best ways from code examples to use routing in Next.js"
|
|
242
|
-
|
|
243
|
-
# Documentation generation
|
|
244
|
-
"Make docs of lodash based on actual implementation"
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Historical Analysis
|
|
248
|
-
```bash
|
|
249
|
-
# Project evolution tracking
|
|
250
|
-
"Show progress of React project in the recent 5 years"
|
|
251
|
-
|
|
252
|
-
# Comparative analysis
|
|
253
|
-
"How is Vue rendering architecture different than React? Check from code"
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### Code Review & Improvement
|
|
257
|
-
```bash
|
|
258
|
-
# Code analysis and suggestions
|
|
259
|
-
"Show examples of usage of this API: import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; Look at my code and suggest how I can improve it"
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## 💡 Tips for Effective Usage
|
|
13
|
+
## What is Octocode? 🐙
|
|
263
14
|
|
|
264
|
-
|
|
265
|
-
- **🔍 Be Specific**: Use specific library names, repository URLs, or exact function names for better results
|
|
266
|
-
- Good: *"Show me how the `useEffect` hook works in React"*
|
|
267
|
-
- Better: *"Show me `useEffect` cleanup patterns in facebook/react repository"*
|
|
15
|
+
**The perfect code assistant that can help understand anything.** Octocode was built to understand connections between repositories and NPM packages under any privilege level you have. With **AI-powered advanced search**, heuristic discovery, and smart fallbacks, it makes GitHub's vast repository of knowledge truly searchable and analyzable.
|
|
268
16
|
|
|
269
|
-
|
|
270
|
-
- Start broad, then drill down into specific areas of interest
|
|
271
|
-
- Use follow-up questions to explore different aspects
|
|
17
|
+
Instead of manually browsing repositories, you can ask questions like:
|
|
272
18
|
|
|
273
|
-
|
|
274
|
-
-
|
|
275
|
-
|
|
276
|
-
|
|
19
|
+
- *"How did React implement concurrent rendering?"*
|
|
20
|
+
- *"Show me authentication patterns in Next.js applications"*
|
|
21
|
+
- *"Find examples of how to use this specific API"*
|
|
22
|
+
- *"What's the architecture of this library?"*
|
|
23
|
+
- *"How do I use this MCP tool effectively?"*
|
|
277
24
|
|
|
278
|
-
|
|
279
|
-
- Session 1: "What is server-side rendering?"
|
|
280
|
-
- Session 2: "Show me SSR implementations in Next.js"
|
|
281
|
-
- Session 3: "Compare SSR vs SSG in production applications"
|
|
25
|
+
## Recommended Use Cases
|
|
282
26
|
|
|
283
|
-
|
|
284
|
-
- **🚦 Rate Limiting Awareness**: GitHub has API rate limits for file fetching
|
|
285
|
-
- This tool has optimizations to manage rate limits efficiently
|
|
286
|
-
- **Not designed for bulk operations** like *"show all files in my org using XYZ"*
|
|
287
|
-
- Focus on targeted analysis rather than exhaustive scans
|
|
27
|
+
**Use Octocode when you need to:**
|
|
288
28
|
|
|
289
|
-
-
|
|
290
|
-
|
|
291
|
-
|
|
29
|
+
- **🔍 Understand implementations** - See how features work across different repositories
|
|
30
|
+
- **📚 Find real code examples** - Discover patterns and best practices from production code
|
|
31
|
+
- **🏗️ Analyze architecture** - Explore how systems are designed and structured
|
|
32
|
+
- **🔬 Research approaches** - Compare different implementation strategies
|
|
33
|
+
- **💡 Learn from code** - Deep-dive into technical details and understand "how does this work?"
|
|
292
34
|
|
|
293
|
-
|
|
294
|
-
- **🏢 Organization Context**: Mention your organization or company for internal repository access
|
|
295
|
-
- *"Show authentication patterns used in our team's repositories"*
|
|
296
|
-
- The tool will automatically detect and use your organization access
|
|
35
|
+
## Unique Value Proposition
|
|
297
36
|
|
|
298
|
-
|
|
299
|
-
- *"How does the lodash library implement debouncing?"* -> Automatically finds and analyzes lodash repository
|
|
37
|
+
**The most advanced AI-powered code assistant for understanding connections across the entire GitHub & NPM ecosystem.** While other GitHub MCPs focus on project management or basic operations, Octocode provides unparalleled depth for code discovery and technical research.
|
|
300
38
|
|
|
301
|
-
|
|
302
|
-
-
|
|
303
|
-
|
|
39
|
+
**🚀 Out-of-the-Box Advanced Search (Powered by AI):**
|
|
40
|
+
- **🧠 Heuristic Search** - Intelligent pattern recognition that finds relevant code even with vague queries
|
|
41
|
+
- **🔄 Smart Fallbacks** - Automatic retry with alternative search strategies when initial searches fail
|
|
42
|
+
- **🎯 Smart Discovery** - AI-guided exploration that uncovers hidden connections and patterns
|
|
43
|
+
- **🔗 Connection Intelligence** - Understands relationships between repositories, packages, and dependencies
|
|
44
|
+
- **📊 Multi-dimensional Analysis** - Combines code, commits, issues, discussions, and package data
|
|
304
45
|
|
|
305
|
-
|
|
306
|
-
|
|
46
|
+
**Key Differentiators:**
|
|
47
|
+
- **🧠 Advanced AI Search** - Heuristic algorithms that understand code context and connections
|
|
48
|
+
- **🔐 Secure & Simple** - No personal access tokens needed, uses [GitHub CLI](https://cli.github.com/) authentication
|
|
49
|
+
- **🔗 Connected Discovery** - Maps NPM packages to repositories, traces dependencies, finds related code
|
|
50
|
+
- **🌐 Cross-Ecosystem Understanding** - Works across any privilege level you have (public, private, organization)
|
|
307
51
|
|
|
308
|
-
|
|
309
|
-
- *"Show me production examples of microservices communication patterns"*
|
|
52
|
+
It's the tool you reach for when you need to understand *"how does this work?"* rather than *"how do I manage this project?"*
|
|
310
53
|
|
|
311
|
-
|
|
312
|
-
- **🔧 Combine Tools**: Use multiple MCP tools together for comprehensive analysis
|
|
313
|
-
- **📊 Context Building**: Build context over multiple interactions for deeper insights
|
|
314
|
-
- **🎯 Focus Areas**: Target specific areas of interest rather than general exploration
|
|
315
|
-
- **📱 Real Examples**: Always ask for real code examples rather than theoretical explanations
|
|
54
|
+
## Quick Start 🚀
|
|
316
55
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
### 🚀 **Works Out Of The Box (OOTB) - Any Environment!**
|
|
320
|
-
|
|
321
|
-
**Octocode MCP works instantly on any environment** - no complex setup, no configuration files, no environment variables. Just install prerequisites and configure MCP client. **That's it!**
|
|
322
|
-
|
|
323
|
-
### Step 1: Install Prerequisites
|
|
324
|
-
|
|
325
|
-
#### Install Node.js (21+)
|
|
56
|
+
### 1. Install Prerequisites
|
|
326
57
|
```bash
|
|
327
|
-
#
|
|
328
|
-
brew install node
|
|
329
|
-
|
|
330
|
-
# Or download from https://nodejs.org/
|
|
331
|
-
# Verify installation
|
|
332
|
-
node --version # Should be 21+
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
#### Install GitHub CLI
|
|
336
|
-
```bash
|
|
337
|
-
# macOS
|
|
338
|
-
brew install gh
|
|
339
|
-
|
|
340
|
-
# Windows (with Chocolatey)
|
|
341
|
-
choco install gh
|
|
58
|
+
# Install Node.js 21+
|
|
59
|
+
brew install node # macOS
|
|
60
|
+
# or download from https://nodejs.org/
|
|
342
61
|
|
|
343
|
-
#
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
# Linux (Debian/Ubuntu)
|
|
347
|
-
sudo apt update && sudo apt install gh
|
|
348
|
-
|
|
349
|
-
# Other platforms: https://github.com/cli/cli#installation
|
|
62
|
+
# Install GitHub CLI
|
|
63
|
+
brew install gh # macOS
|
|
64
|
+
# or see: https://github.com/cli/cli#installation
|
|
350
65
|
```
|
|
351
66
|
|
|
352
|
-
|
|
67
|
+
### 2. Authenticate
|
|
353
68
|
```bash
|
|
354
|
-
#
|
|
355
|
-
npm --version
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
### Step 2: Authentication Setup
|
|
359
|
-
|
|
360
|
-
#### GitHub CLI Authentication
|
|
361
|
-
```bash
|
|
362
|
-
# Login to GitHub (opens web browser)
|
|
69
|
+
# Login to GitHub (opens browser)
|
|
363
70
|
gh auth login
|
|
364
71
|
|
|
365
|
-
#
|
|
366
|
-
# 1. GitHub.com (for public repos) or GitHub Enterprise Server
|
|
367
|
-
# 2. HTTPS (recommended)
|
|
368
|
-
# 3. Login with a web browser (easier and more secure)
|
|
369
|
-
|
|
370
|
-
# Verify authentication
|
|
371
|
-
gh auth status
|
|
372
|
-
# Should show: ✓ Logged in to github.com as [your-username]
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
#### NPM Authentication (for private packages)
|
|
376
|
-
```bash
|
|
377
|
-
# For npm registry
|
|
72
|
+
# Login to NPM (for package research)
|
|
378
73
|
npm login
|
|
379
|
-
|
|
380
|
-
# For private registries, check your .npmrc
|
|
381
|
-
npm config list
|
|
382
|
-
npm whoami # Verify authentication
|
|
383
74
|
```
|
|
384
75
|
|
|
385
|
-
|
|
76
|
+
**🔐 GitHub Authentication via CLI:**
|
|
77
|
+
- ✅ **No personal access tokens needed** - Uses [GitHub CLI](https://cli.github.com/) behind the scenes
|
|
78
|
+
- ✅ **Secure OAuth flow** - Browser-based authentication, no tokens to store
|
|
79
|
+
- ✅ **Enterprise ready** - Works with SSO, 2FA, and organization access
|
|
80
|
+
- ✅ **Private repository access** - Automatically detects your organizations and accesses private repos
|
|
81
|
+
- ✅ **Zero configuration** - Uses your existing `gh` CLI permissions
|
|
386
82
|
|
|
387
|
-
**This is the only configuration you need!** Add this to your MCP client configuration:
|
|
388
83
|
|
|
84
|
+
### 3. Add to MCP Configuration
|
|
389
85
|
```json
|
|
390
86
|
{
|
|
391
87
|
"octocode-mcp": {
|
|
392
88
|
"command": "npx",
|
|
393
|
-
"args": [
|
|
394
|
-
"octocode-mcp"
|
|
395
|
-
]
|
|
89
|
+
"args": ["octocode-mcp"]
|
|
396
90
|
}
|
|
397
91
|
}
|
|
398
92
|
```
|
|
399
93
|
|
|
400
|
-
|
|
94
|
+
**That's it!** No personal access tokens, no config files, no complex setup. Octocode leverages [GitHub CLI](https://cli.github.com/) authentication behind the scenes and **automatically works with your organization's private repositories**.
|
|
401
95
|
|
|
402
|
-
|
|
403
|
-
**No environment variables** - Uses your existing GitHub CLI authentication
|
|
404
|
-
**No configuration files** - Works with your current permissions
|
|
405
|
-
**No tokens to manage** - Secure authentication handled automatically
|
|
406
|
-
**Works everywhere** - Any OS, any environment, any setup
|
|
96
|
+
## Example Questions 💬
|
|
407
97
|
|
|
408
|
-
|
|
98
|
+
**Learning & Research:**
|
|
99
|
+
- *"How do popular libraries implement rate limiting?"*
|
|
100
|
+
- *"Show me Server Actions patterns in Next.js applications"*
|
|
101
|
+
- *"What are the differences between Vue and React rendering?"*
|
|
409
102
|
|
|
410
|
-
|
|
103
|
+
**Architecture & Patterns:**
|
|
104
|
+
- *"How is authentication handled in enterprise applications?"*
|
|
105
|
+
- *"Show me microservices communication patterns"*
|
|
106
|
+
- *"Find examples of event-driven architecture implementations"*
|
|
411
107
|
|
|
412
|
-
|
|
108
|
+
**Organization & Private Repositories:**
|
|
109
|
+
- *"Show me authentication patterns used in our team's repositories"*
|
|
110
|
+
- *"Find internal libraries and how they're implemented in our org"*
|
|
111
|
+
- *"Analyze our company's coding standards and patterns"*
|
|
413
112
|
|
|
414
|
-
|
|
415
|
-
-
|
|
416
|
-
-
|
|
417
|
-
-
|
|
113
|
+
**Specific Code Analysis:**
|
|
114
|
+
- *"How does lodash implement debouncing?"*
|
|
115
|
+
- *"Show usage examples of this API: `createContext`"*
|
|
116
|
+
- *"Find React hooks patterns for data fetching"*
|
|
418
117
|
|
|
419
|
-
|
|
118
|
+
## Core Features 🛠️
|
|
420
119
|
|
|
421
|
-
###
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
gh auth status # Should show authenticated
|
|
427
|
-
npm --version # Should show version
|
|
428
|
-
|
|
429
|
-
# Test NPX execution (optional)
|
|
430
|
-
npx octocode-mcp --help
|
|
431
|
-
```
|
|
120
|
+
### 🧠 AI-Powered Advanced Search
|
|
121
|
+
- **Heuristic Pattern Recognition** - Finds relevant code even with vague or incomplete queries
|
|
122
|
+
- **Smart Fallback Strategies** - Automatically tries alternative approaches when searches fail
|
|
123
|
+
- **Context-Aware Discovery** - Understands code relationships and suggests related implementations
|
|
124
|
+
- **Multi-Strategy Search** - Combines semantic, syntactic, and dependency-based search methods
|
|
432
125
|
|
|
433
|
-
###
|
|
126
|
+
### 🔗 Connection Intelligence
|
|
127
|
+
- **Repository-Package Mapping** - Automatically links NPM packages to their GitHub repositories
|
|
128
|
+
- **Dependency Tracing** - Follows dependency chains across the entire ecosystem
|
|
129
|
+
- **Cross-Reference Analysis** - Finds how different projects implement similar patterns
|
|
130
|
+
- **Ecosystem Understanding** - Maps relationships between libraries, frameworks, and tools
|
|
434
131
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
npm install -g octocode-mcp
|
|
132
|
+
### 🌐 Universal Access & Discovery
|
|
133
|
+
- **Cross-Privilege Search** - Works with any access level you have (public, private, organization)
|
|
134
|
+
- **Organization-Aware** - Automatically detects and uses your GitHub organization memberships
|
|
135
|
+
- **Smart Repository Discovery** - Finds relevant repositories even when you don't know they exist
|
|
136
|
+
- **Progressive Refinement** - AI-guided search that gets more precise with each iteration
|
|
441
137
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
```
|
|
138
|
+
### 📊 Multi-Dimensional Analysis
|
|
139
|
+
- **Code + Context** - Combines source code with commits, issues, discussions, and documentation
|
|
140
|
+
- **Historical Understanding** - Tracks how implementations evolved over time
|
|
141
|
+
- **Community Insights** - Discovers patterns from real-world usage and discussions
|
|
142
|
+
- **Quality Signals** - Uses NPM publication and GitHub activity as quality indicators
|
|
449
143
|
|
|
450
|
-
|
|
451
|
-
```bash
|
|
452
|
-
# No installation needed - NPX handles everything
|
|
453
|
-
# Just use the MCP configuration above! ⬆️
|
|
454
|
-
```
|
|
144
|
+
## Privacy & Security 🛡️
|
|
455
145
|
|
|
456
|
-
|
|
146
|
+
- **🏠 100% Local** - Runs entirely on your machine
|
|
147
|
+
- **🚫 Zero Data Collection** - No telemetry, logging, or data transmission
|
|
148
|
+
- **🔑 No Token Management** - Uses [GitHub CLI](https://cli.github.com/) authentication, no personal access tokens needed
|
|
149
|
+
- **🛡️ Privacy by Design** - All API calls use your existing `gh` CLI permissions directly
|
|
457
150
|
|
|
458
|
-
|
|
459
|
-
❌ **Manual PAT Management**: Create, store, rotate personal access tokens manually
|
|
460
|
-
❌ **Security Risks**: Tokens in config files, potential exposure
|
|
461
|
-
❌ **Limited Scope**: Fixed permissions, hard to manage different access levels
|
|
462
|
-
❌ **Expiration Issues**: Tokens expire, breaking workflows
|
|
463
|
-
❌ **No SSO Integration**: Doesn't work with enterprise SSO/SAML
|
|
151
|
+
## Best Practices 💡
|
|
464
152
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
✅ **Better Security**: No tokens stored in files or transmitted
|
|
153
|
+
**AI-Powered Search Tips:**
|
|
154
|
+
- **Let AI guide you** - Start with natural language questions, the heuristic search will find relevant code
|
|
155
|
+
- **Trust the smart fallbacks** - If initial search doesn't work, AI automatically tries alternative strategies
|
|
156
|
+
- **Explore connections** - Ask about relationships between packages, libraries, and implementations
|
|
157
|
+
- **Use any privilege level** - Works seamlessly across public repos, private repos, and organization repositories
|
|
158
|
+
- **Keep research along the MCP** - Build upon previous searches and maintain context across multiple queries for deeper exploration
|
|
472
159
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
160
|
+
**Effective Questions:**
|
|
161
|
+
- **Vague is OK** - "How does authentication work?" → AI finds relevant patterns across repositories
|
|
162
|
+
- **Ask for connections** - "What libraries use this pattern?" → Discovers related implementations
|
|
163
|
+
- **Cross-ecosystem queries** - "NPM packages that implement X" → Links packages to their repositories
|
|
164
|
+
- **Evolution questions** - "How has this approach changed?" → Traces implementation history
|
|
476
165
|
|
|
477
|
-
|
|
166
|
+
**Advanced Search Features:**
|
|
167
|
+
- **Automatic fallbacks** - No need to retry failed searches, AI handles it automatically
|
|
168
|
+
- **Smart discovery** - Finds repositories and packages you didn't know existed
|
|
169
|
+
- **Connection mapping** - Understands relationships between different codebases
|
|
170
|
+
- **Context preservation** - Maintains search context across multiple queries
|
|
478
171
|
|
|
479
|
-
|
|
480
|
-
- **Built-in Rate Limiting**: Prevents API quota exhaustion with smart request management
|
|
481
|
-
- **Intelligent Caching**: Result caching with configurable timeouts
|
|
482
|
-
- **Progressive Search**: Adaptive search strategies from broad to specific
|
|
483
|
-
- **Configurable Results**: Optimized result limits for different use cases
|
|
172
|
+
## Troubleshooting 🔧
|
|
484
173
|
|
|
485
|
-
|
|
486
|
-
- **Seamless GitHub CLI Integration**: Zero-configuration authentication
|
|
487
|
-
- **NPM Registry Support**: Private package access with existing credentials
|
|
488
|
-
- **Organization-aware Access**: Automatic detection and private repository access
|
|
489
|
-
- **Local Execution**: All operations run locally using your existing permissions
|
|
490
|
-
|
|
491
|
-
### NPM Configuration
|
|
492
|
-
```bash
|
|
493
|
-
# Check your NPM configuration
|
|
494
|
-
npm config list
|
|
495
|
-
npm whoami # Verify authentication for private registries
|
|
496
|
-
|
|
497
|
-
# Configure for private registries if needed
|
|
498
|
-
echo "@your-org:registry=https://npm.your-company.com/" >> ~/.npmrc
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
## 🎯 Best Practices
|
|
502
|
-
|
|
503
|
-
### Search Strategy
|
|
504
|
-
- **Start Broad**: Begin with general terms, then narrow down based on findings
|
|
505
|
-
- **Use Progressive Discovery**: Combine multiple tools for comprehensive understanding
|
|
506
|
-
- **Leverage Organizations**: Use your team's GitHub org for internal discovery
|
|
507
|
-
- **Cross-Reference Sources**: Combine code, issues, and discussions for complete context
|
|
508
|
-
|
|
509
|
-
### Performance Optimization
|
|
510
|
-
- **Use Specific Repository Filters**: When you know the target repository
|
|
511
|
-
- **Combine Related Searches**: In single sessions for efficiency
|
|
512
|
-
- **Monitor API Rate Limits**: Built-in management prevents quota exhaustion
|
|
513
|
-
- **Cache Frequently Accessed Information**: Automatic intelligent caching
|
|
514
|
-
|
|
515
|
-
### Tool Chaining Best Practices
|
|
516
|
-
- **Start with Topics**: Use `search_github_topics` for proper terminology discovery
|
|
517
|
-
- **Repository Discovery**: Use discovered topic names in `search_github_repos`
|
|
518
|
-
- **Organization Context**: Let automatic detection handle private repository access
|
|
519
|
-
- **Package Research**: Mention packages to trigger automatic NPM-to-repository mapping
|
|
520
|
-
|
|
521
|
-
## 🐛 Troubleshooting
|
|
522
|
-
|
|
523
|
-
### Authentication Issues
|
|
174
|
+
**Authentication Issues:**
|
|
524
175
|
```bash
|
|
525
176
|
# Check GitHub CLI status
|
|
526
177
|
gh auth status
|
|
527
|
-
# Should show: ✓ Logged in to github.com as [username]
|
|
528
178
|
|
|
529
179
|
# Re-authenticate if needed
|
|
530
|
-
gh auth logout
|
|
531
|
-
gh auth login
|
|
180
|
+
gh auth logout && gh auth login
|
|
532
181
|
|
|
533
|
-
# Check NPM
|
|
182
|
+
# Check NPM access
|
|
534
183
|
npm whoami
|
|
535
184
|
```
|
|
536
185
|
|
|
537
|
-
|
|
538
|
-
-
|
|
539
|
-
-
|
|
540
|
-
-
|
|
541
|
-
- **NPX Cache Issues**: Clear cache with `rm -rf ~/.npm/_npx` (Unix) or delete via File Explorer (Windows)
|
|
542
|
-
|
|
543
|
-
### NPM Configuration Issues
|
|
544
|
-
```bash
|
|
545
|
-
# View current configuration
|
|
546
|
-
npm config list
|
|
547
|
-
|
|
548
|
-
# Check for common issues:
|
|
549
|
-
# - Registry URL correctness
|
|
550
|
-
# - Authentication tokens validity
|
|
551
|
-
# - Proxy settings (if behind firewall)
|
|
552
|
-
# - Syntax errors in .npmrc
|
|
553
|
-
|
|
554
|
-
# Reset NPM configuration if needed
|
|
555
|
-
rm ~/.npmrc
|
|
556
|
-
npm login
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
### Misconfigured .npmrc File
|
|
560
|
-
1. **Locate .npmrc files**: Project-level (./), User-level (~/.npmrc), Global-level
|
|
561
|
-
2. **Check for common issues**: Registry URL, auth tokens, proxy settings, syntax errors
|
|
562
|
-
3. **View configuration**: `npm config list`
|
|
563
|
-
4. **Test after changes**: `yarn install` or `npm install`
|
|
186
|
+
**Common Solutions:**
|
|
187
|
+
- No results? Try broader search terms
|
|
188
|
+
- Private repos not found? Check organization membership with `gh auth status`
|
|
189
|
+
- NPX issues? Clear cache: `rm -rf ~/.npm/_npx`
|
|
564
190
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
cd octocode-mcp
|
|
191
|
+
**🏢 Organization & Private Repository Access:**
|
|
192
|
+
- **Automatic detection** - Octocode automatically discovers your GitHub organizations
|
|
193
|
+
- **No additional setup** - If you have access to private repos through your organization, they work immediately
|
|
194
|
+
- **Verify access** - Run `gh auth status` to see your organization memberships
|
|
570
195
|
|
|
571
|
-
|
|
572
|
-
|
|
196
|
+
**Why GitHub CLI Authentication?**
|
|
197
|
+
- ✅ **No token creation** - GitHub CLI handles OAuth flow automatically
|
|
198
|
+
- ✅ **Enterprise compatible** - Works with SSO, SAML, and 2FA out of the box
|
|
199
|
+
- ✅ **Organization auto-detection** - Automatically discovers your GitHub organizations and private repo access
|
|
200
|
+
- ✅ **Works out of the box** - If you work for an organization, private repositories are immediately accessible
|
|
201
|
+
- ❌ **vs Personal Access Tokens** - No manual creation, rotation, or security risks
|
|
573
202
|
|
|
574
|
-
|
|
575
|
-
yarn build
|
|
203
|
+
## Background 💭
|
|
576
204
|
|
|
577
|
-
|
|
578
|
-
// "octocode-mcp-local": {
|
|
579
|
-
// "command": "node",
|
|
580
|
-
// "args": [
|
|
581
|
-
// "PATH_TO_OCTOCODE_MCP/octocode-mcp/dist/index.js"
|
|
582
|
-
// ]
|
|
583
|
-
// }
|
|
205
|
+
This project started as a personal tool while working at Wix, born from the challenge of navigating large codebases and keeping up with rapidly evolving technology landscapes. What began as a side project to solve daily development challenges evolved into **the perfect code assistant that can help understand anything**.
|
|
584
206
|
|
|
585
|
-
|
|
207
|
+
The goal was simple: **make code exploration as intelligent as having a senior developer guide you through any codebase.** Built specifically to understand connections between many repositories and NPM packages under any privilege the user has, with AI-powered heuristic search, smart fallbacks, and intelligent discovery.
|
|
586
208
|
|
|
587
|
-
## Disclaimer
|
|
588
209
|
|
|
589
|
-
|
|
210
|
+
## License 📄
|
|
590
211
|
|
|
591
|
-
|
|
592
|
-
- **🎯 Intentionally Lean**: Designed to be simple and lightweight - no unnecessary overhead or complexity
|
|
593
|
-
- **🔬 Experimental**: As with any side project, expect occasional rough edges and areas for improvement
|
|
212
|
+
MIT License - See [LICENSE](./LICENSE.md) for details.
|
|
594
213
|
|
|
595
214
|
---
|
|
596
215
|
|
|
597
216
|
|
|
598
217
|
|
|
599
|
-
|
package/build/index.js
CHANGED
|
@@ -22,33 +22,37 @@ const TOOL_NAMES = {
|
|
|
22
22
|
NPM_PACKAGE_SEARCH: 'npm_package_search',
|
|
23
23
|
NPM_VIEW_PACKAGE: 'npm_view_package',
|
|
24
24
|
};
|
|
25
|
-
const PROMPT_SYSTEM_PROMPT = `
|
|
25
|
+
const PROMPT_SYSTEM_PROMPT = `You are a smart code research assistant with semantic search capabilities using gh and npm cli under the hood.
|
|
26
|
+
You are able to search code, repositories, issues, pull requests, commits, and packages.
|
|
27
|
+
Using Github: You are able to search code, repositories, issues, pull requests, commits
|
|
28
|
+
Using NPM: You are able to search packages, view package metadata, and view package dependencies.
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
- Use ${TOOL_NAMES.GITHUB_SEARCH_REPOS} for smart repository and topic discovery
|
|
30
|
-
- Run searches in parallel when possible for efficiency
|
|
31
|
-
- Dive deeper with specific tools for detailed analysis
|
|
30
|
+
- ALWAYS START with ${TOOL_NAMES.API_STATUS_CHECK} before evaluating any user query (check npm and GitHub authentication and use GitHub organizations)
|
|
31
|
+
- Understand users query from semantic understanding and choose the right tools for the job.
|
|
32
32
|
|
|
33
|
-
SEARCH STRATEGY:
|
|
34
|
-
- ${TOOL_NAMES.GITHUB_SEARCH_REPOS} -
|
|
35
|
-
- ${TOOL_NAMES.GITHUB_SEARCH_CODE} - Find implementation patterns
|
|
33
|
+
TOOLS SEARCH STRATEGY:
|
|
34
|
+
- ${TOOL_NAMES.GITHUB_SEARCH_REPOS} - START SHALLOW & GO BROAD: Use topics for exploratory discovery, then narrow down
|
|
35
|
+
- ${TOOL_NAMES.GITHUB_SEARCH_CODE} - Find implementation patterns with SMART BOOLEAN OPERATORS (AND, OR, NOT)
|
|
36
36
|
- ${TOOL_NAMES.NPM_PACKAGE_SEARCH} - Package ecosystem discovery
|
|
37
37
|
- ${TOOL_NAMES.NPM_VIEW_PACKAGE} - Complete package analysis with exports for file discovery
|
|
38
38
|
- ${TOOL_NAMES.GITHUB_SEARCH_ISSUES} + ${TOOL_NAMES.GITHUB_SEARCH_PULL_REQUESTS} - Understanding development patterns
|
|
39
39
|
- ${TOOL_NAMES.GITHUB_GET_CONTENTS} → ${TOOL_NAMES.GITHUB_GET_FILE_CONTENT} - ALWAYS verify file existence before fetching
|
|
40
40
|
|
|
41
41
|
BEST PRACTICES:
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
42
|
+
- Leverage smart boolean operators if possible in tools and advanced filters for smart research
|
|
43
|
+
- For repo discovery: START SHALLOW with topics, then go BROAD to explore ecosystems
|
|
44
|
+
- For code search: Be focused and specific with boolean operators
|
|
45
|
+
- Always check documentation and examples when available
|
|
46
|
+
- Add referenced and high quality research data from docs and quality code
|
|
47
|
+
- Be creative and smart and use tools efficiently to gather most data
|
|
48
|
+
- If query is short (e.g. where is the git repo of X package) make simple query and use tools to gather data fast
|
|
49
|
+
- For broad research make steps and think about the best way to gather data`;
|
|
48
50
|
const TOOL_DESCRIPTIONS = {
|
|
49
|
-
[TOOL_NAMES.API_STATUS_CHECK]:
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
[TOOL_NAMES.API_STATUS_CHECK]: `**MANDATORY FIRST STEP** - Check GitHub & NPM authentication status before any user query evaluation.
|
|
52
|
+
Returns connectivity status and discovers user organizations - CRITICAL for accessing private/organizational repositories.
|
|
53
|
+
**DO NOT PROCEED** with searches if both GitHub and NPM are disconnected.
|
|
54
|
+
**USE ORGANIZATIONS** returned in 'github.organizations' array for targeted owner/org parameters in all search tools.
|
|
55
|
+
Essential for enterprise code exploration and accessing company-specific repositories that require organizational membership.`,
|
|
52
56
|
[TOOL_NAMES.NPM_PACKAGE_SEARCH]: `Search NPM packages by keyword. Use for package ecosystem discovery.`,
|
|
53
57
|
[TOOL_NAMES.NPM_VIEW_PACKAGE]: `Get comprehensive package metadata essential for GitHub searches and code analysis. Returns complete package context:
|
|
54
58
|
• repositoryGitUrl - Direct GitHub repo link for accurate searches
|
|
@@ -56,13 +60,16 @@ const TOOL_DESCRIPTIONS = {
|
|
|
56
60
|
• dependencies/devDependencies - Full ecosystem understanding
|
|
57
61
|
• versions with dates - Historical evolution context
|
|
58
62
|
The exports field is invaluable for GitHub file discovery - shows exact paths before fetching. Always use when finding packages in code.`,
|
|
59
|
-
[TOOL_NAMES.GITHUB_SEARCH_CODE]: `SEMANTIC CODE DISCOVERY: Search code with
|
|
63
|
+
[TOOL_NAMES.GITHUB_SEARCH_CODE]: `SEMANTIC CODE DISCOVERY: Search code with SMART BOOLEAN OPERATORS (AND, OR, NOT).
|
|
64
|
+
Prioritize intelligent boolean combinations: "logger AND debug NOT test", "config OR settings", "error handling AND typescript".
|
|
60
65
|
Format: "term AND term" language:js path:src. Filters: owner/org/user, repo, extension, filename, language, path, size, limit, match scope.
|
|
61
66
|
Use for finding actual implementation patterns and code examples.
|
|
62
67
|
CRITICAL: When packages found in results or from user input, use ${TOOL_NAMES.NPM_VIEW_PACKAGE} for metadata/paths.`,
|
|
63
|
-
[TOOL_NAMES.GITHUB_SEARCH_REPOS]: `Search repositories by name/description.
|
|
68
|
+
[TOOL_NAMES.GITHUB_SEARCH_REPOS]: `Search repositories by name/description. START SHALLOW AND GO BROAD (contrary to code search).
|
|
69
|
+
Use topics for EXPLORATORY discovery: topic:["cli","typescript","api"] to find ecosystem patterns.
|
|
70
|
+
PRIMARY FILTERS work alone: owner, language, stars, topic, forks. SECONDARY FILTERS require query/primary filter: license, created, archived, includeForks, updated, visibility, match.
|
|
64
71
|
|
|
65
|
-
PATTERNS: Use topic:["cli","typescript"] for semantic discovery. Use stars:">100" for quality. Use owner:"microsoft" for organization repos. Query supports GitHub syntax: "language:Go OR language:Rust".
|
|
72
|
+
SMART REPOS SEARCH PATTERNS: Use topic:["cli","typescript"] for semantic discovery. Use stars:">100" for quality. Use owner:"microsoft" for organization repos. Query supports GitHub syntax: "language:Go OR language:Rust".
|
|
66
73
|
|
|
67
74
|
CRITICAL: When finding packages, use ${TOOL_NAMES.NPM_VIEW_PACKAGE} for metadata and repository paths.`,
|
|
68
75
|
[TOOL_NAMES.GITHUB_GET_CONTENTS]: `Browse repository structure and verify file existence. ALWAYS use before github_get_file_content to confirm files exist and understand organization.`,
|
|
@@ -309,7 +316,7 @@ async function executeCommand(fullCommand, type, options = {}) {
|
|
|
309
316
|
|
|
310
317
|
function registerApiStatusCheckTool(server) {
|
|
311
318
|
server.tool(TOOL_NAMES.API_STATUS_CHECK, TOOL_DESCRIPTIONS[TOOL_NAMES.API_STATUS_CHECK], {}, {
|
|
312
|
-
title:
|
|
319
|
+
title: TOOL_NAMES.API_STATUS_CHECK,
|
|
313
320
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.API_STATUS_CHECK],
|
|
314
321
|
readOnlyHint: true,
|
|
315
322
|
destructiveHint: false,
|
|
@@ -457,9 +464,9 @@ function registerGitHubSearchCodeTool(server) {
|
|
|
457
464
|
.optional()
|
|
458
465
|
.describe('Repository owner/organization(s). Single string or array for multiple owners. Leave empty for global search.'),
|
|
459
466
|
repo: z
|
|
460
|
-
.array(z.string())
|
|
467
|
+
.union([z.string(), z.array(z.string())])
|
|
461
468
|
.optional()
|
|
462
|
-
.describe('Specific repositories in "owner/repo" format. Requires owner parameter to be set.'),
|
|
469
|
+
.describe('Specific repositories in "owner/repo" format. Can be a single repository string or array of repository strings. Requires owner parameter to be set.'),
|
|
463
470
|
language: z
|
|
464
471
|
.string()
|
|
465
472
|
.optional()
|
|
@@ -497,9 +504,8 @@ function registerGitHubSearchCodeTool(server) {
|
|
|
497
504
|
.optional()
|
|
498
505
|
.describe('Search scope: "file" for content search, "path" for filename/path search. If array provided, only first value is used due to GitHub API limitations.'),
|
|
499
506
|
}, {
|
|
500
|
-
title:
|
|
501
|
-
description:
|
|
502
|
-
'Supports language, file type, owner, repository, path, and visibility filtering.',
|
|
507
|
+
title: TOOL_NAMES.GITHUB_SEARCH_CODE,
|
|
508
|
+
description: TOOL_DESCRIPTIONS[TOOL_NAMES.GITHUB_SEARCH_CODE],
|
|
503
509
|
readOnlyHint: true,
|
|
504
510
|
destructiveHint: false,
|
|
505
511
|
idempotentHint: true,
|
|
@@ -578,7 +584,7 @@ async function searchGitHubCode(params) {
|
|
|
578
584
|
const owners = Array.isArray(params.owner)
|
|
579
585
|
? params.owner
|
|
580
586
|
: [params.owner];
|
|
581
|
-
const repos = params.repo;
|
|
587
|
+
const repos = Array.isArray(params.repo) ? params.repo : [params.repo];
|
|
582
588
|
// Create repo filters for each owner/repo combination
|
|
583
589
|
owners.forEach(owner => {
|
|
584
590
|
repos.forEach(repo => {
|
|
@@ -624,9 +630,8 @@ function registerFetchGitHubFileContentTool(server) {
|
|
|
624
630
|
.min(1)
|
|
625
631
|
.describe(`File path from repository root (e.g., 'README.md', 'src/index.js'). Use github_get_contents to explore structure.`),
|
|
626
632
|
}, {
|
|
627
|
-
title:
|
|
628
|
-
description:
|
|
629
|
-
`Handles text files up to 500KB, detects binary files, supports branch fallback.`,
|
|
633
|
+
title: TOOL_NAMES.GITHUB_GET_FILE_CONTENT,
|
|
634
|
+
description: TOOL_DESCRIPTIONS[TOOL_NAMES.GITHUB_GET_FILE_CONTENT],
|
|
630
635
|
readOnlyHint: true,
|
|
631
636
|
destructiveHint: false,
|
|
632
637
|
idempotentHint: true,
|
|
@@ -852,7 +857,7 @@ function registerSearchGitHubReposTool(server) {
|
|
|
852
857
|
.default(25)
|
|
853
858
|
.describe('Maximum results (default: 25, max: 50)'),
|
|
854
859
|
}, {
|
|
855
|
-
title:
|
|
860
|
+
title: TOOL_NAMES.GITHUB_SEARCH_REPOS,
|
|
856
861
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.GITHUB_SEARCH_REPOS],
|
|
857
862
|
readOnlyHint: true,
|
|
858
863
|
destructiveHint: false,
|
|
@@ -1132,7 +1137,7 @@ function registerSearchGitHubCommitsTool(server) {
|
|
|
1132
1137
|
.default(25)
|
|
1133
1138
|
.describe('Maximum results (default: 25)'),
|
|
1134
1139
|
}, {
|
|
1135
|
-
title:
|
|
1140
|
+
title: TOOL_NAMES.GITHUB_SEARCH_COMMITS,
|
|
1136
1141
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.GITHUB_SEARCH_COMMITS],
|
|
1137
1142
|
readOnlyHint: true,
|
|
1138
1143
|
destructiveHint: false,
|
|
@@ -1407,7 +1412,7 @@ function registerSearchGitHubPullRequestsTool(server) {
|
|
|
1407
1412
|
.default('desc')
|
|
1408
1413
|
.describe('Order (default: desc)'),
|
|
1409
1414
|
}, {
|
|
1410
|
-
title:
|
|
1415
|
+
title: TOOL_NAMES.GITHUB_SEARCH_PULL_REQUESTS,
|
|
1411
1416
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.GITHUB_SEARCH_PULL_REQUESTS],
|
|
1412
1417
|
readOnlyHint: true,
|
|
1413
1418
|
destructiveHint: false,
|
|
@@ -1544,7 +1549,7 @@ function registerNpmSearchTool(server) {
|
|
|
1544
1549
|
.default(20)
|
|
1545
1550
|
.describe('Max results per query (default: 20)'),
|
|
1546
1551
|
}, {
|
|
1547
|
-
title:
|
|
1552
|
+
title: TOOL_NAMES.NPM_PACKAGE_SEARCH,
|
|
1548
1553
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.NPM_PACKAGE_SEARCH],
|
|
1549
1554
|
readOnlyHint: true,
|
|
1550
1555
|
destructiveHint: false,
|
|
@@ -1663,7 +1668,7 @@ function registerViewRepositoryStructureTool(server) {
|
|
|
1663
1668
|
.describe('Directory path within repository (e.g., "src/components", "packages/core"). ' +
|
|
1664
1669
|
'Leave empty for root. Use previous results to navigate deeper.'),
|
|
1665
1670
|
}, {
|
|
1666
|
-
title:
|
|
1671
|
+
title: TOOL_NAMES.GITHUB_GET_CONTENTS,
|
|
1667
1672
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.GITHUB_GET_CONTENTS],
|
|
1668
1673
|
readOnlyHint: true,
|
|
1669
1674
|
destructiveHint: false,
|
|
@@ -1995,7 +2000,7 @@ function registerSearchGitHubIssuesTool(server) {
|
|
|
1995
2000
|
.default(25)
|
|
1996
2001
|
.describe('Maximum results (default: 25)'),
|
|
1997
2002
|
}, {
|
|
1998
|
-
title:
|
|
2003
|
+
title: TOOL_NAMES.GITHUB_SEARCH_ISSUES,
|
|
1999
2004
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.GITHUB_SEARCH_ISSUES],
|
|
2000
2005
|
readOnlyHint: true,
|
|
2001
2006
|
destructiveHint: false,
|
|
@@ -2112,7 +2117,7 @@ function registerNpmViewPackageTool(server) {
|
|
|
2112
2117
|
.min(1, 'Package name is required')
|
|
2113
2118
|
.describe('NPM package name to analyze. Returns complete package context including exports (critical for GitHub file discovery), repository URL, dependencies, and version history.'),
|
|
2114
2119
|
}, {
|
|
2115
|
-
title:
|
|
2120
|
+
title: TOOL_NAMES.NPM_VIEW_PACKAGE,
|
|
2116
2121
|
description: TOOL_DESCRIPTIONS[TOOL_NAMES.NPM_VIEW_PACKAGE],
|
|
2117
2122
|
readOnlyHint: true,
|
|
2118
2123
|
destructiveHint: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octocode-mcp",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for advanced GitHub repository analysis, code discovery, and npm package exploration. Provides AI assistants with powerful tools to search, analyze, and understand codebases across GitHub and npm ecosystems.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|