Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
29995d5
Bump commons-io:commons-io from 2.10.0 to 2.14.0 in /tests
dependabot[bot] Nov 19, 2024
bbf1bf4
Bump requests from 2.12.1 to 2.32.2
dependabot[bot] Nov 19, 2024
a2b5958
Merge pull request #1 from cognitivegears/dependabot/maven/tests/comm…
cognitivegears Nov 19, 2024
3fe4f10
Merge pull request #2 from cognitivegears/dependabot/pip/requests-2.32.2
cognitivegears Nov 19, 2024
109788d
Fix multiline string formatting in main function
cognitivegears Nov 19, 2024
4a89de0
Handle 404 status code and improve error handling in recv_pkg_info fu…
cognitivegears Nov 19, 2024
ccff951
Add PyPI scanner and update requirements for requirements-parser
cognitivegears Nov 19, 2024
0f9b594
Refactor file path handling in Maven and NPM scanners to use os.path.…
cognitivegears Nov 19, 2024
1fdb1fc
Fix argument parsing and improve error handling in package functions
cognitivegears Nov 20, 2024
8ddbc6a
Refactor package manager handling and error codes; introduce constant…
cognitivegears Nov 20, 2024
a81e6c9
Add logging functionality and improve error handling across package r…
cognitivegears Nov 20, 2024
9a82db0
Add recursive scanning option for package managers and enhance error …
cognitivegears Nov 20, 2024
8d100be
Remove duplicate entries in dependency lists across Maven, NPM, and P…
cognitivegears Nov 20, 2024
bebd71f
Changed packages not exist to a warning
cognitivegears Nov 20, 2024
98aa05d
Add error handling for warnings and new exit code for package not found
cognitivegears Nov 20, 2024
3455502
Update project configuration and dependencies
cognitivegears Nov 20, 2024
05a0c23
Enhance package analysis with detailed docstrings and logging improve…
cognitivegears Nov 20, 2024
b277998
Add request timeout handling and constant for HTTP requests
cognitivegears Nov 20, 2024
11460d6
Moved argument parsing for Combobulator
cognitivegears Nov 20, 2024
f8a39b2
Remove currently unused GitHub token argument
cognitivegears Nov 20, 2024
60dc060
Update README to include 'pypi' as a supported package manager type a…
cognitivegears Nov 20, 2024
5a52358
Possible fix/workaround for old scan issue
cognitivegears Nov 22, 2024
6bdbfcb
Version count conditional backwards
cognitivegears Nov 22, 2024
5593b01
Added rate limiting, added additional npm info for heuristics, and ad…
cognitivegears Nov 22, 2024
2976da0
Remove unused imports from combobulator.py
cognitivegears Nov 22, 2024
ae5c7d7
Add JSON export functionality and update README with new argument
cognitivegears Nov 22, 2024
e12bfa2
Refactor heuristics scoring logic to use default thresholds from Defa…
cognitivegears Nov 22, 2024
e665ccb
Add risk assessment properties and update heuristics logic for packag…
cognitivegears Nov 22, 2024
68ec38d
Add risk assessment check and update export functions to include risk…
cognitivegears Nov 22, 2024
f9a2ea9
Update risk handling in combobulator.py to log identified risks and a…
cognitivegears Nov 22, 2024
65e6d1d
Add quiet mode option to suppress console output and adjust logging c…
cognitivegears Nov 22, 2024
d220fbd
Added CONTRIBUTERS.md file
cognitivegears Nov 24, 2024
676c0a5
Bump requests from 2.32.2 to 2.32.4
dependabot[bot] Jun 10, 2025
e61e19d
Bump org.apache.commons:commons-lang3 from 3.10 to 3.18.0 in /tests
dependabot[bot] Jul 12, 2025
6a8b963
Merge pull request #3 from cognitivegears/dependabot/pip/requests-2.32.4
cognitivegears Sep 3, 2025
37b7f70
Merge pull request #4 from cognitivegears/dependabot/maven/tests/org.…
cognitivegears Sep 3, 2025
ea0a833
Moved to uv
cognitivegears Sep 3, 2025
da2cf7c
Renamed to depgate
cognitivegears Sep 3, 2025
cf8709e
Updates for release
cognitivegears Sep 3, 2025
2d3c6a1
Updated README
cognitivegears Sep 4, 2025
19b3bc3
Bump actions/checkout from 4 to 5
dependabot[bot] Sep 4, 2025
f8e04b1
Update requests requirement from <2.32.5,>=2.32.4 to >=2.32.4,<2.32.6
dependabot[bot] Sep 4, 2025
904f163
Bump actions/download-artifact from 4 to 5
dependabot[bot] Sep 4, 2025
b6729ea
Merge pull request #5 from cognitivegears/dependabot/github_actions/a…
cognitivegears Sep 4, 2025
5e3ebaa
Merge pull request #6 from cognitivegears/dependabot/pip/requests-gte…
cognitivegears Sep 4, 2025
eb81f98
Merge pull request #7 from cognitivegears/dependabot/github_actions/a…
cognitivegears Sep 4, 2025
5a63e28
Small visual improvements
cognitivegears Sep 4, 2025
15e569a
Fixed some pylint warnings
cognitivegears Sep 7, 2025
1c6dd78
Added e2e tests
cognitivegears Sep 7, 2025
993168a
Added github action
cognitivegears Sep 7, 2025
70f259d
refactor(cli): extract helpers to reduce branches; keep lazy imports …
cognitivegears Sep 8, 2025
065f1d1
lint: add targeted pylint disables for data-holder classes; document …
cognitivegears Sep 8, 2025
bbac403
Changes for gitignore
cognitivegears Sep 8, 2025
38ff25d
Initial version of source code repository integration
cognitivegears Sep 8, 2025
346cb27
Modified to reduce duplicate code
cognitivegears Sep 8, 2025
f16666c
Extracted common code and moved
cognitivegears Sep 8, 2025
0b93293
Bump actions/setup-python from 5 to 6
dependabot[bot] Sep 8, 2025
e91dbe8
Bump actions/checkout from 4 to 5
dependabot[bot] Sep 8, 2025
be2b4a1
Added logging
cognitivegears Sep 9, 2025
9e56fc3
Added debug logging
cognitivegears Sep 9, 2025
73acbf2
Fixed lookup of npm repo information
cognitivegears Sep 9, 2025
bf9f95d
Matched version checking fixed
cognitivegears Sep 9, 2025
0d582af
Small change to wording
cognitivegears Sep 9, 2025
12e4657
Setting version information
cognitivegears Sep 9, 2025
95ae5c8
Fixed version lookup
cognitivegears Sep 9, 2025
6d27239
Fixed npm resolution for latest
cognitivegears Sep 9, 2025
abd8b82
Improved release and tag comparisons
cognitivegears Sep 10, 2025
3dffc03
Added tests for recent changes
cognitivegears Sep 10, 2025
ac013f3
General cleanup
cognitivegears Sep 10, 2025
4545380
Enhanced config file
cognitivegears Sep 10, 2025
c9d36a4
Added http rate limiting and retry support
cognitivegears Sep 10, 2025
7bec27f
updated example
cognitivegears Sep 10, 2025
ffadbf1
Initial version of policy based scans
cognitivegears Sep 10, 2025
6d6086e
Changed command line arguments
cognitivegears Sep 10, 2025
25a352d
Fixed pypi license checking
cognitivegears Sep 11, 2025
affbe69
Fixed npm license checking
cognitivegears Sep 11, 2025
02ffa8f
Fixed small bug with maven lookup
cognitivegears Sep 11, 2025
a5abc74
Added depsdev for further enrichment
cognitivegears Sep 11, 2025
5cd1532
Fixes scanning lock files
cognitivegears Sep 11, 2025
7f7735f
Added dev and test dep detection, transitive and direct
cognitivegears Sep 11, 2025
d49ca6f
Fixed regression in npm
cognitivegears Sep 11, 2025
851f8b4
Fixed bug with npm naming
cognitivegears Sep 12, 2025
0ac25b6
Refactoring
cognitivegears Sep 12, 2025
fd8eb39
Added new linked mode to validate package linkage
cognitivegears Sep 12, 2025
a916748
Updated to use scan semantics
cognitivegears Sep 12, 2025
4bdbe42
Updated version
cognitivegears Sep 12, 2025
c5a94fe
Added linked policy type
cognitivegears Sep 12, 2025
93a23b1
Added partial match support
cognitivegears Sep 16, 2025
1ba0c19
Merge pull request #8 from cognitivegears/dependabot/github_actions/a…
cognitivegears Sep 16, 2025
5815d8b
Merge pull request #9 from cognitivegears/dependabot/github_actions/a…
cognitivegears Sep 16, 2025
362e6b5
Initial version of MCP
cognitivegears Oct 18, 2025
878d5f1
Fixed pylint issues
cognitivegears Oct 18, 2025
41a188b
Bump actions/upload-artifact from 4 to 5
dependabot[bot] Oct 27, 2025
3c6742b
Bump actions/download-artifact from 5 to 6
dependabot[bot] Oct 27, 2025
f6813b3
Landed MCP support for Depgate
cognitivegears Nov 5, 2025
beeb516
Merge pull request #10 from cognitivegears/dependabot/github_actions/…
cognitivegears Nov 5, 2025
81b8f14
Merge pull request #11 from cognitivegears/dependabot/github_actions/…
cognitivegears Nov 5, 2025
675e2f9
Code review changes
cognitivegears Nov 5, 2025
9881774
Additional code improvements
cognitivegears Nov 5, 2025
ec9e64c
Additional code cleanup
cognitivegears Nov 5, 2025
7700f1e
Merge pull request #12 from cognitivegears/feature/mcp
cognitivegears Nov 5, 2025
007b190
Added fix for hanging
cognitivegears Nov 6, 2025
a082ed9
Changes to make warnings more obvious
cognitivegears Nov 6, 2025
b0c1d46
Additional code review changes
cognitivegears Nov 6, 2025
88f1f8f
Code review security changes
cognitivegears Nov 6, 2025
f73cb2a
Code review changes
cognitivegears Nov 6, 2025
dd92f25
Merge pull request #13 from cognitivegears/bugfix/mcp_hanging
cognitivegears Nov 6, 2025
21ec675
Bug fix for warnings
cognitivegears Nov 6, 2025
822f110
Merge pull request #14 from cognitivegears/bugfix/version_warning
cognitivegears Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Landed MCP support for Depgate
  • Loading branch information
