servers icon indicating copy to clipboard operation
servers copied to clipboard

Add tool annotations to server-everything (13 tools, 0 annotated)

Open agentward-ai opened this issue 9 months ago • 5 comments

Request: Add tool annotations — @modelcontextprotocol/server-everything v2.0.0

Context

We ran an automated scan of this server via live JSON-RPC handshake. This server exposes 13 tools with zero annotations. As the official MCP reference/test server — the one developers use to learn the protocol — it should demonstrate best practices, including annotation usage.

For reference, @modelcontextprotocol/server-filesystem annotates all 14 of its tools. This server exercises every MCP feature except tool annotations.

Current state — 0/13 tools annotated

Every tool returns empty annotations: {}.

Suggested annotations — per tool

# Tool readOnlyHint destructiveHint idempotentHint openWorldHint
1 echo true false true false
2 get-annotated-message true false true false
3 get-env true false true false
4 get-resource-links true false true false
5 get-resource-reference true false true false
6 get-structured-content true false true false
7 get-sum true false true false
8 get-tiny-image true false true false
9 gzip-file-as-resource true false true false
10 toggle-simulated-logging false false true false
11 toggle-subscriber-updates false false true false
12 trigger-long-running-operation true false false false
13 simulate-research-query true false false false

Suggested code change — top 3 priority tools

get-env (highest priority — security-sensitive)

server.registerTool(
  "get-env",
  {
    description: "Returns all environment variables, helpful for debugging MCP server configuration",
    inputSchema: {},
    annotations: {
      readOnlyHint: true,
      idempotentHint: true,
      openWorldHint: false,
    },
  },
  handler
);

toggle-simulated-logging (one of two non-read-only tools)

server.registerTool(
  "toggle-simulated-logging",
  {
    description: "Toggles simulated, random-leveled logging on or off.",
    inputSchema: { enabled: z.boolean().optional() },
    annotations: {
      readOnlyHint: false,
      idempotentHint: true,
      openWorldHint: false,
    },
  },
  handler
);

echo (read-only template — same pattern for most tools)

server.registerTool(
  "echo",
  {
    description: "Echoes back the input string",
    inputSchema: { message: z.string() },
    annotations: {
      readOnlyHint: true,
      idempotentHint: true,
      openWorldHint: false,
    },
  },
  handler
);

11 of the 13 tools are read-only and share the same annotation values — they can be annotated in a single pass.

Rationale for notable tools

get-env → readOnlyHint: true Technically accurate — the tool only reads environment variables. However, get-env is the most security-sensitive tool on this server despite being read-only. Environment variables commonly contain API keys, tokens, database URLs, and secrets. The annotations correctly reflect the tool's behavior (read-only, not destructive), but see the chaining section below for why this tool deserves special attention.

toggle-simulated-logging / toggle-subscriber-updates → readOnlyHint: false These toggle internal server state. While the effect is trivial in a test server, they do mutate state, so readOnlyHint: false is accurate.

trigger-long-running-operation / simulate-research-query → idempotentHint: false These start new operations each time they're called. Each call creates a new progress stream.

Why this matters — the get-env problem and reference server role

The get-env chaining risk

get-env returns every environment variable on the machine: GITHUB_TOKEN, ANTHROPIC_API_KEY, DATABASE_URL, AWS_SECRET_ACCESS_KEY — whatever the developer has set. If an agent chains get-env into an outbound network call (fetch.post, github.create_issue, email.send), those credentials are exfiltrated.

readOnlyHint: true on get-env correctly signals the tool itself is safe. The risk is in composition — when the output flows to a tool with openWorldHint: true. This distinction is what enables a "allow local reads, gate outbound sends" pattern. But that pattern only works when the read-only tool actually declares readOnlyHint: true.

This isn't a theoretical concern — developers commonly install server-everything for experimentation alongside other servers, and the environment where MCP servers run is the same environment that holds real credentials.

This server should demonstrate annotations

This is the MCP reference server — the server-everything — designed to exercise every protocol feature. It currently demonstrates tools, resources, prompts, subscriptions, structured content, and progress. It does not demonstrate tool annotations, despite annotations being a defined part of the MCP tool spec.

Adding annotations serves double duty:

  1. The annotations themselves provide correct metadata for downstream tooling
  2. The server becomes a working example of how to annotate tools — which community server developers will reference when building their own

Impact

13 tools, all straightforward annotation values, no behavior changes. This is a metadata-only PR that makes the reference server a complete reference.


Found via automated scan with AgentWard. Enumerated via live JSON-RPC handshake, protocol 2025-11-25.

agentward-ai avatar Feb 25 '26 16:02 agentward-ai

How we found this

This was discovered using AgentWard — an open-source MCP security scanner that enumerates tools via live JSON-RPC handshake and assesses risk levels, data access patterns, and annotation coverage.

