Fix NuGet.org base URL default, improve API integration (#813)
<!-- Provide a brief summary of your changes --> ## Motivation and Context <!-- Why is this change needed? What problem does it solve? --> This resolves https://github.com/modelcontextprotocol/registry/issues/738. There are two issues with the NuGet.org integration today: 1. Change the `registryBaseUrl` for NuGet to `https://api.nuget.org/v3/index.json`. `https://api.nuget.org` is not the entry point for our service and is not specific enough. `https://api.nuget.org/v3/index.json` is the value that users put into their tooling to connect to our public registry (it is installed by default in .NET client tooling). 2. Use the service index API to get the URL pattern for package READMEs. - This URL is not guaranteed to be stable. The service index URL (`registryBaseUrl`) is, however. Additionally, I polished up the error messages so various error modes are clearer. When packages are published to NuGet.org, they take 2-5 minutes to become available due to validations we run. Some possible states that are now handled and described more helpfully are: - Version exists, but the package has no README - The ID exists, but the version does not - The ID does not exist at all There are only 3 authors (me, another MSFT person, and a community member) explicitly setting the old value. The DB migration will fix the issue. A future publish will fail with the validation error but the error message is clear. `registry type and base URL do not match: 'https://api.nuget.org' is not valid for registry type 'nuget'. Expected: https://api.nuget.org/v3/index.json` ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> - Unit tests, new and existing - Manual test locally - Set old data in the DB, `docker compose up`, confirm the migration updates the specific package ## Breaking Changes Yes, but minimal impact expected, unless there is a dependency on the specific `https://api.nuget.org` value downstream. I am not aware of any such dependency, and the new value is more proper and specific. ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [x] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [x] I have added appropriate error handling - [x] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions --> For more information about the NuGet API see: https://learn.microsoft.com/en-us/nuget/api/overview#service-index (I wrote most of the docs).
This commit is contained in:
parent
823c1a1081
commit
80cb03ff7a
5 changed files with 322 additions and 39 deletions
|
|
@ -85,7 +85,7 @@ This MCP server executes SQL queries and manages database connections.
|
|||
|
||||
## NuGet Packages
|
||||
|
||||
For NuGet packages, the MCP Registry currently supports the official NuGet registry (`https://api.nuget.org`) only.
|
||||
For NuGet packages, the MCP Registry currently supports the official NuGet registry (`https://api.nuget.org/v3/index.json`) only.
|
||||
|
||||
NuGet packages use `"registryType": "nuget"` in `server.json`. For example:
|
||||
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ components:
|
|||
- "https://registry.npmjs.org"
|
||||
- "https://pypi.org"
|
||||
- "https://docker.io"
|
||||
- "https://api.nuget.org"
|
||||
- "https://api.nuget.org/v3/index.json"
|
||||
- "https://github.com"
|
||||
- "https://gitlab.com"
|
||||
identifier:
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ Suppose your MCP server application requires a `mcp start` CLI arguments to star
|
|||
"packages": [
|
||||
{
|
||||
"registryType": "nuget",
|
||||
"registryBaseUrl": "https://api.nuget.org",
|
||||
"registryBaseUrl": "https://api.nuget.org/v3/index.json",
|
||||
"identifier": "Knapcode.SampleMcpServer",
|
||||
"version": "0.4.0-beta",
|
||||
"transport": {
|
||||
|
|
@ -370,7 +370,7 @@ The `dnx` tool ships with the .NET 10 SDK, starting with Preview 6.
|
|||
"packages": [
|
||||
{
|
||||
"registryType": "nuget",
|
||||
"registryBaseUrl": "https://api.nuget.org",
|
||||
"registryBaseUrl": "https://api.nuget.org/v3/index.json",
|
||||
"identifier": "Knapcode.SampleMcpServer",
|
||||
"version": "0.5.0",
|
||||
"runtimeHint": "dnx",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ Only trusted public registries are supported. Private registries and alternative
|
|||
**Supported registries:**
|
||||
- **NPM**: `https://registry.npmjs.org` only
|
||||
- **PyPI**: `https://pypi.org` only
|
||||
- **NuGet**: `https://api.nuget.org` only
|
||||
- **NuGet**: `https://api.nuget.org/v3/index.json` only
|
||||
- **Docker/OCI**:
|
||||
- Docker Hub (`docker.io`)
|
||||
- GitHub Container Registry (`ghcr.io`)
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@
|
|||
"https://registry.npmjs.org",
|
||||
"https://pypi.org",
|
||||
"https://docker.io",
|
||||
"https://api.nuget.org",
|
||||
"https://api.nuget.org/v3/index.json",
|
||||
"https://github.com",
|
||||
"https://gitlab.com"
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue