Skip to content

The MCP server has no metrics #425

Description

@Miracle656

Background

src/metrics.ts knows nothing about MCP. There is no count of tool calls, no
duration, no error breakdown — so the agent surface is entirely invisible on the
dashboard that covers every other part of the service.

Once L213 and L214 give agents something worth calling, "which tools are
actually used" becomes the question that decides what to build next, and there
will be no data to answer it.

What to build

  • A counter of tool calls by tool name and outcome. Tool names are a fixed,
    server-defined set, so this label is safely bounded — unlike the GraphQL
    operation names in No metric distinguishes GraphQL from anything else #374.
  • A histogram of tool call duration by tool.
  • A counter of errors by the MCP_ERROR_CODES value, which is already a closed
    set and is exactly the right label domain.
  • Register on the existing registry so everything appears at /metrics.

Acceptance criteria

  • Tool calls are counted by name and outcome
  • Duration is recorded per tool
  • Errors are counted by error code
  • All labels come from closed sets
  • Metrics appear on the existing /metrics endpoint

Drips Wave · Complexity: Easy · 100 points


Repo: Divinity-Labs/Lens. The MCP server is src/mcp/server.ts
(BazaarMcpServer) with error codes in src/mcp/codes.ts. It is started by
npm run mcp:server → examples/mcp-server/run.ts, and there is an agent
example at examples/mcp-server/agent.ts. Tests are tests/mcp.test.ts.

Run the tests: npm test. The tests are vitest, not jest. A single file
is npx vitest run tests/mcp.test.ts.

Load test (prices) is already failing on main. Not your PR.

This surface signs with a real mainnet key. examples/mcp-server/run.ts
requires MCP_AGENT_SECRET_KEY_MAINNET and builds a signer for
stellar:pubnet. Anything you change here can move real money, so prefer
failing closed, and never log, echo or test with a real secret key.

Never elide an address, a contract id or a key in code, comments or
fixtures. A previous batch shortened a contract id and five contributors
invented plausible-looking ids to fill the gap. Write it in full or not at all.

An agent is the least able caller to notice a wrong answer. It will reason
over whatever it is handed, confidently. Prefer a structured error over a
best-effort result.


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Activity

  1. rupesh-kumar-sah commented on Oct 17, 2026

    @rupesh-kumar-sah

    @rupesh-kumar-sah has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Ready to ship immediately! Focus: Backend Services & Distributed APIs (Node.js / TypeScript) for "The MCP server has no metrics". Plan: Engineer idempotent request handlers with strict schema validation, robust error propagation, and optimized database queries. Guaranteed 100% green CI & test coverage. Zero hand-holding. SLA: clean PR in 1-2h. Track record: Systems/Infra engineer, zero-regression test focus.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @rupesh-kumar-sah to this issue.

  2. drips-wave commented on Oct 17, 2026

    @drips-wave

    Congratulations, @rupesh-kumar-sah! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @rupesh-kumar-sah: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  3. added 2 commits that reference this issue on Oct 23, 2026
    b82e911
    a98d0e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions