octocode-mcp 2.3.9 → 2.3.11

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.
Files changed (3) hide show
  1. package/README.md +80 -135
  2. package/build/index.js +112536 -1961
  3. package/package.json +11 -7
package/README.md CHANGED
@@ -3,53 +3,35 @@
3
3
  **The Perfect AI Code Assistant - Advanced Search & Discovery Across GitHub & NPM**
4
4
 
5
5
  <div>
6
- <img src="./assets/logo.png">
6
+ <img src="./assets/logo.png" width="400px">
7
7
 
8
8
  [![Version](https://img.shields.io/badge/version-2.3.2-blue.svg)](./package.json)
9
9
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](./package.json)
10
10
  [![MCP](https://img.shields.io/badge/MCP-Compatible-purple.svg)](https://modelcontextprotocol.io/)
11
+ [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-☕-orange.svg)](https://buymeacoffee.com/bgauryy)
11
12
  </div>
12
13
 
13
14
  ## What is Octocode? 🐙
14
15
 
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.
16
-
17
- Instead of manually browsing repositories, you can ask questions like:
16
+ **The perfect code assistant that can help understand anything.** Octocode provides AI-powered advanced search with heuristic discovery and smart fallbacks to understand connections between repositories and NPM packages across any privilege level you have.
18
17
 
18
+ Instead of manually browsing repositories, ask questions like:
19
19
  - *"How did React implement concurrent rendering?"*
20
20
  - *"Show me authentication patterns in Next.js applications"*
21
21
  - *"Find examples of how to use this specific API"*
22
22
  - *"What's the architecture of this library?"*
23
23
  - *"How do I use this MCP tool effectively?"*
24
24
 
25
- ## Recommended Use Cases
26
-
27
- **Use Octocode when you need to:**
28
-
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?"
34
-
35
25
  ## Unique Value Proposition
36
26
 
37
27
  **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.
38
28
 
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
45
-
46
29
  **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)
51
-
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?"*
30
+ - **🧠 AI-Powered Search** - Heuristic algorithms with smart fallbacks that understand code context and find relevant code even with vague queries
31
+ - **🔐 Zero-Config Security** - Uses GitHub CLI authentication - no personal access tokens needed
32
+ - **🔗 Connection Intelligence** - Maps NPM packages to repositories, traces dependencies, finds related implementations
33
+ - **🌐 Universal Access** - Works seamlessly with public, private, and organization repositories
34
+ - **⚡ LLM Optimized** - Advanced content minification and partial fetching reduces token usage by 80-90%
53
35
 
54
36
  ## Quick Start 🚀
55
37
 
@@ -73,13 +55,11 @@ gh auth login
73
55
  npm login
74
56
  ```
75
57
 
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
58
+ **🔐 Authentication Benefits:**
59
+ - ✅ **No personal access tokens** - Uses GitHub CLI OAuth flow
79
60
  - ✅ **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
82
-
61
+ - ✅ **Automatic organization detection** - Instantly accesses your private repositories
62
+ - ✅ **Zero configuration** - Uses existing `gh` CLI permissions
83
63
 
84
64
  ### 3. Add to MCP Configuration
85
65
  ```json
@@ -91,111 +71,95 @@ npm login
91
71
  }
92
72
  ```
93
73
 
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**.
74
+ **That's it!** Octocode automatically works with your organization's private repositories.
95
75
 
96
- ## How Octocode Works 🔄
76
+ ## How It Works 🔄
97
77
 
98
78
  **Smart Discovery Flow:**
99
- 1. **🔍 Query Analysis** → AI determines the best search strategy based on your question
100
- 2. **⚡ Multi-Tool Orchestration** → Combines GitHub + NPM searches intelligently
101
- 3. **🔄 Smart Fallbacks** → Automatically retries with different approaches if initial search fails
102
- 4. **🔗 Cross-Reference Discovery** → Links packages to repositories, finds related implementations
103
- 5. **🎯 Context Synthesis** → Provides comprehensive understanding across multiple sources
79
+ 1. **🔍 Query Analysis** → AI determines the best search strategy
80
+ 2. **⚡ Multi-Tool Orchestration** → Intelligently combines 10 specialized tools
81
+ 3. **🔄 Smart Fallbacks** → Automatically retries with different approaches
82
+ 4. **🔗 Cross-Reference Discovery** → Links packages to repositories with commit SHA integration
83
+ 5. **🎯 Context Synthesis** → Provides comprehensive understanding
104
84
 
105
85
  ## Example Flows
106
86
 
107
87
  ### Example 1: LangGraph Node.js Implementation Tutorial
108
88
  **Query:** "Show implementations of langgraph in node js. Make a tutorial for how to implement a simple agent using OpenAI API."
109
89
 
110
- [![LangGraph Node.js Tutorial](assets/langchainTutorial.gif)](https://youtu.be/E5HUlRckpvg?si=XXLle59C92esDscS)
90
+ <a href="https://youtu.be/E5HUlRckpvg?si=XXLle59C92esDscS"><img src="assets/langchainTutorial.gif" alt="LangGraph Node.js Tutorial" width="50%"></a>
111
91
 
112
92
  ### Example 2: Zustand React State Management
113
93
  **Query:** "Show me how to add zustand to react application. Show examples and best practices"
114
94
 
115
- [![Zustand React State Management](assets/reactZustand.gif)](https://youtu.be/EgYbsuWmqsI?si=CN_KwCPgwprImynU)
95
+ <a href="https://youtu.be/EgYbsuWmqsI?si=CN_KwCPgwprImynU"><img src="assets/reactZustand.gif" alt="Zustand React State Management" width="50%"></a>
116
96
 
117
97
  ### Example 3: React vs Vue.js Rendering Comparison
118
98
  **Query:** "How did React implement their concurrent rendering flows? How is it different from Vue.js rendering mechanism? Which is better?"
119
99
 
120
- [![React vs Vue.js Rendering Comparison](assets/reactVSVueJS.gif)](https://youtu.be/-_pbCbLXKDc?si=KiPeGCzmwWtb6G3r)
100
+ <a href="https://youtu.be/-_pbCbLXKDc?si=KiPeGCzmwWtb6G3r"><img src="assets/reactVSVueJS.gif" alt="React vs Vue.js Rendering Comparison" width="50%"></a>
121
101
 
122
102
  ## Core Features 🛠️
123
103
 
124
- ### 🧠 AI-Powered Advanced Search
125
- - **Heuristic Pattern Recognition** - Finds relevant code even with vague or incomplete queries
126
- - **Smart Fallback Strategies** - Automatically tries alternative approaches when searches fail with actionable suggestions
127
- - **Boolean Search Intelligence** - Automatic query optimization with smart boolean operators (3-5x performance improvement)
128
- - **Context-Aware Discovery** - Understands code relationships and suggests related implementations
129
- - **Multi-Strategy Search** - Combines semantic, syntactic, and dependency-based search methods
130
- - **Graceful Error Recovery** - Comprehensive error handling with intelligent retry mechanisms
131
-
132
- ### 🔗 Connection Intelligence
133
- - **Repository-Package Mapping** - Automatically links NPM packages to their GitHub repositories
134
- - **Dependency Tracing** - Follows dependency chains across the entire ecosystem
135
- - **Cross-Reference Analysis** - Finds how different projects implement similar patterns
136
- - **Ecosystem Understanding** - Maps relationships between libraries, frameworks, and tools
137
-
138
- ### 🌐 Universal Access & Discovery
139
- - **Cross-Privilege Search** - Works with any access level you have (public, private, organization)
140
- - **Organization-Aware** - Automatically detects and uses your GitHub organization memberships
141
- - **Smart Repository Discovery** - Finds relevant repositories even when you don't know they exist
142
- - **Progressive Refinement** - AI-guided search that gets more precise with each iteration
143
-
144
- ### 📊 Multi-Dimensional Analysis
145
- - **Code + Context** - Combines source code with commits, issues, discussions, and documentation
146
- - **Historical Understanding** - Tracks how implementations evolved over time
147
- - **Community Insights** - Discovers patterns from real-world usage and discussions
148
- - **Quality Signals** - Uses NPM publication and GitHub activity as quality indicators
149
-
150
- ## Privacy & Security 🛡️
104
+ ### 🧠 AI-Powered Intelligence
105
+ - **Advanced Search** - Heuristic pattern recognition with automatic fallback strategies
106
+ - **Connection Mapping** - Automatically links NPM packages to GitHub repositories
107
+ - **Cross-Reference Analysis** - Discovers how different projects implement similar patterns
108
+ - **Progressive Refinement** - AI-guided search that improves with each iteration
109
+ - **Context-Aware Discovery** - Understands relationships between code, commits, issues, and discussions
110
+
111
+ ### 🔗 Commit SHA Integration
112
+ - **Time Travel Code Viewing** - View files from specific commits and pull requests
113
+ - **PR Code Analysis** - Automatically fetch commit SHAs for precise code comparison
114
+ - **Historical Implementation** - Compare code evolution across versions
115
+
116
+ ### Performance Optimization
117
+ - **Smart Content Selection** - Extracts only relevant code sections
118
+ - **Advanced Minification** - Language-aware compression preserving meaning
119
+ - **Partial File Access** - Fetches targeted line ranges
120
+ - **Token Efficiency** - 80-90% reduction in LLM token usage
121
+
122
+ ## Available Tools
123
+
124
+ **10 specialized tools** working together intelligently:
151
125
 
126
+ **Discovery:** Repository Search, Package Search
127
+ **Analysis:** Code Search, Package Analysis, Repository Structure
128
+ **Activity:** Commit Search, Pull Request Search, Issue Search
129
+ **Content:** File Content Fetching, API Status Check
130
+
131
+ All tools feature automatic cross-referencing and intelligent fallbacks.
132
+
133
+ ## Security & Privacy 🛡️
134
+
135
+ ### Local-First Architecture
152
136
  - **🏠 100% Local** - Runs entirely on your machine
153
- - **🚫 Zero Data Collection** - No telemetry, logging, or data transmission
154
- - **🔑 No Token Management** - Uses [GitHub CLI](https://cli.github.com/) authentication, no personal access tokens needed
155
- - **🛡️ Privacy by Design** - All API calls use your existing `gh` CLI permissions directly
156
-
157
- ### Command Execution Security 🔒
158
-
159
- **Robust protection against prompt injections and malicious command execution:**
160
-
161
- - **⚪ Allowlisted Commands Only** - Only pre-approved, safe NPM and GitHub CLI commands are executable
162
- - NPM: `view`, `search`, `ping`, `config`, `whoami`
163
- - GitHub CLI: `search`, `api`, `auth`, `org`
164
- - **🛡️ Argument Sanitization** - All command arguments are properly escaped to prevent shell injection attacks
165
- - **✅ Pre-execution Validation** - Every command is validated against allowed lists before execution
166
- - **🔧 Controlled Environment** - Commands run in a secure, cross-platform shell environment with controlled variables
167
- - **Cross-platform shells**: Uses `/bin/sh` on Unix/macOS, `cmd.exe` or `powershell.exe` on Windows - minimal, standard shells
168
- - **PowerShell support**: Modern Windows environments can optionally use PowerShell with enhanced security
169
- - **Why minimal shells are safe**: Avoids user's potentially customized shells with aliases, functions, plugins, or advanced features
170
- - **Controlled variables**: Only essential environment variables (`PATH`, `SHELL`) are passed, preventing environment-based attacks
171
- - **Platform-specific escaping**: Uses appropriate argument escaping for each platform (single quotes on Unix, double quotes for CMD, single quotes for PowerShell)
172
- - **🚫 No Arbitrary Execution** - System cannot execute arbitrary shell commands or scripts
173
- - **⏱️ Timeout Protection** - All commands have execution timeouts to prevent resource exhaustion
137
+ - **🚫 Zero Data Collection** - No telemetry or data transmission
138
+ - **🔑 No Token Management** - Uses GitHub CLI authentication
174
139
 
175
- ## Best Practices 💡
140
+ ### Command Execution Security
141
+ - **⚪ Allowlisted Commands Only** - Pre-approved safe commands
142
+ - **🛡️ Argument Sanitization** - Prevents shell injection attacks
143
+ - **✅ Pre-execution Validation** - Every command is validated
144
+ - **🔧 Controlled Environment** - Cross-platform secure shell execution
145
+ - **⏱️ Timeout Protection** - Prevents resource exhaustion
176
146
 
177
- **AI-Powered Search Tips:**
178
- - **Let AI guide you** - Start with natural language questions, the heuristic search will find relevant code
179
- - **Trust the smart fallbacks** - If initial search doesn't work, AI automatically tries alternative strategies
180
- - **Explore connections** - Ask about relationships between packages, libraries, and implementations
181
- - **Use any privilege level** - Works seamlessly across public repos, private repos, and organization repositories
182
- - **Keep research along the MCP** - Build upon previous searches and maintain context across multiple queries for deeper exploration
147
+ ## Best Practices 💡
183
148
 
184
149
  **Effective Questions:**
185
- - **Vague is OK** - "How does authentication work?" → AI finds relevant patterns across repositories
186
- - **Ask for connections** - "What libraries use this pattern?" → Discovers related implementations
187
- - **Cross-ecosystem queries** - "NPM packages that implement X" → Links packages to their repositories
188
- - **Evolution questions** - "How has this approach changed?" → Traces implementation history
150
+ - Start with natural language - "How does authentication work?"
151
+ - Ask for connections - "What libraries use this pattern?"
152
+ - Cross-ecosystem queries - "NPM packages that implement X"
153
+ - Evolution questions - "How has this approach changed?"
189
154
 
190
- **Advanced Search Features:**
191
- - **Automatic fallbacks** - No need to retry failed searches, AI handles it automatically
192
- - **Smart discovery** - Finds repositories and packages you didn't know existed
193
- - **Connection mapping** - Understands relationships between different codebases
194
- - **Context preservation** - Maintains search context across multiple queries
155
+ **Pro Tips:**
156
+ - Let AI guide discovery - vague queries work great
157
+ - Trust smart fallbacks - automatic retry with alternatives
158
+ - Build on previous searches - maintain context for deeper exploration
159
+ - Works everywhere - public, private, and organization repositories
195
160
 
196
161
  ## Troubleshooting 🔧
197
162
 
198
- **Authentication Issues:**
199
163
  ```bash
200
164
  # Check GitHub CLI status
201
165
  gh auth status
@@ -205,43 +169,24 @@ gh auth logout && gh auth login
205
169
 
206
170
  # Check NPM access
207
171
  npm whoami
172
+
173
+ # Clear NPX cache if needed
174
+ rm -rf ~/.npm/_npx
208
175
  ```
209
176
 
210
177
  **Common Solutions:**
211
178
  - No results? Try broader search terms
212
- - Private repos not found? Check organization membership with `gh auth status`
213
- - NPX issues? Clear cache: `rm -rf ~/.npm/_npx`
214
-
215
- **🏢 Organization & Private Repository Access:**
216
- - **Automatic detection** - Octocode automatically discovers your GitHub organizations
217
- - **No additional setup** - If you have access to private repos through your organization, they work immediately
218
- - **Verify access** - Run `gh auth status` to see your organization memberships
219
-
220
- **💻 Windows PowerShell Support:**
221
- - **Modern shell support** - Optionally use PowerShell instead of cmd.exe on Windows
222
- - **Enhanced security** - PowerShell provides better argument escaping and modern features
223
- - **Automatic detection** - The system automatically detects Windows and applies appropriate shell configurations
224
- - **Zero configuration** - Works seamlessly with existing setups, no additional configuration needed
225
-
226
- **Why GitHub CLI Authentication?**
227
- - ✅ **No token creation** - GitHub CLI handles OAuth flow automatically
228
- - ✅ **Enterprise compatible** - Works with SSO, SAML, and 2FA out of the box
229
- - ✅ **Organization auto-detection** - Automatically discovers your GitHub organizations and private repo access
230
- - ✅ **Works out of the box** - If you work for an organization, private repositories are immediately accessible
231
- - ❌ **vs Personal Access Tokens** - No manual creation, rotation, or security risks
179
+ - Private repos not found? Check `gh auth status` for organization membership
180
+ - Windows users? PowerShell is automatically supported
232
181
 
233
182
  ## Background 💭
234
183
 
235
- 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**.
236
-
237
- 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.
184
+ 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 evolved into **the perfect code assistant that can help understand anything**.
238
185
 
186
+ The goal: **make code exploration as intelligent as having a senior developer guide you through any codebase.**
239
187
 
240
188
  ## License 📄
241
189
 
242
190
  MIT License - See [LICENSE](./LICENSE.md) for details.
243
191
 
244
- ---
245
-
246
-
247
-
192
+ ---