Supports cloning and managing source code from Git-based repositories for querying and context-efficient batch operations.
Provides capabilities to fetch and query source code directly from GitHub repositories by owner, repo, and specific Git refs.
Facilitates fetching, reading, and searching through source code for JavaScript and TypeScript packages and their dependencies.
Allows fetching, searching, and querying source code from the npm registry, enabling context-efficient analysis of Node.js dependencies.
Enables fetching and searching Python package source code from the Python Package Index (PyPI) for server-side querying and analysis.
Allows for the retrieval and exploration of Python dependency source code through PyPI and pip-compatible sources.
Supports fetching and searching source code for Rust crates from the crates.io registry.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opensrc-mcpfetch the zod package and search for where parse is defined"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
opensrc-mcp
A codemode MCP server for fetching and querying dependency source code.
Why?
Traditional MCP exposes tools directly to LLMs. This server uses the codemode pattern: agents write JavaScript that executes server-side, and only results return. Benefits:
Context efficient - Large source trees stay server-side
Batch operations - One call to search/read multiple files
LLMs are better at code - More training data for JS than tool-calling
Installation
OpenCode Configuration
Add to your OpenCode config (~/.config/opencode/config.json or project opencode.json):
Tools
search
Query fetched sources without consuming context. Data stays server-side.
Examples:
execute
Mutations: fetch packages, remove, clean.
Examples:
Package Formats
Format | Example | Description |
|
| npm (auto-detects version) |
|
| npm specific version |
|
| explicit npm |
|
| Python/PyPI |
|
| alias for pypi |
|
| Rust/crates.io |
|
| alias for crates |
|
| GitHub repo |
|
| GitHub at ref |
|
| explicit GitHub |
Output Structure
Sources are stored in opensrc/ in your project:
How It Works
Agent calls
executetool with JS code:async () => opensrc.fetch("zod")Code runs in sandboxed
vmcontext with injectedopensrcAPIServer fetches package via opensrc (handles registry lookup, git clone)
Only the result returns to agent context
License
MIT