octocode-mcp 2.3.10 → 2.3.12

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 +71 -173
  2. package/build/index.js +434 -346
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -3,7 +3,7 @@
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)
@@ -13,44 +13,25 @@
13
13
 
14
14
  ## What is Octocode? 🐙
15
15
 
16
- **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.
17
-
18
- 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.
19
17
 
18
+ Instead of manually browsing repositories, ask questions like:
20
19
  - *"How did React implement concurrent rendering?"*
21
20
  - *"Show me authentication patterns in Next.js applications"*
22
21
  - *"Find examples of how to use this specific API"*
23
22
  - *"What's the architecture of this library?"*
24
23
  - *"How do I use this MCP tool effectively?"*
25
24
 
26
- ## Recommended Use Cases
27
-
28
- **Use Octocode when you need to:**
29
-
30
- - **🔍 Understand implementations** - See how features work across different repositories
31
- - **📚 Find real code examples** - Discover patterns and best practices from production code
32
- - **🏗️ Analyze architecture** - Explore how systems are designed and structured
33
- - **🔬 Research approaches** - Compare different implementation strategies
34
- - **💡 Learn from code** - Deep-dive into technical details and understand "how does this work?"
35
-
36
25
  ## Unique Value Proposition
37
26
 
38
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.
39
28
 
40
- **🚀 Out-of-the-Box Advanced Search (Powered by AI):**
41
- - **🧠 Heuristic Search** - Intelligent pattern recognition that finds relevant code even with vague queries
42
- - **🔄 Smart Fallbacks** - Automatic retry with alternative search strategies when initial searches fail
43
- - **🎯 Smart Discovery** - AI-guided exploration that uncovers hidden connections and patterns
44
- - **🔗 Connection Intelligence** - Understands relationships between repositories, packages, and dependencies
45
- - **📊 Multi-dimensional Analysis** - Combines code, commits, issues, discussions, and package data
46
-
47
29
  **Key Differentiators:**
48
- - **🧠 Advanced AI Search** - Heuristic algorithms that understand code context and connections
49
- - **🔐 Secure & Simple** - No personal access tokens needed, uses [GitHub CLI](https://cli.github.com/) authentication
50
- - **🔗 Connected Discovery** - Maps NPM packages to repositories, traces dependencies, finds related code
51
- - **🌐 Cross-Ecosystem Understanding** - Works across any privilege level you have (public, private, organization)
52
-
53
- 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%
54
35
 
55
36
  ## Quick Start 🚀
56
37
 
@@ -74,13 +55,11 @@ gh auth login
74
55
  npm login
75
56
  ```
76
57
 
77
- **🔐 GitHub Authentication via CLI:**
78
- - ✅ **No personal access tokens needed** - Uses [GitHub CLI](https://cli.github.com/) behind the scenes
79
- - ✅ **Secure OAuth flow** - Browser-based authentication, no tokens to store
58
+ **🔐 Authentication Benefits:**
59
+ - ✅ **No personal access tokens** - Uses GitHub CLI OAuth flow
80
60
  - ✅ **Enterprise ready** - Works with SSO, 2FA, and organization access
81
- - ✅ **Private repository access** - Automatically detects your organizations and accesses private repos
82
- - ✅ **Zero configuration** - Uses your existing `gh` CLI permissions
83
-
61
+ - ✅ **Automatic organization detection** - Instantly accesses your private repositories
62
+ - ✅ **Zero configuration** - Uses existing `gh` CLI permissions
84
63
 
85
64
  ### 3. Add to MCP Configuration
86
65
  ```json
@@ -92,157 +71,95 @@ npm login
92
71
  }
