modelcontextprotocol / modelcontextprotocol/servers

[everything] Unintuitive / misleading resource indexing

Open
#475 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug server-everything
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Describe the bug
The everything server's resource indexing is counterintuitive. While the array index starts at 0, the resource numbering in URIs starts at 1, which leads to confusing behavior where:

  • Resource at index 0 is accessed via URI "test://static/resource/1"
  • Resource at index 1 is accessed via URI "test://static/resource/2"
    etc.

From the server code:

const ALL_RESOURCES: Resource[] = Array.from({ length: 100 }, (_, i) => ({
    const url = `test://static/resource/${i + 1}`;
    if (i % 2 === 0) {
        // index 0 (first resource) is text
        // index 2 (third resource) is text
        // etc.

This means even-indexed resources (0,2,4...) are text, but they map to odd-numbered URIs (1,3,5...).

To Reproduce
Make a ListResources request, then try to read the first text resource:

  1. List resources:
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "resources/list"
}
  1. Get first text resource (index 0):
{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "resources/read",
    "params": {
        "uri": "test://static/resource/1"
    }
}

Expected behavior
Either:

  1. Align the indexing so resource numbers in URIs match array indices (preferred)
  2. Or document this behavior clearly to prevent confusion

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the everything server's ALL_RESOURCES definition and the resources/list and resources/read handlers. Compare the array indices with the URI numbering using the reproduction requests, then confirm the chosen fix with the first text resource. Done means the indexing is aligned with the documented behavior, or the offset is clearly documented and consistently handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.