Reproduce

pip install agentward

# Create a minimal MCP config
cat > /tmp/mcp_config.json << 'CONFIG'
{
  "mcpServers": {
    "everything": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-everything"]
    }
  }
}
CONFIG

# Scan — enumerates all 13 tools, shows risk ratings and annotation gaps
agentward scan /tmp/mcp_config.json

# JSON output for programmatic use
agentward scan /tmp/mcp_config.json --json

Of particular note: get-env returns all environment variables (API keys, tokens, secrets) and is rated LOW by our heuristic engine because "get" is a read verb. It's technically read-only, but it's the most security-sensitive tool on this server. Proper annotations (readOnlyHint: true) would enable a "allow reads, gate outbound sends" pattern for any downstream tooling.

agentward-ai avatar Feb 25 '26 16:02 agentward-ai

Annotations on the reference server are doubly load-bearing because anyone learning MCP looks at this code first, then mirrors whatever pattern they see — or whatever pattern they don't see. Empty annotations read as "annotations aren't part of the contract," and that's the shape that propagates downstream.

A few framings worth folding in if/when a PR lands:

readOnlyHint: true is not a safety claim — it's a side-effect claim. The get-env case the OP and agentward-ai called out is the cleanest demonstration: read-only on the local machine, catastrophic on the network. The annotations correctly describe get-env itself; the risk is composition with any tool that has openWorldHint: true. If the reference server documents this distinction in code (read-only + openWorldHint=false on get-env, openWorldHint=true on whatever outbound tool gets added later), it teaches the chaining model alongside the annotations.

idempotentHint: false on trigger-long-running-operation and simulate-research-query is the right call. Worth saying out loud because it's the easiest annotation to fill in wrong: "the tool returns the same shape" is not the same as "calling it twice has the same effect." Operations that allocate state, mint IDs, or start streams are non-idempotent even when the return shape is identical.

openWorldHint is the annotation that actually changes scheduling behavior on careful clients — it tells the client whether retries are safe and whether to gate the tool behind extra consent. Defaulting to false on every tool here is correct (this server doesn't touch the network), but worth pairing with at least one tool that would set openWorldHint: true (a stub fetch tool, behind a flag) so the reference shows both sides of the contract.

For folks who want to audit their own servers' annotation coverage before publishing: Anthropic's MCP Inspector surfaces annotations in the tools panel — good for eyeballing. For automated lint over the live launch command (so it catches stuff that depends on the runtime config, not just the static schema), npx @incultnitollc/mcp-probe test "<launch command>" flags missing annotations alongside the more common missing-description warnings. Different stages of the pipeline; both worth running before tagging a release.

Either way, adding annotations to server-everything is the highest-leverage doc change in this repo right now — the comment-thread evidence here (and the same complaint reappearing across community servers) is that authors don't add annotations they haven't seen modeled.

PengSpirit avatar May 27 '26 01:05 PengSpirit

A bounded field-test datapoint for the proposed echo annotations: I ran public [email protected] against pinned @modelcontextprotocol/[email protected] (gitHead 6dd0a683e198783e30feabf7abaf42f925bd18b1) over local stdio, with only echo allowlisted. The clean call passed; a synthetic result-level tool error recovered on exactly one retry; an expected canary failure produced and executed a regression; and the approved baseline compared with zero differences.

The sanitized case includes the exact config, declared expectations, actual results, hashes, compact evidence, and reproduction commands: https://github.com/aliengineering-byte/resilireplay/blob/553acd4f8bca7d0d8245a7b8d9f266ddb738d66c/docs/case-studies/mcp-everything/README.md

This is synthetic reliability evidence, not a vulnerability report, security certification, ranking, or upstream endorsement. The case treats echo as read-only and idempotent, which matches the annotations proposed here. Maintainer question: is one consumer retry after a result-level tool error a realistic minimal behavior for this reference tool, or would a different failure/recovery boundary be more useful to demonstrate?

aliengineering-byte avatar Aug 04 '26 22:08 aliengineering-byte

Closing: this is available in the v2 release.

Thank you for the suggestion, and apologies for the long wait for a response.

The reference servers were rebuilt for the 2026-07-28 MCP specification (#4857) and released as v2 (2.0.0 on npm for the TypeScript servers, 2026.10.19 on PyPI for the Python servers), and what this asks for is covered there. Every tool in the everything server now declares readOnlyHint, destructiveHint, idempotentHint and openWorldHint annotations. This is happening as part of the backlog triage in #4875.

If the v2 behavior doesn't meet the need you had in mind, please open a fresh issue describing what's still missing; see CONTRIBUTING.md.

cliffhall avatar Oct 19 '26 17:10 cliffhall