93
72
  ```
94
73
 
95
- **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.
96
75
 
97
- ## How Octocode Works 🔄
76
+ ## How It Works 🔄
98
77
 
99
78
  **Smart Discovery Flow:**
100
- 1. **🔍 Query Analysis** → AI determines the best search strategy based on your question
101
- 2. **⚡ Multi-Tool Orchestration** → Intelligently combines 10 specialized tools across GitHub + NPM
102
- 3. **🔄 Smart Fallbacks** → Automatically retries with different approaches if initial search fails
103
- 4. **🔗 Cross-Reference Discovery** → Links packages to repositories, finds related implementations with commit SHA integration
104
- 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
105
84
 
106
85
  ## Example Flows
107
86
 
108
87
  ### Example 1: LangGraph Node.js Implementation Tutorial
109
88
  **Query:** "Show implementations of langgraph in node js. Make a tutorial for how to implement a simple agent using OpenAI API."
110
89
 
111
- [![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>
112
91
 
113
92
  ### Example 2: Zustand React State Management
114
93
  **Query:** "Show me how to add zustand to react application. Show examples and best practices"
115
94
 
116
- [![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>
117
96
 
118
97
  ### Example 3: React vs Vue.js Rendering Comparison
119
98
  **Query:** "How did React implement their concurrent rendering flows? How is it different from Vue.js rendering mechanism? Which is better?"
120
99
 
121
- [![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>
122
101
 
123
102
  ## Core Features 🛠️
124
103
 
125
- ### 🧠 AI-Powered Advanced Search
126
- - **Heuristic Pattern Recognition** - Finds relevant code even with vague or incomplete queries
127
- - **Smart Fallback Strategies** - Automatically tries alternative approaches when searches fail with actionable suggestions
128
- - **Boolean Search Intelligence** - Automatic query optimization with smart boolean operators (3-5x performance improvement)
129
- - **Context-Aware Discovery** - Understands code relationships and suggests related implementations
130
- - **Multi-Strategy Search** - Combines semantic, syntactic, and dependency-based search methods
131
- - **Graceful Error Recovery** - Comprehensive error handling with intelligent retry mechanisms
132
-
133
- ### 🔗 Connection Intelligence
134
- - **Repository-Package Mapping** - Automatically links NPM packages to their GitHub repositories
135
- - **Dependency Tracing** - Follows dependency chains across the entire ecosystem
136
- - **Cross-Reference Analysis** - Finds how different projects implement similar patterns
137
- - **Ecosystem Understanding** - Maps relationships between libraries, frameworks, and tools
138
-
139
- ### 🌐 Universal Access & Discovery
140
- - **Cross-Privilege Search** - Works with any access level you have (public, private, organization)
141
- - **Organization-Aware** - Automatically detects and uses your GitHub organization memberships
142
- - **Smart Repository Discovery** - Finds relevant repositories even when you don't know they exist
143
- - **Progressive Refinement** - AI-guided search that gets more precise with each iteration
144
-
145
- ### 📊 Multi-Dimensional Analysis
146
- - **Code + Context** - Combines source code with commits, issues, discussions, and documentation
147
- - **Historical Understanding** - Tracks how implementations evolved over time
148
- - **Community Insights** - Discovers patterns from real-world usage and discussions
149
- - **Quality Signals** - Uses NPM publication and GitHub activity as quality indicators
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
150
110
 
151
111
  ### 🔗 Commit SHA Integration
152
- - **Time Travel Code Viewing** - View files from specific commits and pull requests using commit SHAs
153
- - **PR Code Analysis** - Automatically fetch commit SHAs from pull requests for precise code comparison
154
- - **Historical Implementation** - Compare how code evolved across different commits and versions
155
- - **Cross-Reference Discovery** - Link commits, pull requests, and current implementations seamlessly
156
-
157
- ### ⚡ LLM Content Optimization
158
- - **Intelligent Content Selection** - Automatically identifies and extracts only relevant code sections for research
159
- - **Smart Minification** - Advanced content compression that preserves meaning while reducing tokens by 80-90%
160
- - **Partial File Access** - Fetches targeted line ranges from search results, avoiding full file downloads
161
- - **Context-Aware Processing** - Indentation-aware minification for 15+ programming languages
162
- - **Binary Detection & Filtering** - Automatically skips non-text files and suggests alternatives
163
- - **Token Efficiency** - Optimizes content for maximum LLM comprehension with minimal token usage
164
- - **Line Number Preservation** - Maintains precise line references for code navigation and debugging
165
-
166
- **Optimization Workflow:**
167
- 1. **🎯 Smart Targeting** → Extract specific line ranges from search results
168
- 2. **🧹 Content Filtering** → Remove comments, whitespace, and non-essential elements
169
- 3. **🗜️ Intelligent Compression** → Language-aware minification preserving code structure
170
- 4. **📍 Context Preservation** → Keep essential context and line number references
171
- 5. **⚡ Token Optimization** → Deliver maximum code insight with minimal LLM token consumption
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
172
115
 
173
- ## Available Tools 🛠️
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
174
121
 
175
- Octocode provides **10 specialized tools** that work together intelligently:
122
+ ## Available Tools
176
123
 
177
- **🔍 Discovery Tools:**
178
- - **Repository Search** - Find repositories by topic, language, stars, and organization
179
- - **Package Search** - Discover NPM packages by functionality and keywords
124
+ **10 specialized tools** working together intelligently:
180
125
 
181
- **📊 Analysis Tools:**
182
- - **Code Search** - Smart search across GitHub repositories with heuristic pattern recognition
183
- - **Package Analysis** - Detailed NPM package analysis with repository linking
184
- - **Repository Structure** - Explore directory structures and file organization
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
185
130
 
186
- **📈 Activity Tools:**
187
- - **Commit Search** - Find commits by message, author, and date with SHA integration
188
- - **Pull Request Search** - Discover PRs with automatic commit SHA extraction
189
- - **Issue Search** - Find bug reports, feature requests, and discussions
131
+ All tools feature automatic cross-referencing and intelligent fallbacks.
190
132
 
191
- **📁 Content Tools:**
192
- - **File Content Fetching** - Read files from any commit, branch, or PR using commit SHAs
193
- - **API Status Check** - Verify authentication and discover organization access
194
-
195
- **Smart Integration:** All tools work together through intelligent workflows - from package discovery → repository analysis → commit history → file content, with automatic fallbacks and cross-referencing.
196
-
197
- ## Privacy & Security 🛡️
133
+ ## Security & Privacy 🛡️
198
134
 
135
+ ### Local-First Architecture
199
136
  - **🏠 100% Local** - Runs entirely on your machine
200
- - **🚫 Zero Data Collection** - No telemetry, logging, or data transmission
201
- - **🔑 No Token Management** - Uses [GitHub CLI](https://cli.github.com/) authentication, no personal access tokens needed
202
- - **🛡️ Privacy by Design** - All API calls use your existing `gh` CLI permissions directly
203
-
204
- ### Command Execution Security 🔒
205
-
206
- **Robust protection against prompt injections and malicious command execution:**
207
-
208
- - **⚪ Allowlisted Commands Only** - Only pre-approved, safe NPM and GitHub CLI commands are executable
209
- - NPM: `view`, `search`, `config`, `whoami`
210
- - GitHub CLI: `search`, `api`, `auth`, `org`, `pr`
211
- - **🛡️ Argument Sanitization** - All command arguments are properly escaped to prevent shell injection attacks
212
- - **✅ Pre-execution Validation** - Every command is validated against allowed lists before execution
213
- - **🔧 Controlled Environment** - Commands run in a secure, cross-platform shell environment with controlled variables
214
- - **Cross-platform shells**: Uses `/bin/sh` on Unix/macOS, `cmd.exe` or `powershell.exe` on Windows - minimal, standard shells
215
- - **PowerShell support**: Modern Windows environments can optionally use PowerShell with enhanced security
216
- - **Why minimal shells are safe**: Avoids user's potentially customized shells with aliases, functions, plugins, or advanced features
217
- - **Controlled variables**: Only essential environment variables (`PATH`, `SHELL`) are passed, preventing environment-based attacks
218
- - **Platform-specific escaping**: Uses appropriate argument escaping for each platform (single quotes on Unix, double quotes for CMD, single quotes for PowerShell)
219
- - **🚫 No Arbitrary Execution** - System cannot execute arbitrary shell commands or scripts
220
- - **⏱️ 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
221
139
 
222
- ## 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
223
146
 
224
- **AI-Powered Search Tips:**
225
- - **Let AI guide you** - Start with natural language questions, the heuristic search will find relevant code
226
- - **Trust the smart fallbacks** - If initial search doesn't work, AI automatically tries alternative strategies
227
- - **Explore connections** - Ask about relationships between packages, libraries, and implementations
228
- - **Use any privilege level** - Works seamlessly across public repos, private repos, and organization repositories
229
- - **Keep research along the MCP** - Build upon previous searches and maintain context across multiple queries for deeper exploration
147
+ ## Best Practices 💡
230
148
 
231
149
  **Effective Questions:**
232
- - **Vague is OK** - "How does authentication work?" → AI finds relevant patterns across repositories
233
- - **Ask for connections** - "What libraries use this pattern?" → Discovers related implementations
234
- - **Cross-ecosystem queries** - "NPM packages that implement X" → Links packages to their repositories
235
- - **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?"
236
154
 
237
- **Advanced Search Features:**
238
- - **Automatic fallbacks** - No need to retry failed searches, AI handles it automatically
239
- - **Smart discovery** - Finds repositories and packages you didn't know existed
240
- - **Connection mapping** - Understands relationships between different codebases
241
- - **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
242
160
 
243
161
  ## Troubleshooting 🔧
244
162
 
245
- **Authentication Issues:**
246
163
  ```bash
