- Home
- MCP servers
- opensrc-mcp
opensrc-mcp
- typescript
8
GitHub Stars
typescript
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"dmmulroy-opensrc-mcp": {
"command": "npx",
"args": [
"-y",
"opensrc-mcp"
]
}
}
}You can run this MCP server locally to fetch and query dependency source code using a server-side JavaScript API. It keeps large source trees on the server, supports batch operations, and returns only results to the client, making it efficient for agents that analyze code.
How to use
You interact with the server through a single tool that exposes all read and mutation operations. Your client writes JavaScript that runs on the server side, and you receive structured results back. Typical workflows include listing available sources, fetching dependencies from registries or repositories, inspecting files, and performing searches or reads across multiple files. Use the provided API to fetch sources, read files, list trees, and run searches. Results come back as plain data, while the server handles all heavy lifting on your behalf.
How to install
Prerequisites: Node.js and npm must be available on your machine.
Install the MCP server globally so you can run it from anywhere.
npm install -g opensrc-mcp
Alternatively, you can run the MCP server directly without a global install.
npx opensrc-mcp
Configure the MCP client to connect to the server. If you are using the local setup, add an OpenCode (or equivalent) configuration like this to enable the local server path.
{
"mcp": {
"opensrc": {
"type": "local",
"command": "npx",
"args": ["-y", "opensrc-mcp"]
}
}
}
Additional information
The server provides a single tool named execute that runs a JavaScript sandbox with an injected API to manage sources and queries. The API supports read operations like list, has, get, files, tree, grep, astGrep, read, readMany, and resolve, as well as mutation operations like fetch, remove, and clean. All work happens inside a sandboxed environment; only the results are sent back to your agent.
Storage for fetched sources is organized under a global directory (default: ~). You can override this location with environment configuration where needed.
Usage patterns and tips
-
Fetch a single package by name to bring it into the server for analysis. For example, fetch a package and then read specific files or search within the fetched sources.
-
Use tree and files to navigate the fetched sources and locate relevant code, followed by read or readMany to pull content for inspection.
-
When performing large-scale searches, prefer grep for text-based queries and astGrep for structural patterns in TypeScript or JavaScript files.
Notes on configuration and security
The server is designed to keep heavy data on the server side and return only results. Ensure your agent environment trusts the sandbox and that you follow your organization’s security guidelines when fetching and inspecting external sources.
Available tools
list
Return a list of all fetched sources available in the MCP repository.
has
Check if a given source name exists, optionally verifying a specific version.
get
Retrieve a source by name, returning its metadata if present.
files
List files within a source matching an optional glob pattern.
tree
Return a hierarchical representation of a source with an optional depth.
grep
Search text patterns across sources with optional scope and limits.
astGrep
Search for structural patterns in source code using AST-aware matching.
read
Read the contents of a specific file within a source.
readMany
Read multiple files from a single source, supporting globs.
resolve
Resolve a dependency specification to a concrete source.
fetch
Fetch one or more sources from registries or repositories, with optional modification.
remove
Remove one or more fetched sources from the local storage.
clean
Clean cached sources by type, such as packages or repos.