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.
- CLAUDE.mdCLAUDE.md
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
- Very specific: line 43
All protocol methods accept optional auth: YandexAuth | None parameter for OAuth support.
- Very specific: line 44
All Pydantic models for Yandex Tracker entities inherit from BaseTrackerEntity.
- Very specific: line 63
Use pytest with asyncio mode auto
- Very specific: line 64
Use aioresponses for HTTP mocking in TrackerClient tests and @tests/aioresponses_utils.py for capturing request/response pairs.
- Very specific: line 65
Use AsyncMock with spec= for protocol mocking in MCP tool tests
- Distinctive: line 66
Always type-hint all parameters including fixtures
- Distinctive: line 67
Never import inside functions - all imports at top of file
- Very specific: line 68
Never use loops for test cases - use @pytest.mark.parametrize
- Very specific: line 69
Use model_construct() for creating Pydantic model fixtures (skips validation)
- Very specific: line 82
Use aioresponses to mock HTTP requests.
- Very specific: line 101
Use get_tool_result_content(result) helper to extract tool return values.
- Very specific: line 118
Protocol: Add method signature to the matching mcp_tracker/tracker/proto/*.py (a new protocol also needs a *ProtocolWrap base, a …
- Very specific: line 120
Caching: Add wrapper in mcp_tracker/tracker/caching/client.py
- Very specific: line 121
Tool: Add function to appropriate module in mcp_tracker/mcp/tools/ - named and described per rules/tool-naming.md and …
- Very specific: line 134
Tests: Add to appropriate tests/mcp/tools/test_*_tools.py
- Very specific: line 135
Docs: Update README.md, README_ru.md, manifest.json and CHANGELOG.md - see rules/docs.md and rules/changelog.md
- Distinctive: line 164
Test success case with expected return data
- Very specific: line 165
Test parameter passing (verify call_args)
- Distinctive: line 166
Test optional parameters (provided vs omitted)
- Very specific: line 167
Test queue restrictions with client_session_with_limits if tool accesses issues/queues
- Very specific: line 168
Add tool name to appropriate list in tests/mcp/server/test_server_creation.py:
≈ “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.
Files
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 serverArchitecture
- Protocols (
mcp_tracker/tracker/proto/): Define API contracts (QueuesProtocol,IssueProtocol,GlobalDataProtocol,TemplatesProtocol,UsersProtocol,EntitiesProtocol,BoardsProtocol,ComponentsProtocol), each exposed onAppContextasqueues/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 toolsfield.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_componentsitself lives with the queue tools)issue_read.py/issue_write.py: Issue read-only / write toolsuser.py: User tools (read-only)__init__.py: Exportsregister_all_tools()which orchestrates tool registration*_write.pymodules are only registered whensettings.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 | Noneparameter 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 inmcp_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/priorityaccept an id or a key and resolve a numeric string as an id (verified against the API),followersaccept a uid or a login the same way, and a 422 from these means the referenced entity does not exist.componentsare the exception - a bare string there is a name, which makes a numeric-looking name ambiguous (this is whatcomponents: ["694"]answered 422 for), henceIssueComponentRefrequiring exactly one ofid/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()- orself._read(), which is_requestplus reading the body and is what a method wanting nothing but the body uses. Nothing callsself._sessiondirectly: the funnel is what builds the auth headers, translates aTimeoutErrorintoTrackerAPITimeout(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 ownerrorMessages/errorsend up in the raisedTrackerAPIErrorinstead 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 →IssueNotFoundon issue-scoped paths,QueueNotFoundon queue-scoped ones (v3/queues/{queue}/...),BoardNotFoundon board-scoped ones,ComponentNotFoundonv3/components/{id}and the similar error on other paths;conflict=covers 409 and 412 - a staleversionanswers 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_getreads a 404 asNone; an allowed status skipsnot_found/conflict/_raise_for_statusalike 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_aliasnext to everyvalidation_alias(story_pointsreads and writesstoryPoints). Responses are what callers feed back intofields, so the two spellings have to match;tests/tracker/proto/test_model_aliases.pyfails if a new field forgets this. fieldsmaps:issue_create/issue_updatetake the free-form map as an explicitfieldsparameter, never as**kwargs- a key naming a dedicated parameter used to raiseTypeError: got multiple values. The client merges it into the body last, so an entry overrides the dedicated parameter and an explicitnullclears the field (a dedicated parameter left asNoneis simply not sent).- Reference inputs: every
Issue*Refvalidates that it carries something to resolve (IssueComponentRefwants exactly one ofid/name, the others at least one ofid/key); Tracker answers an empty object with an unhelpful 400/422, and when bothidandkeyare set it resolves byid. - Issue
version: it is bumped by every change, including queue triggers and automation that fire right after creation, so the version returned byissue_createis routinely stale. Tools that acceptversionmust say so and point atissue_getfor a fresh read. - Issue checklists (
v3/issues/{id}/checklistItems) behave unlike the entity ones:POSTtakes exactly one item per request, soissue_add_checklist_itemsloops over the batch (a failure past the first item raisesChecklistBatchPartiallyAdded, which reports how many landed - nothing is rolled back), andPATCH .../{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 calltextrequired (it is not - aPATCHwith onlycheckedor onlyassigneeanswers 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 withChecklistItemEmptyUpdate.assigneeanddeadlineare cleared by an empty object ({}), which is whatclear_assignee/clear_deadlinesend - verified on the live API on 2026-08-31, along with the three spellings that do not work:nullanswers 200 and silently keeps the value,""and0answer 422. Setting and clearing the same field in one call is refused withFieldClearConflictrather 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 raisesChecklistItemNotFound(..., ambiguous=True), whose message names both -IssueNotFoundthere would assert the one cause Tracker does not distinguish, and the same bad id would report differently depending on whethertextwas passed.issue_add_checklist_itemswith an empty batch returnsissue_get_checklistrather 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 onlychecklistItemsis parsed (the key is absent once the checklist is empty). There is no per-item reconcile step here - that quirk belongs to the entities' bulkPATCH, see_reconcile_checklist_update. - Queue components (verified against the live API on 2026-09-06): only
GET v3/components(organization-wide, paginated, ignores aqueue=filter),POST v3/componentsandPATCH v3/components/{id}are documented. The server uses the undocumented queue-scopedGET v3/queues/{queue}/components(the full objects of one queue, no pagination headers) andGET 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=componentsonGET v3/queues/{queue}returns references only (idas a string,display), noversion,leadorassignAuto.PATCHrequiresversionas a query parameter: without it the API answers 428, and a stale one answers 412 (not 409) - the Errors bullet above says howconflict=covers both. An emptyPATCHbody answers 200 and changes nothing (the version does not move), socomponent_updaterefuses it locally withComponentEmptyUpdate; re-sending the value a field already has answers 200 without bumpingversioneither.leadis 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, noleadin the response, version bumped), which is whatclear_leadsends; the two spellings that do not work are the checklist ones again:nullanswers 200 and silently keeps the current lead,""answers 422.leadandclear_leadtogether are refused locally withFieldClearConflict.description: ""clears the description (nullchanges nothing);name: ""answers 422.DELETEanswers 204 with no body and takes noversion; deleting again, or reading afterwards, answers 404.descriptionandleadare absent from a response when unset. Component reads are not cached (component_get,queues_get_componentsdelegate without@cached): thecomponent_update/component_deletetools read through the protocol to get theversionthe 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 thePATCHa stale version for the rest of the TTL. Thecomponent_update/component_deletetools take a bare id, so underTRACKER_LIMIT_QUEUES/TRACKER_READ_ONLY_QUEUESthey read the component once to learn its queue (queue_checks_neededin_access.pysays when);component_updatealso reads it when the caller gave noversion. One GET at most, then the write. A component in a queue outsideTRACKER_LIMIT_QUEUESis reported asComponentNotFoundbycheck_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/issueshas notemplateIdparameter, soissue_createcannot take one without expanding the template client-side. Callers readissue_template_getand fill the arguments themselves. Adding atemplate_idparameter later means mergingfieldTemplatesunder the explicit arguments (which win) and mapping its reference values onto theIssue*Refmodels - the template returns them as objects like{"id": "1", "key": "bug"}, andcomponentsin particular need the id-or-name form (see the reference-fields note above).checklistItems/metricItemscannot 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
TrackerClienttests and@tests/aioresponses_utils.pyfor 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 test | Where |
| TrackerClient HTTP methods | tests/tracker/custom/test_*.py |
| Caching wrappers | tests/tracker/caching/test_*_protocol.py |
| MCP tools | tests/mcp/tools/test_*_tools.py |
| OAuth provider | tests/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 sessionclient_session_with_limits: Session with queue restrictions enabledmock_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
- Protocol: Add method signature to the matching
mcp_tracker/tracker/proto/*.py(a new protocol also needs a*ProtocolWrapbase, aCacheCollectionslot, anAppContextfield and wiring inmake_tracker_lifespan) - Client: Implement in
mcp_tracker/tracker/custom/client.py, throughself._request()/self._read()- see Talking to the Tracker API above (this holds for read-only methods too) - Caching: Add wrapper in
mcp_tracker/tracker/caching/client.py - Tool: Add function to appropriate module in
mcp_tracker/mcp/tools/- named and described perrules/tool-naming.mdandrules/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
- Queue read-only tools →
- Tests: Add to appropriate
tests/mcp/tools/test_*_tools.py - Docs: Update
README.md,README_ru.md,manifest.jsonandCHANGELOG.md- seerules/docs.mdandrules/changelog.md
Tool Categories
| Category | Module | Read-Only |
| Queue | queue.py | Yes |
| Queue Write | queue_write.py | No |
| Field | field.py | Yes |
| Template | template.py | Yes |
| Board | board.py | Yes |
| Component | component.py | Yes |
| Component Write | component_write.py | No |
| Issue Read | issue_read.py | Yes |
| Issue Write | issue_write.py | No |
| User | user.py | Yes |
| Project | project.py | Yes |
| Project Write | project_write.py | No |
| Portfolio | portfolio.py | Yes |
| Portfolio Write | portfolio_write.py | No |
| Goal | goal.py | Yes |
| Goal Write | goal_write.py | No |
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_limitsif 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
- Read-only tools →
- For write tools, add test with
client_session_read_onlyto 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.pyandtests/test_release_metadata.py- a new tool passes them without an exception being added
Configuration
Authentication (one required):
TRACKER_TOKEN: Static OAuth tokenTRACKER_IAM_TOKEN: Static IAM tokenTRACKER_SA_*: Service account credentials for dynamic IAM tokens
Organization (one required):
TRACKER_CLOUD_ORG_ID: For Yandex CloudTRACKER_ORG_ID: For on-premise
Optional:
TRACKER_LIMIT_QUEUES: Restrict access to specific queues (allow-list, reads and writes).TRACKER_READ_ONLY: Whentrue, disables all write tools (the*_write.pymodules)TRACKER_READ_ONLY_QUEUES: Per-queue read-only allow-list. Write tools stay registered, but mutating calls targeting a listed queue are rejected viacheck_*_access(..., write=True)in_access.py; reads still work.TRACKER_ENTITIES_ENABLED: Whentrue, registers the project/portfolio/goal tools (project*.py,portfolio*.py,goal*.py). Defaultfalse: 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 cachingOAUTH_ENABLED: Enable OAuth provider mode
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
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.