247
164
  # Check GitHub CLI status
248
165
  gh auth status
@@ -252,43 +169,24 @@ gh auth logout && gh auth login
252
169
 
253
170
  # Check NPM access
254
171
  npm whoami
172
+
173
+ # Clear NPX cache if needed
174
+ rm -rf ~/.npm/_npx
255
175
  ```
256
176
 
257
177
  **Common Solutions:**
258
178
  - No results? Try broader search terms
259
- - Private repos not found? Check organization membership with `gh auth status`
260
- - NPX issues? Clear cache: `rm -rf ~/.npm/_npx`
261
-
262
- **🏢 Organization & Private Repository Access:**
263
- - **Automatic detection** - Octocode automatically discovers your GitHub organizations
264
- - **No additional setup** - If you have access to private repos through your organization, they work immediately
265
- - **Verify access** - Run `gh auth status` to see your organization memberships
266
-
267
- **💻 Windows PowerShell Support:**
268
- - **Modern shell support** - Optionally use PowerShell instead of cmd.exe on Windows
269
- - **Enhanced security** - PowerShell provides better argument escaping and modern features
270
- - **Automatic detection** - The system automatically detects Windows and applies appropriate shell configurations
271
- - **Zero configuration** - Works seamlessly with existing setups, no additional configuration needed
272
-
273
- **Why GitHub CLI Authentication?**
274
- - ✅ **No token creation** - GitHub CLI handles OAuth flow automatically
275
- - ✅ **Enterprise compatible** - Works with SSO, SAML, and 2FA out of the box
276
- - ✅ **Organization auto-detection** - Automatically discovers your GitHub organizations and private repo access
277
- - ✅ **Works out of the box** - If you work for an organization, private repositories are immediately accessible
278
- - ❌ **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
279
181
 
280
182
  ## Background 💭
281
183
 
282
- 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**.
283
-
284
- 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**.
285
185
 
186
+ The goal: **make code exploration as intelligent as having a senior developer guide you through any codebase.**
286
187
 
287
188
  ## License 📄
288
189
 
289
190
  MIT License - See [LICENSE](./LICENSE.md) for details.
290
191
 
291
- ---
292
-
293
-
294
-
192
+ ---