agentleFS
aiktsaikts/yandex-tracker-mcp/AGENTS.md

yandex-tracker-mcp

AGENTS.md121 starsChanged 3 months agoApache-2.0View on GitHub

Before naming a tool, writing a description, a CHANGELOG entry or a README section, read the rule that covers it - rules/README.md indexes them, and each names the test that enforces it. This file covers the rest: architecture, the Tracker API's behaviour, and how to test. MCP Yandex Tracker is a Model Context Protocol (MCP) server that provides tools for interacting with Yandex Tracker API. It implements a FastMCP server with protocol-based architecture and optional Redis caching.

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

21 rules. About 0 are common, 4 are distinctive, and 17 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 17

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All protocol methods accept optional auth: YandexAuth | None parameter for OAuth support.

    line 43
  2. Very specific:

    All Pydantic models for Yandex Tracker entities inherit from BaseTrackerEntity.

    line 44
  3. Very specific:

    Use pytest with asyncio mode auto

    line 63
  4. Very specific:

    Use aioresponses for HTTP mocking in TrackerClient tests and @tests/aioresponses_utils.py for capturing request/response pairs.

    line 64
  5. Very specific:

    Use AsyncMock with spec= for protocol mocking in MCP tool tests

    line 65
  6. Distinctive:

    Always type-hint all parameters including fixtures

    line 66
  7. Distinctive:

    Never import inside functions - all imports at top of file

    line 67
  8. Very specific:

    Never use loops for test cases - use @pytest.mark.parametrize

    line 68
  9. Very specific:

    Use model_construct() for creating Pydantic model fixtures (skips validation)

    line 69
  10. Very specific:

    Use aioresponses to mock HTTP requests.

    line 82
  11. Very specific:

    Use get_tool_result_content(result) helper to extract tool return values.

    line 101
  12. Very specific:

    Protocol: Add method signature to the matching mcp_tracker/tracker/proto/*.py (a new protocol also needs a *ProtocolWrap base, a …

    line 118
  13. Very specific:

    Caching: Add wrapper in mcp_tracker/tracker/caching/client.py

    line 120
  14. Very specific:

    Tool: Add function to appropriate module in mcp_tracker/mcp/tools/ - named and described per rules/tool-naming.md and …

    line 121
  15. Very specific:

    Tests: Add to appropriate tests/mcp/tools/test_*_tools.py

    line 134
  16. Very specific:

    Docs: Update README.md, README_ru.md, manifest.json and CHANGELOG.md - see rules/docs.md and rules/changelog.md

    line 135
  17. Distinctive:

    Test success case with expected return data

    line 164
  18. Very specific:

    Test parameter passing (verify call_args)

    line 165
  19. Distinctive:

    Test optional parameters (provided vs omitted)

    line 166
  20. Very specific:

    Test queue restrictions with client_session_with_limits if tool accesses issues/queues

    line 167
  21. Very specific:

    Add tool name to appropriate list in tests/mcp/server/test_server_creation.py:

    line 168

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file provides guidance to AI coding agents (Claude Code, Cursor, etc.) when working with code in this repository.

Rules

Before naming a tool, writing a description, a CHANGELOG entry or a README section, read the rule that covers it - rules/README.md indexes them, and each names the test that enforces it. This file covers the rest: architecture, the Tracker API's behaviour, and how to test.

Project Overview

MCP Yandex Tracker is a Model Context Protocol (MCP) server that provides tools for interacting with Yandex Tracker API. It implements a FastMCP server with protocol-based architecture and optional Redis caching.

Commands

task              # Run all checks (format, lint, type checking, tests) - REQUIRED before commits
task format       # Auto-format code
task check        # Run type and format checking
task test         # Run tests
uv sync           # Install dependencies
uv run mcp-tracker # Run the server

Architecture

  • Protocols (mcp_tracker/tracker/proto/): Define API contracts (QueuesProtocol, IssueProtocol, GlobalDataProtocol, TemplatesProtocol, UsersProtocol, EntitiesProtocol, BoardsProtocol, ComponentsProtocol), each exposed on AppContext as queues / issues / fields / templates / users / entities / boards / components
  • Client (mcp_tracker/tracker/custom/client.py): Implements protocols, handles HTTP requests
  • Caching (mcp_tracker/tracker/caching/client.py): Wraps protocols with Redis caching
  • MCP Server (mcp_tracker/mcp/server.py): Server creation and configuration
  • MCP Tools (mcp_tracker/mcp/tools/): Tool definitions organized by category
    • _access.py: Access control helpers (check_issue_access, check_queue_access)
    • queue.py / queue_write.py: Queue read-only / write tools
    • field.py: Global field and metadata tools (read-only)
    • template.py: Issue and comment template tools (read-only)
    • board.py: Board and sprint tools (read-only)
    • component.py / component_write.py: Queue component read-only / write tools (queue_get_components itself lives with the queue tools)
    • issue_read.py / issue_write.py: Issue read-only / write tools
    • user.py: User tools (read-only)
    • __init__.py: Exports register_all_tools() which orchestrates tool registration
    • *_write.py modules are only registered when settings.tracker_read_only=False
    • project/portfolio/goal modules are only registered when settings.tracker_entities_enabled=True
  • Settings (mcp_tracker/settings.py): Pydantic settings from environment variables
  • All protocol methods accept optional auth: YandexAuth | None parameter for OAuth support.
  • All Pydantic models for Yandex Tracker entities inherit from BaseTrackerEntity.

Talking to the Tracker API

  • Reference fields (type, priority, parent, sprint, followers, components, project) use the shared models in mcp_tracker/tracker/proto/types/inputs.py (Issue*Ref), serialized by _ref_body() in the client. How Tracker resolves a bare value is per field, so check before widening a parameter: type / priority accept an id or a key and resolve a numeric string as an id (verified against the API), followers accept a uid or a login the same way, and a 422 from these means the referenced entity does not exist. components are the exception - a bare string there is a name, which makes a numeric-looking name ambiguous (this is what components: ["694"] answered 422 for), hence IssueComponentRef requiring exactly one of id / name. Create and update must accept and send the same value the same way - the API takes a bare key or id on both, so a parameter widened on one has to be widened on the other, or an agent that created an issue with a scalar hits a schema error when it updates the same way.
  • Every request goes through self._request() - or self._read(), which is _request plus reading the body and is what a method wanting nothing but the body uses. Nothing calls self._session directly: the funnel is what builds the auth headers, translates a TimeoutError into TrackerAPITimeout (str(TimeoutError()) is the empty string, so an untranslated timeout reaches an agent as a message with nothing in it) and puts every response through _raise_for_status, so Tracker's own errorMessages / errors end up in the raised TrackerAPIError instead of a bare "Unprocessable Entity". The funnel exists because these were sixty copies of the same lines and the copies drifted; a method added beside it rather than through it starts that again.
  • Errors: statuses with an actionable meaning are passed to the funnel as not_found= / conflict=, ready to raise: 404 → IssueNotFound on issue-scoped paths, QueueNotFound on queue-scoped ones (v3/queues/{queue}/...), BoardNotFound on board-scoped ones, ComponentNotFound on v3/components/{id} and the similar error on other paths; conflict= covers 409 and 412 - a stale version answers 409 on an issue update (IssueVersionConflict) but 412 on a component update (ComponentVersionConflict), and both are the same precondition failure. A dedicated error applies to every method scoped to that entity, not just to newly added ones. allow_statuses= is the way out for a status that is an answer rather than a failure - user_get reads a 404 as None; an allowed status skips not_found / conflict / _raise_for_status alike and reaches the caller as an ordinary response.
  • Field names on the wire: a model may use a snake_case Python name, but it must accept and emit Tracker's own name - set serialization_alias next to every validation_alias (story_points reads and writes storyPoints). Responses are what callers feed back into fields, so the two spellings have to match; tests/tracker/proto/test_model_aliases.py fails if a new field forgets this.
  • fields maps: issue_create / issue_update take the free-form map as an explicit fields parameter, never as **kwargs - a key naming a dedicated parameter used to raise TypeError: got multiple values. The client merges it into the body last, so an entry overrides the dedicated parameter and an explicit null clears the field (a dedicated parameter left as None is simply not sent).
  • Reference inputs: every Issue*Ref validates that it carries something to resolve (IssueComponentRef wants exactly one of id / name, the others at least one of id / key); Tracker answers an empty object with an unhelpful 400/422, and when both id and key are set it resolves by id.
  • Issue version: it is bumped by every change, including queue triggers and automation that fire right after creation, so the version returned by issue_create is routinely stale. Tools that accept version must say so and point at issue_get for a fresh read.
  • Issue checklists (v3/issues/{id}/checklistItems) behave unlike the entity ones: POST takes exactly one item per request, so issue_add_checklist_items loops over the batch (a failure past the first item raises ChecklistBatchPartiallyAdded, which reports how many landed - nothing is rolled back), and PATCH .../{itemId} takes a JSON object of just the fields being changed. Both halves of that contradict the documentation, and both were verified against the live API on 2026-08-27: the docs show an array body ([{...}], which answers 400) and call text required (it is not - a PATCH with only checked or only assignee answers 200 and leaves the existing text intact). Do not "fix" either back to what the docs say. An empty body is also a 200 no-op, so an update with nothing to change is refused locally with ChecklistItemEmptyUpdate. assignee and deadline are cleared by an empty object ({}), which is what clear_assignee / clear_deadline send - verified on the live API on 2026-08-31, along with the three spellings that do not work: null answers 200 and silently keeps the value, "" and 0 answer 422. Setting and clearing the same field in one call is refused with FieldClearConflict rather than letting one of the two win silently. A 404 from the item-scoped paths (PATCH/DELETE .../checklistItems/{itemId}) means an unknown issue or an unknown item, so it raises ChecklistItemNotFound(..., ambiguous=True), whose message names both - IssueNotFound there would assert the one cause Tracker does not distinguish, and the same bad id would report differently depending on whether text was passed. issue_add_checklist_items with an empty batch returns issue_get_checklist rather than [] - the method's contract is "the checklist after adding", which an empty list misstates for an issue that already has items. Every one of these endpoints answers with the whole issue object, from which only checklistItems is parsed (the key is absent once the checklist is empty). There is no per-item reconcile step here - that quirk belongs to the entities' bulk PATCH, see _reconcile_checklist_update.
  • Queue components (verified against the live API on 2026-09-06): only GET v3/components (organization-wide, paginated, ignores a queue= filter), POST v3/components and PATCH v3/components/{id} are documented. The server uses the undocumented queue-scoped GET v3/queues/{queue}/components (the full objects of one queue, no pagination headers) and GET v3/components/{id} / DELETE v3/components/{id} instead - the org-wide listing pages through every component the organization has (1002 of them here - 21 requests to find a queue's 13). expand=components on GET v3/queues/{queue} returns references only (id as a string, display), no version, lead or assignAuto. PATCH requires version as a query parameter: without it the API answers 428, and a stale one answers 412 (not 409) - the Errors bullet above says how conflict= covers both. An empty PATCH body answers 200 and changes nothing (the version does not move), so component_update refuses it locally with ComponentEmptyUpdate; re-sending the value a field already has answers 200 without bumping version either. lead is sent as a login or a uid (a login like "i.ivanov", a uid as a number or as a string, and {"id": "<uid>"} all answer 200 with the same user object; an unknown login answers 422) and comes back as a user object. lead: {} clears the lead (200, no lead in the response, version bumped), which is what clear_lead sends; the two spellings that do not work are the checklist ones again: null answers 200 and silently keeps the current lead, "" answers 422. lead and clear_lead together are refused locally with FieldClearConflict. description: "" clears the description (null changes nothing); name: "" answers 422. DELETE answers 204 with no body and takes no version; deleting again, or reading afterwards, answers 404. description and lead are absent from a response when unset. Component reads are not cached (component_get, queues_get_components delegate without @cached): the component_update / component_delete tools read through the protocol to get the version the API demands (428 without one) and to learn the queue, and there is no omit-version escape as there is for issues, so a cached read would feed the PATCH a stale version for the rest of the TTL. The component_update / component_delete tools take a bare id, so under TRACKER_LIMIT_QUEUES / TRACKER_READ_ONLY_QUEUES they read the component once to learn its queue (queue_checks_needed in _access.py says when); component_update also reads it when the caller gave no version. One GET at most, then the write. A component in a queue outside TRACKER_LIMIT_QUEUES is reported as ComponentNotFound by check_component_access - the caller knows it by id alone, and a queue the allow-list hides must not be named back at them.
  • Templates are not applied on write (decided 2026-08-17, not yet implemented): POST /v3/issues has no templateId parameter, so issue_create cannot take one without expanding the template client-side. Callers read issue_template_get and fill the arguments themselves. Adding a template_id parameter later means merging fieldTemplates under the explicit arguments (which win) and mapping its reference values onto the Issue*Ref models - the template returns them as objects like {"id": "1", "key": "bug"}, and components in particular need the id-or-name form (see the reference-fields note above). checklistItems / metricItems cannot be sent at creation at all and would need a follow-up request.

Testing

Rules

  • Use pytest with asyncio mode auto
  • Use aioresponses for HTTP mocking in TrackerClient tests and @tests/aioresponses_utils.py for capturing request/response pairs.
  • Use AsyncMock with spec= for protocol mocking in MCP tool tests
  • Always type-hint all parameters including fixtures
  • Never import inside functions - all imports at top of file
  • Never use loops for test cases - use @pytest.mark.parametrize
  • Use model_construct() for creating Pydantic model fixtures (skips validation)

Test Locations

What to testWhere
TrackerClient HTTP methodstests/tracker/custom/test_*.py
Caching wrapperstests/tracker/caching/test_*_protocol.py
MCP toolstests/mcp/tools/test_*_tools.py
OAuth providertests/mcp/oauth/

Testing TrackerClient (HTTP layer)

Use aioresponses to mock HTTP requests. Verify request headers and response parsing:

async def test_api_method(self, client: TrackerClient) -> None:
    with aioresponses() as m:
        m.get("https://api.tracker.yandex.net/v3/endpoint", payload={"key": "value"})
        result = await client.api_method()
        assert result.key == "value"

Testing MCP Tools

MCP tools are tested via ClientSession.call_tool() against a real FastMCP server with mocked protocols.

Key fixtures (from tests/mcp/conftest.py):

  • client_session: Connected MCP client session
  • client_session_with_limits: Session with queue restrictions enabled
  • mock_issues_protocol, mock_queues_protocol, etc.: Mocked protocol instances

Use get_tool_result_content(result) helper to extract tool return values.

async def test_tool(self, client_session: ClientSession, mock_issues_protocol: AsyncMock) -> None:
    mock_issues_protocol.issue_get.return_value = sample_issue
    result = await client_session.call_tool("issue_get", {"issue_id": "TEST-1"})
    assert not result.isError
    content = get_tool_result_content(result)
    assert content["key"] == "TEST-1"

For paginated methods, use side_effect for sequential returns: mock.method.side_effect = [page1, []]

Adding New MCP Tools

Implementation Checklist

  1. Protocol: Add method signature to the matching mcp_tracker/tracker/proto/*.py (a new protocol also needs a *ProtocolWrap base, a CacheCollection slot, an AppContext field and wiring in make_tracker_lifespan)
  2. Client: Implement in mcp_tracker/tracker/custom/client.py, through self._request() / self._read() - see Talking to the Tracker API above (this holds for read-only methods too)
  3. Caching: Add wrapper in mcp_tracker/tracker/caching/client.py
  4. Tool: Add function to appropriate module in mcp_tracker/mcp/tools/ - named and described per rules/tool-naming.md and rules/tool-descriptions.md:
    • Queue read-only tools → queue.py
    • Queue write tools → queue_write.py
    • Global field/metadata tools → field.py
    • Issue/comment template tools → template.py
    • Board/sprint tools → board.py
    • Component read-only tools → component.py; write tools → component_write.py
    • Issue read-only tools → issue_read.py
    • Issue write tools → issue_write.py
    • User tools → user.py
    • Project read-only tools → project.py; write tools → project_write.py
    • Portfolio read-only tools → portfolio.py; write tools → portfolio_write.py
    • Goal read-only tools → goal.py; write tools → goal_write.py
  5. Tests: Add to appropriate tests/mcp/tools/test_*_tools.py
  6. Docs: Update README.md, README_ru.md, manifest.json and CHANGELOG.md - see rules/docs.md and rules/changelog.md

Tool Categories

CategoryModuleRead-Only
Queuequeue.pyYes
Queue Writequeue_write.pyNo
Fieldfield.pyYes
Templatetemplate.pyYes
Boardboard.pyYes
Componentcomponent.pyYes
Component Writecomponent_write.pyNo
Issue Readissue_read.pyYes
Issue Writeissue_write.pyNo
Useruser.pyYes
Projectproject.pyYes
Project Writeproject_write.pyNo
Portfolioportfolio.pyYes
Portfolio Writeportfolio_write.pyNo
Goalgoal.pyYes
Goal Writegoal_write.pyNo

Write tools (*_write.py) are only registered when settings.tracker_read_only=False.

Entity tools (project/portfolio/goal, read and write alike) are only registered when settings.tracker_entities_enabled=True.

Test Requirements for New Tools

  • Test success case with expected return data
  • Test parameter passing (verify call_args)
  • Test optional parameters (provided vs omitted)
  • Test queue restrictions with client_session_with_limits if tool accesses issues/queues
  • Add tool name to appropriate list in tests/mcp/server/test_server_creation.py:
    • Read-only tools → READ_ONLY_TOOL_NAMES
    • Write tools → WRITE_TOOL_NAMES
  • For write tools, add test with client_session_read_only to verify not registered
  • The name, the description budget, the README coverage and the version sync are checked by tests/mcp/server/test_tool_conventions.py, tests/mcp/server/test_readme_coverage.py and tests/test_release_metadata.py - a new tool passes them without an exception being added

Configuration

Authentication (one required):

  • TRACKER_TOKEN: Static OAuth token
  • TRACKER_IAM_TOKEN: Static IAM token
  • TRACKER_SA_*: Service account credentials for dynamic IAM tokens

Organization (one required):

  • TRACKER_CLOUD_ORG_ID: For Yandex Cloud
  • TRACKER_ORG_ID: For on-premise

Optional:

  • TRACKER_LIMIT_QUEUES: Restrict access to specific queues (allow-list, reads and writes).
  • TRACKER_READ_ONLY: When true, disables all write tools (the *_write.py modules)
  • TRACKER_READ_ONLY_QUEUES: Per-queue read-only allow-list. Write tools stay registered, but mutating calls targeting a listed queue are rejected via check_*_access(..., write=True) in _access.py; reads still work.
  • TRACKER_ENTITIES_ENABLED: When true, registers the project/portfolio/goal tools (project*.py, portfolio*.py, goal*.py). Default false: they add a large tool manifest and are not covered by the queue restrictions above, since an entity isn't mappable to a single queue.
  • TOOLS_CACHE_ENABLED: Enable Redis caching
  • OAUTH_ENABLED: Enable OAuth provider mode

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.