cognitivegears committed Nov 5, 2025
commit f6813b35e324361b0ccdff36f56138e656956c78
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "depgate"
version = "0.5.1"
version = "0.6.0"
description = "DepGate detects and prevents dependency confusion and supply-chain risks. (Hard fork of Apiiro's Dependency Combobulator)"
readme = "README.md"
requires-python = ">=3.10"
Expand Down Expand Up @@ -38,13 +38,13 @@ depgate = "depgate:main"

[tool.setuptools]
package-dir = {"" = "src"}
py-modules = ["depgate", "args", "constants", "metapackage", "cli_io", "cli_build", "cli_registry", "cli_classify", "cli_config", "cli_mcp", "mcp_schemas", "mcp_validate"]
py-modules = ["depgate", "args", "constants", "metapackage", "cli_io", "cli_build", "cli_registry", "cli_classify", "cli_config", "cli_mcp"]

[tool.setuptools.packages.find]
where = ["src"]

[tool.uv]
dev-dependencies = [
[dependency-groups]
dev = [
"pytest>=7.0",
"pylint>=3.0",
"behave>=1.2.6",
Expand Down
136 changes: 106 additions & 30 deletions src/cli_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys
import argparse
from typing import Any, Dict, List, Optional, Tuple
from typing_extensions import TypedDict

import urllib.parse as _u
from constants import Constants
Expand Down Expand Up @@ -60,6 +61,42 @@
# ----------------------------


class PackageOut(TypedDict, total=False):
name: Optional[str]
ecosystem: Optional[str]
version: Optional[str]
repositoryUrl: Optional[str]
license: Optional[str]
linked: Optional[bool]
repoVersionMatch: Any
policyDecision: Any


class SummaryOut(TypedDict):
count: int


class ScanResultOut(TypedDict, total=False):
packages: List[PackageOut]
findings: List[Dict[str, Any]]
summary: SummaryOut


class LookupOut(TypedDict, total=False):
name: str
ecosystem: str
latestVersion: Optional[str]
satisfiesRange: Optional[bool]
publishedAt: Optional[str]
deprecated: Optional[bool]
yanked: Optional[bool]
license: Optional[str]
registryUrl: Optional[str]
repositoryUrl: Optional[str]
cache: Dict[str, Any]
candidates: int


def _eco_from_str(s: Optional[str]) -> Ecosystem:
if not s:
raise ValueError("ecosystem is required in this context")
Expand Down Expand Up @@ -149,12 +186,12 @@ def _resolution_for(
def _validate(schema_name: str, data: Dict[str, Any]) -> None:
"""Validate input payload against a named schema from mcp_schemas."""
try:
from mcp_schemas import ( # type: ignore
from depgate_mcp.schemas import ( # type: ignore
LOOKUP_LATEST_VERSION_INPUT,
SCAN_PROJECT_INPUT,
SCAN_DEPENDENCY_INPUT,
)
from mcp_validate import validate_input as _validate_input # type: ignore
from depgate_mcp.validate import validate_input as _validate_input # type: ignore
mapping = {
"lookup": LOOKUP_LATEST_VERSION_INPUT,
"project": SCAN_PROJECT_INPUT,
Expand All @@ -169,16 +206,16 @@ def _validate(schema_name: str, data: Dict[str, Any]) -> None:

def _validate_output_strict(result: Dict[str, Any]) -> None:
"""Validate scan result output strictly."""
from mcp_schemas import SCAN_RESULTS_OUTPUT # type: ignore
from mcp_validate import validate_output as _validate_output # type: ignore
from depgate_mcp.schemas import SCAN_RESULTS_OUTPUT # type: ignore
from depgate_mcp.validate import validate_output as _validate_output # type: ignore
_validate_output(SCAN_RESULTS_OUTPUT, result)


def _safe_validate_lookup_output(out: Dict[str, Any]) -> None:
"""Best-effort validation for lookup output; ignore failures."""
try:
from mcp_schemas import LOOKUP_LATEST_VERSION_OUTPUT # type: ignore
from mcp_validate import safe_validate_output as _safe # type: ignore
from depgate_mcp.schemas import LOOKUP_LATEST_VERSION_OUTPUT # type: ignore
from depgate_mcp.validate import safe_validate_output as _safe # type: ignore
_safe(LOOKUP_LATEST_VERSION_OUTPUT, out)
except Exception:
pass
Expand All @@ -200,6 +237,17 @@ def _enrich_lookup_metadata(eco: Ecosystem, name: str, latest: Optional[str]) ->
"license_id": None,
"repo_url": None,
}

# Skip HTTP calls in test mode to avoid hangs
if os.environ.get("FAKE_REGISTRY", "0") == "1":
return {
"published_at": None,
"deprecated": None,
"yanked": None,
"license_id": None,
"repo_url": None,
}

if eco == Ecosystem.NPM:
url = f"{Constants.REGISTRY_URL_NPM}{_u.quote(name, safe='')}"
status, _, data = _get_json(url)
Expand Down Expand Up @@ -267,7 +315,7 @@ def _handle_lookup_latest_version(
"registryUrl": registry_url,
"repositoryUrl": meta["repo_url"],
"cache": res[3],
"_candidates": res[1],
"candidates": res[1],
}
_safe_validate_lookup_output(result)
if res[2]:
Expand All @@ -284,13 +332,17 @@ def _run_scan_pipeline(scan_args: Any) -> Dict[str, Any]:
return _gather_results()


def _build_args_for_single_dependency(eco: Ecosystem, name: str) -> Any:
def _build_args_for_single_dependency(eco: Ecosystem, name: str, version: Optional[str] = None) -> Any:
"""Construct scan args for a single dependency token."""
scan_args = argparse.Namespace()
scan_args.package_type = eco.value
scan_args.LIST_FROM_FILE = []
scan_args.FROM_SRC = None
scan_args.SINGLE = [name]
# Include version in token if provided (format: name:version for parse_cli_token)
if version:
scan_args.SINGLE = [f"{name}:{version}"]
else:
scan_args.SINGLE = [name]
scan_args.RECURSIVE = False
scan_args.LEVEL = "compare"
scan_args.OUTPUT = None
Expand Down Expand Up @@ -406,11 +458,8 @@ def _setup_log_level(args: Any) -> None:

def _ensure_default_project_dir(args: Any) -> None:
"""Default sandbox root to CWD if not provided."""
if not getattr(args, "MCP_PROJECT_DIR", None):
try:
setattr(args, "MCP_PROJECT_DIR", os.getcwd())
except Exception: # pylint: disable=broad-exception-caught
pass
# No-op: Only enforce sandbox when user explicitly provides MCP_PROJECT_DIR
return


def run_mcp_server(args) -> None:
Expand All @@ -426,17 +475,34 @@ def run_mcp_server(args) -> None:
sys.stderr.write("MCP server not available: 'mcp' package is not installed.\n")
sys.exit(1)
_ensure_default_project_dir(args)
mcp = FastMCP(server_name)

@mcp.tool(title="Lookup Latest Version", name="Lookup_Latest_Version")
class DepGateMCP(FastMCP): # type: ignore
async def call_tool(self, name: str, arguments: dict[str, Any]) -> dict[str, Any] | List[Any]: # type: ignore[override]
# Use FastMCP's conversion, then flatten to pure structured dict when available
context = self.get_context()
raw = await self._tool_manager.call_tool(name, arguments, context=context, convert_result=True)
# raw can be Sequence[ContentBlock] or (Sequence[ContentBlock], dict)
if isinstance(raw, tuple) and len(raw) == 2 and isinstance(raw[1], dict):
structured = raw[1]
# FastMCP may return structuredContent nested - extract it if present
if isinstance(structured, dict) and "structuredContent" in structured:
return structured["structuredContent"]
return structured
# If raw is a dict with structuredContent, extract it
if isinstance(raw, dict) and "structuredContent" in raw:
return raw["structuredContent"]
return raw # type: ignore[return-value]

mcp = DepGateMCP(server_name)

@mcp.tool(title="Lookup Latest Version", name="Lookup_Latest_Version", structured_output=True)
def lookup_latest_version( # pylint: disable=invalid-name,too-many-arguments
name: str,
ecosystem: Optional[str] = None,
versionRange: Optional[str] = None,
registryUrl: Optional[str] = None,
projectDir: Optional[str] = None,
_ctx: Any = None,
) -> Dict[str, Any]:
ctx: Any = None,
) -> LookupOut:
"""Fast lookup of the latest stable version using DepGate's resolvers and caching."""
# Map camelCase args to internal names
version_range = versionRange
Expand All @@ -463,9 +529,9 @@ def lookup_latest_version( # pylint: disable=invalid-name,too-many-arguments
eco=eco,
version_range=version_range,
registry_url=registry_url,
)
) # type: ignore[return-value]

@mcp.tool(title="Scan Project", name="Scan_Project")
@mcp.tool(title="Scan Project", name="Scan_Project", structured_output=True)
def scan_project( # pylint: disable=invalid-name,too-many-arguments
projectDir: str,
includeDevDependencies: Optional[bool] = None,
Expand All @@ -476,8 +542,8 @@ def scan_project( # pylint: disable=invalid-name,too-many-arguments
paths: Optional[List[str]] = None,
analysisLevel: Optional[str] = None,
ecosystem: Optional[str] = None,
_ctx: Any = None,
) -> Dict[str, Any]:
ctx: Any = None,
) -> ScanResultOut:
"""Run the standard DepGate pipeline on a project directory."""
# Map camelCase to internal names
project_dir = projectDir
Expand Down Expand Up @@ -506,17 +572,17 @@ def scan_project( # pylint: disable=invalid-name,too-many-arguments
_validate_output_strict(result)
except Exception as se:
raise RuntimeError(str(se)) from se
return result
return result # type: ignore[return-value]

@mcp.tool(title="Scan Dependency", name="Scan_Dependency")
@mcp.tool(title="Scan Dependency", name="Scan_Dependency", structured_output=True)
def scan_dependency( # pylint: disable=invalid-name,too-many-arguments
name: str,
version: str,
ecosystem: str,
registryUrl: Optional[str] = None,
offline: Optional[bool] = None,
_ctx: Any = None,
) -> Dict[str, Any]:
ctx: Any = None,
) -> ScanResultOut:
"""Analyze a single dependency (without touching a project tree)."""
registry_url = registryUrl
_validate(
Expand All @@ -533,10 +599,9 @@ def scan_dependency( # pylint: disable=invalid-name,too-many-arguments
eco = _eco_from_str(ecosystem)
_apply_registry_override(eco, registry_url)
_reset_state()
scan_args = _build_args_for_single_dependency(eco, name)
scan_args = _build_args_for_single_dependency(eco, name, version)
pkglist = build_pkglist(scan_args)
create_metapackages(scan_args, pkglist)
_force_requested_spec(version)
apply_version_resolution(scan_args, pkglist)
check_against(scan_args.package_type, scan_args.LEVEL, metapkg.instances)
run_analysis(scan_args.LEVEL, scan_args, metapkg.instances)
Expand All @@ -545,4 +610,15 @@ def scan_dependency( # pylint: disable=invalid-name,too-many-arguments
_validate_output_strict(result)
except Exception as se:
raise RuntimeError(str(se)) from se
return result
return result # type: ignore[return-value]

# Run the server in stdio mode (default transport for tests/integration)
try:
run_stdio = getattr(mcp, "run_stdio", None)
if callable(run_stdio):
run_stdio()
else:
mcp.run("stdio") # type: ignore[arg-type]
except Exception as exc: # pragma: no cover - surfaced in stderr
sys.stderr.write(f"Failed to start MCP stdio server: {exc}\n")
sys.exit(1)
46 changes: 45 additions & 1 deletion src/depgate.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: depgate
Version: 0.5.1
Version: 0.6.0
Summary: DepGate detects and prevents dependency confusion and supply-chain risks. (Hard fork of Apiiro's Dependency Combobulator)
Author: cognitivegears
License: Apache-2.0
Expand Down Expand Up @@ -70,6 +70,49 @@ Common client examples:
- Node/JS agents (stdio): Spawn `depgate mcp` with stdio pipes and speak JSON‑RPC 2.0. List tools via `tools/list`, then call with `tools/call`.
- Python agents: Use the official MCP client libs; connect over stdio to `depgate mcp`.

Try it quickly (stdio, JSON-RPC):

- List tools

```bash
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"cli","version":"0"},"capabilities":{}}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
| depgate mcp
```

- Call Lookup_Latest_Version and Scan_Dependency

```bash
# npm (left-pad)
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"cli","version":"0"},"capabilities":{}}}' \
'{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"Lookup_Latest_Version","arguments":{"name":"left-pad","ecosystem":"npm","versionRange":"^1.0.0"}}}' \
'{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"Scan_Dependency","arguments":{"name":"left-pad","version":"1.3.0","ecosystem":"npm"}}}' \
| depgate mcp

# PyPI (requests)
# Use PEP 440 specifiers (e.g., ">=2,<3"); caret (^) is not valid for PyPI.
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"cli","version":"0"},"capabilities":{}}}' \
'{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"Lookup_Latest_Version","arguments":{"name":"requests","ecosystem":"pypi","versionRange":">=2,<3"}}}' \
'{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"Scan_Dependency","arguments":{"name":"requests","version":"2.32.5","ecosystem":"pypi"}}}' \
| depgate mcp

# Maven (groupId:artifactId coordinates)
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"cli","version":"0"},"capabilities":{}}}' \
'{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"Lookup_Latest_Version","arguments":{"name":"org.apache.commons:commons-lang3","ecosystem":"maven"}}}' \
'{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"Scan_Dependency","arguments":{"name":"org.apache.commons:commons-lang3","version":"3.19.0","ecosystem":"maven"}}}' \
| depgate mcp
```

Sandboxing and environment:

- The server restricts filesystem access to a sandbox root. By default, it's the current working directory.
- If you pass absolute paths (e.g., to Scan_Project), run `depgate mcp --project-dir "/abs/path"` with a root that contains those paths.
- When developing with this repo installed in editable mode, avoid adding `src/` to PYTHONPATH when launching the server; it may shadow the external `mcp` SDK package. For tests that need mocks, add only `tests/e2e_mocks` to PYTHONPATH.

Flags & env:

- `--project-dir`: sandbox root for file access
Expand Down Expand Up @@ -169,6 +212,7 @@ DepGate discovers canonical source repositories from registry metadata, normaliz
- Tag/release name returned prefers the bare token unless both v‑prefixed and bare forms co‑exist, in which case the raw label is preserved.

Notes:

- Exact‑unsatisfiable guard: when an exact spec cannot be resolved to a concrete version (e.g., CLI requested exact but no resolved_version), matching is disabled (empty version passed to matcher). Metrics still populate and provenance is recorded.


Expand Down
6 changes: 3 additions & 3 deletions src/depgate.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ src/depgate.egg-info/dependency_links.txt
src/depgate.egg-info/entry_points.txt
src/depgate.egg-info/requires.txt
src/depgate.egg-info/top_level.txt
src/mcp/__init__.py
src/mcp/schemas.py
src/mcp/validate.py
src/depgate_mcp/__init__.py
src/depgate_mcp/schemas.py
src/depgate_mcp/validate.py
src/registry/__init__.py
src/registry/depsdev/client.py
src/registry/depsdev/enrich.py
Expand Down
4 changes: 1 addition & 3 deletions src/depgate.egg-info/top_level.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ cli_registry
common
constants
depgate
mcp
mcp_schemas
mcp_validate
depgate_mcp
metapackage
registry
repository
Expand Down
5 changes: 5 additions & 0 deletions src/depgate_mcp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""DepGate MCP internals.

This package contains schemas and validation helpers used by the DepGate MCP server.
Renamed from the generic 'mcp' to avoid import conflicts with the third-party MCP SDK.
"""
Loading