-
Notifications
You must be signed in to change notification settings - Fork 6
Unified server architecture serving both MCP and REST API endpoints #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA comprehensive REST API layer was added to the project, including route handlers, parameter validation, error handling, static content caching, and integration with the CLI. Extensive documentation was introduced for the API, along with new testing modules covering both the API routes and server CLI behavior. Associated rules and guidelines were also documented. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant FastMCP REST API
participant Helpers/Validation
participant Tool Layer
participant MockCtx
Client->>FastMCP REST API: HTTP request (e.g., /v1/get_block_info?chain=...)
FastMCP REST API->>Helpers/Validation: extract_and_validate_params(request)
Helpers/Validation-->>FastMCP REST API: params or error
alt params valid
FastMCP REST API->>MockCtx: get_mock_context()
FastMCP REST API->>Tool Layer: call tool_func(ctx, **params)
Tool Layer-->>FastMCP REST API: tool result
FastMCP REST API-->>Client: JSON response (ToolResponse)
else params invalid
Helpers/Validation-->>FastMCP REST API: raise ValueError
FastMCP REST API-->>Client: 400 JSON error response
end
Possibly related PRs
Suggested labels
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (12)
.cursor/rules/110-new-mcp-tool.mdc (1)
110-116
: Avoid duplicating registration logic – favour a unified helperThe added steps instruct developers to create per-tool REST wrappers. This diverges from the unified‐registration approach preferred by @akolotov (see learning note).
Consider extending the existingregister_unified_tool(...)
helper (or similar) so MCP and REST exposure stay DRY, and revise the instructions accordingly.blockscout_mcp_server/api/dependencies.py (1)
4-23
: Provide a generic fallback for unimplementedContext
methodsMany tools call
ctx.warning
,ctx.debug
, etc. If any such call slips through,MockCtx
will raiseAttributeError
. A lightweight safeguard:class MockCtx: @@ async def report_progress(self, *args, **kwargs) -> None: """Simulate the ``report_progress`` method of an MCP ``Context``.""" pass + + # Fallback for any other context methods used by tools + def __getattr__(self, _name): + async def _noop(*_args, **_kwargs): # type: ignore[return-value] + pass + return _noopThis keeps REST routes resilient if new context calls appear.
blockscout_mcp_server/server.py (1)
49-69
: Consider implementing unified tool registration in the future.Based on retrieved learnings, you prefer a unified tool registration approach that eliminates separate registration points. While the current implementation works correctly, consider refactoring to a unified registration system like
register_unified_tool(mcp, tool_function, endpoint, tool_function_rest)
to reduce duplication and maintenance burden..cursor/rules/230-api-route-tests.mdc (1)
10-15
: Add note about async-test hygieneThe guideline forgets to mention two recurring pitfalls we keep seeing in route tests:
- Always decorate coroutine tests with
@pytest.mark.asyncio
.- Ensure every
httpx.AsyncClient
isasync with …
or explicitlyaclose()
-d to avoid unclosed-socket warnings.Consider amending the bullet list.
blockscout_mcp_server/templates/index.html (1)
3-7
: Missing SEO / social meta tagsAdding a
<meta name="description">
and basic OpenGraph tags (og:title
,og:description
,og:url
) will improve link previews when the landing page is shared and helps search engines index the REST API doc.README.md (2)
98-110
: Terminology drift between “HTTP Mode” sectionsThe heading says “HTTP Mode (MCP only)” but the paragraph below still calls it “HTTP Streamable mode”. Pick one term (preferably “HTTP mode”) and use it consistently to avoid reader confusion.
-To run the server in HTTP Streamable mode (stateless, JSON responses): +To run the server in HTTP mode (stateless MCP over HTTP):
112-125
: Flag that –rest implicitly forces JSON responsesReaders might assume
--rest
keeps streamable SSE responses enabled. In practice the ASGI layer switches to plain JSON. A short parenthetical remark would make this explicit and spare users a round-trip of debugging.blockscout_mcp_server/llms.txt (1)
24-35
: Expose/health
and/v1/tools
earlyThe quick-start section is excellent, but many agents probe
/health
first. Mentioning it right after the base URL (and perhaps adding a sample call) will make adoption even smoother.TESTING.md (1)
96-118
: Clarify host binding & port reuseThe Docker example binds to
0.0.0.0:8000
but the local example leaves the host default (127.0.0.1
). For parity—and to avoid the “works in Docker but not in WSL” tickets we keep seeing—consider adding--http-host 0.0.0.0
to the local command or add a note explaining the difference.blockscout_mcp_server/api/helpers.py (1)
11-13
: Consider supporting additional boolean representations.The current implementation handles common truthy values, but you might want to consider supporting "on" and "off" as these are also common in web forms and query parameters.
def str_to_bool(val: str) -> bool: """Convert a string to a boolean value.""" - return val.lower() in ("true", "1", "t", "yes") + return val.lower() in ("true", "1", "t", "yes", "on")SPEC.md (1)
27-27
: Consider simplifying the phrasing.The static analysis tool suggests considering a shorter alternative to "in conjunction with".
- - Enabled by using the `--rest` flag in conjunction with `--http`. + - Enabled by using the `--rest` flag together with `--http`.blockscout_mcp_server/api/routes.py (1)
242-258
: Consider implementing unified tool registration in the future.Based on previous discussions, a unified registration approach (e.g.,
register_unified_tool(mcp, tool_function, endpoint, tool_function_rest)
) could reduce maintenance burden by eliminating dual registration points between this file andserver.py
.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
.cursor/AGENTS.md
(1 hunks).cursor/rules/110-new-mcp-tool.mdc
(1 hunks).cursor/rules/150-rest-api-implementation.mdc
(1 hunks).cursor/rules/160-static-content-caching.mdc
(1 hunks).cursor/rules/200-development-testing-workflow.mdc
(3 hunks).cursor/rules/230-api-route-tests.mdc
(1 hunks).cursor/rules/800-api-documentation-guidelines.mdc
(1 hunks)AGENTS.md
(7 hunks)API.md
(1 hunks)README.md
(6 hunks)SPEC.md
(5 hunks)TESTING.md
(4 hunks)blockscout_mcp_server/api/dependencies.py
(1 hunks)blockscout_mcp_server/api/helpers.py
(1 hunks)blockscout_mcp_server/api/routes.py
(1 hunks)blockscout_mcp_server/llms.txt
(1 hunks)blockscout_mcp_server/server.py
(1 hunks)blockscout_mcp_server/templates/index.html
(1 hunks)pyproject.toml
(1 hunks)tests/api/test_routes.py
(1 hunks)tests/test_server.py
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (11)
`pyproject.toml`: If any new package needs to be installed it needs to be done w...
pyproject.toml
: If any new package needs to be installed it needs to be done with 'sudowhich uv
pip install --system ""' command. Don't forget to update pyproject.toml with the new package.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/010-implementation-rules.mdc)
List of files the instruction was applied to:
pyproject.toml
`pyproject.toml`: When updating the version of the MCP server, update the `version` field in the `[project]` section of `pyproject.toml`.
pyproject.toml
: When updating the version of the MCP server, update theversion
field in the[project]
section ofpyproject.toml
.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/130-version-management.mdc)
List of files the instruction was applied to:
pyproject.toml
`.cursor/rules/*.mdc`: When you create, modify, or delete any `.mdc` file in `.cursor/rules/`, you MUST update `.cursor/AGENTS.md` accordingly.
.cursor/rules/*.mdc
: When you create, modify, or delete any.mdc
file in.cursor/rules/
, you MUST update.cursor/AGENTS.md
accordingly.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/900-rules-maintenance.mdc)
List of files the instruction was applied to:
.cursor/rules/160-static-content-caching.mdc
.cursor/rules/110-new-mcp-tool.mdc
.cursor/rules/200-development-testing-workflow.mdc
.cursor/rules/150-rest-api-implementation.mdc
.cursor/rules/800-api-documentation-guidelines.mdc
.cursor/rules/230-api-route-tests.mdc
`**/*.py`: The MCP server must be implemented in Python The MCP server must wrap...
**/*.py
: The MCP server must be implemented in Python
The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
The MCP server must communicate with AI agents or chat applications through stdin
📄 Source: CodeRabbit Inference Engine (.cursor/rules/000-role-and-task.mdc)
List of files the instruction was applied to:
blockscout_mcp_server/api/dependencies.py
blockscout_mcp_server/server.py
tests/test_server.py
blockscout_mcp_server/api/helpers.py
tests/api/test_routes.py
blockscout_mcp_server/api/routes.py
`**/*.py`: Regular Python modules should generally not exceed 500 lines of code ...
**/*.py
: Regular Python modules should generally not exceed 500 lines of code (LOC). If a module approaches this limit, consider splitting it into multiple focused modules (e.g., address_tools.py and address_tools_advanced.py) to maintain readability and logical organization.
ALL import statements must be placed at the top of the Python module, immediately after the module docstring (if present) and before any other code. Never insert imports inline near where the functionality is used. Follow PEP 8 import order.
ALL linting and formatting issues must be resolved before committing or pushing code. Use the Ruff rules defined in .cursor/rules/300-ruff-lint-and-format.mdc to identify and fix issues.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/010-implementation-rules.mdc)
List of files the instruction was applied to:
blockscout_mcp_server/api/dependencies.py
blockscout_mcp_server/server.py
tests/test_server.py
blockscout_mcp_server/api/helpers.py
tests/api/test_routes.py
blockscout_mcp_server/api/routes.py
`**/*.py`: Always run `ruff check . --fix` and `ruff format .` on generated code...
**/*.py
: Always runruff check . --fix
andruff format .
on generated code before suggesting commits or opening a PR
Avoid using# noqa: E501
for ordinary code lines; split long lines instead. Only use# noqa: E501
for docstrings or string literals that must exceed 120 characters.
Ruff enforces a 120-character line length limit by default (Black-compatible style)
📄 Source: CodeRabbit Inference Engine (.cursor/rules/300-ruff-lint-and-format.mdc)
List of files the instruction was applied to:
blockscout_mcp_server/api/dependencies.py
blockscout_mcp_server/server.py
tests/test_server.py
blockscout_mcp_server/api/helpers.py
tests/api/test_routes.py
blockscout_mcp_server/api/routes.py
`blockscout_mcp_server/server.py`: Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
blockscout_mcp_server/server.py
: Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/110-new-mcp-tool.mdc)
List of files the instruction was applied to:
blockscout_mcp_server/server.py
`tests/test_server.py`: Create or update the unit test file tests/test_server.py when adding or modifying server functionality
tests/test_server.py
: Create or update the unit test file tests/test_server.py when adding or modifying server functionality
📄 Source: CodeRabbit Inference Engine (.cursor/rules/200-development-testing-workflow.mdc)
List of files the instruction was applied to:
tests/test_server.py
`tests/test_*.py`: Create or update the appropriate unit test file tests/test_{module_name}.py when adding or modifying other modules
tests/test_*.py
: Create or update the appropriate unit test file tests/test_{module_name}.py when adding or modifying other modules
📄 Source: CodeRabbit Inference Engine (.cursor/rules/200-development-testing-workflow.mdc)
List of files the instruction was applied to:
tests/test_server.py
`.cursor/AGENTS.md`: Update the corresponding guidance in the 'Rule Application ...
.cursor/AGENTS.md
: Update the corresponding guidance in the 'Rule Application Guidelines' section of.cursor/AGENTS.md
to reflect the changes made to the rule file.
Keep rule application descriptions brief (1-2 lines) and focused on clearly specifying when the rule should be applied.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/900-rules-maintenance.mdc)
List of files the instruction was applied to:
.cursor/AGENTS.md
`AGENTS.md`: Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
AGENTS.md
: Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/110-new-mcp-tool.mdc)
List of files the instruction was applied to:
AGENTS.md
🧠 Learnings (22)
📓 Common learnings
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Simplify address objects in API responses to a single address string to save LLM context.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:30:10.535Z
Learning: The user akolotov prefers a simple unified registration approach `register_unified_tool(mcp, tool_function, endpoint, tool_function_rest)` over auto-generating REST wrappers. This maintains explicit REST wrapper functions while eliminating dual registration points, providing a good balance between reducing duplication and maintaining code clarity.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: After unit tests pass, validate the changes using HTTP mode testing (start the server and use curl commands)
pyproject.toml (3)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/010-implementation-rules.mdc:0-0
Timestamp: 2025-07-04T20:20:03.070Z
Learning: Applies to pyproject.toml : If any new package needs to be installed it needs to be done with 'sudo `which uv` pip install --system "<package>"' command. Don't forget to update pyproject.toml with the new package.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to pyproject.toml : When updating the version of the MCP server, update the `version` field in the `[project]` section of `pyproject.toml`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
.cursor/rules/160-static-content-caching.mdc (3)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/AGENTS.md : Update the corresponding guidance in the 'Rule Application Guidelines' section of `.cursor/AGENTS.md` to reflect the changes made to the rule file.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/rules/*.mdc : When you create, modify, or delete any `.mdc` file in `.cursor/rules/`, you MUST update `.cursor/AGENTS.md` accordingly.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
.cursor/rules/110-new-mcp-tool.mdc (17)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must name the data or system touched and any hard constraints (such as authentication, size, or date limits).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must not include implementation internals such as schemas, parameter lists, versions, or other details.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : If still under the character limit, the tool description docstring may include an ultra-short usage example to clarify intent.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must state the primary trigger for use and, if vital, a guardrail (when to call and, if necessary, when not to call).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must explain the key differentiator—why to choose this tool over near-duplicates.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must have a hard cap of 1,000 characters and should target 500 characters or fewer; every character must justify its existence.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a standardized ToolResponse[YourDataModel] object using the build_tool_response helper.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a strongly-typed ToolResponse[YourDataModel] instead of generic ToolResponse[dict].
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Avoid returning ToolResponse[dict] or ToolResponse[Any]; always prefer specific ToolResponse[YourDataModel].
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_*_integration.py : Add integration tests in tests/integration/test_{tool_module}_integration.py when adding or modifying tool functions that interact with live APIs
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/tools/test_*.py : Create or update the appropriate unit test file when adding or modifying tool functions: tests/tools/test_{tool_module}.py
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Create or modify a tool module file in blockscout_mcp_server/tools/ for each new tool, choosing an existing module or creating a new one as appropriate.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to AGENTS.md : Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
.cursor/rules/200-development-testing-workflow.mdc (25)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/* : Group related integration tests using descriptive class names or clear function naming patterns, use descriptive test names indicating the contract/schema being validated, separate helper-level and tool-level tests into different files when appropriate, and include clear comments explaining the choice of test data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/AGENTS.md : Update the corresponding guidance in the 'Rule Application Guidelines' section of `.cursor/AGENTS.md` to reflect the changes made to the rule file.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/test_server.py : Create or update the unit test file tests/test_server.py when adding or modifying server functionality
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_*_integration.py : Add integration tests in tests/integration/test_{tool_module}_integration.py when adding or modifying tool functions that interact with live APIs
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Run integration tests (pytest -m integration) when you have added or modified any existing MCP tool function, modified helper functions in tools/common.py, added or changed any integration test, or changed data extraction or transformation logic
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/rules/*.mdc : When you create, modify, or delete any `.mdc` file in `.cursor/rules/`, you MUST update `.cursor/AGENTS.md` accordingly.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/300-ruff-lint-and-format.mdc` for instructions applicable to identifying and fixing linting and formatting issues
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/test_common.py : Create or update the unit test file tests/test_common.py when adding or modifying common utilities
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_*_integration.py : Tool-level integration tests targeting high-level MCP tool functions (e.g., get_latest_block, get_tokens_by_address) must be located in files matching tests/integration/test_*_integration.py and should validate data extraction and schema against live API responses.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to Dockerfile : The MCP server must be runnable both locally and through Docker
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Follow semantic versioning (MAJOR.MINOR.PATCH) when choosing version numbers for the MCP server.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must be implemented in Python
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to pyproject.toml : When updating the version of the MCP server, update the `version` field in the `[project]` section of `pyproject.toml`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/tools/test_*.py : Create or update the appropriate unit test file when adding or modifying tool functions: tests/tools/test_{tool_module}.py
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/test_*.py : Create or update the appropriate unit test file tests/test_{module_name}.py when adding or modifying other modules
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_common_helpers.py : Add integration tests in tests/integration/test_common_helpers.py when modifying helper functions in tools/common.py
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Unit test files must not exceed 500 lines of code (LOC); if a file approaches this limit, split tests into multiple files (e.g., `test_some_tools_1.py`, `test_some_tools_2.py`) to maintain readability and focus.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/* : Every integration test function must be decorated with @pytest.mark.integration.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Always run the unit test suite before and after making changes using pytest
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_common_helpers.py : Helper-level integration tests targeting low-level helper functions in tools/common.py (e.g., make_blockscout_request, get_blockscout_base_url) must be located in tests/integration/test_common_helpers.py and verify basic network connectivity and response structure.
.cursor/rules/150-rest-api-implementation.mdc (14)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:30:10.535Z
Learning: The user akolotov prefers a simple unified registration approach `register_unified_tool(mcp, tool_function, endpoint, tool_function_rest)` over auto-generating REST wrappers. This maintains explicit REST wrapper functions while eliminating dual registration points, providing a good balance between reducing duplication and maintaining code clarity.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must name the data or system touched and any hard constraints (such as authentication, size, or date limits).
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must not include implementation internals such as schemas, parameter lists, versions, or other details.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For paginated tools, do not expose individual pagination parameters; use a single, opaque cursor string and handle it with apply_cursor_to_params.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must state the primary trigger for use and, if vital, a guardrail (when to call and, if necessary, when not to call).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a standardized ToolResponse[YourDataModel] object using the build_tool_response helper.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Always raise exceptions for error conditions; never return error messages in ToolResponse notes.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
.cursor/rules/800-api-documentation-guidelines.mdc (16)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/AGENTS.md : Update the corresponding guidance in the 'Rule Application Guidelines' section of `.cursor/AGENTS.md` to reflect the changes made to the rule file.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/rules/*.mdc : When you create, modify, or delete any `.mdc` file in `.cursor/rules/`, you MUST update `.cursor/AGENTS.md` accordingly.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/300-ruff-lint-and-format.mdc` for instructions applicable to identifying and fixing linting and formatting issues
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/010-implementation-rules.mdc` for general coding instructions before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must name the data or system touched and any hard constraints (such as authentication, size, or date limits).
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project introduction in `.cursor/rules/000-role-and-task.mdc` before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must have a hard cap of 1,000 characters and should target 500 characters or fewer; every character must justify its existence.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must not include implementation internals such as schemas, parameter lists, versions, or other details.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must state the primary trigger for use and, if vital, a guardrail (when to call and, if necessary, when not to call).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : If still under the character limit, the tool description docstring may include an ultra-short usage example to clarify intent.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must explain the key differentiator—why to choose this tool over near-duplicates.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to AGENTS.md : Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must open with a clear, verb-first summary (e.g., 'Retrieves current weather').
blockscout_mcp_server/api/dependencies.py (12)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Use the `mock_ctx` pytest fixture from `tests/conftest.py` for mocking the MCP Context object in tests; do not create a manual MagicMock for the context within your test functions.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Use the report_and_log_progress helper from tools/common.py for all progress reporting instead of calling ctx.report_progress directly.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Ensure all external API calls are properly mocked using `unittest.mock.patch` and `AsyncMock`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/common.py : Create a request helper function for new APIs in blockscout_mcp_server/tools/common.py.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Create or modify a tool module file in blockscout_mcp_server/tools/ for each new tool, choosing an existing module or creating a new one as appropriate.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : For tools using `make_request_with_periodic_progress`, mock the wrapper itself and assert that it was called with the correct arguments (`request_function`, `request_args`, etc.).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Always verify the number of calls to `mock_ctx.report_progress` in your assertions to ensure progress tracking is tested.
blockscout_mcp_server/server.py (10)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to pyproject.toml : When updating the version of the MCP server, update the `version` field in the `[project]` section of `pyproject.toml`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must be implemented in Python
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
blockscout_mcp_server/templates/index.html (12)
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Create or modify a tool module file in blockscout_mcp_server/tools/ for each new tool, choosing an existing module or creating a new one as appropriate.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Truncate large data fields in API responses and flag the truncation, providing guidance on how to retrieve the full data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
blockscout_mcp_server/llms.txt (16)
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to AGENTS.md : Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/AGENTS.md : Update the corresponding guidance in the 'Rule Application Guidelines' section of `.cursor/AGENTS.md` to reflect the changes made to the rule file.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Truncate large data fields in API responses and flag the truncation, providing guidance on how to retrieve the full data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must communicate with AI agents or chat applications through stdin
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
tests/test_server.py (10)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/test_server.py : Create or update the unit test file tests/test_server.py when adding or modifying server functionality
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_*_integration.py : Tool-level integration tests targeting high-level MCP tool functions (e.g., get_latest_block, get_tokens_by_address) must be located in files matching tests/integration/test_*_integration.py and should validate data extraction and schema against live API responses.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Ensure all external API calls are properly mocked using `unittest.mock.patch` and `AsyncMock`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Create or modify a tool module file in blockscout_mcp_server/tools/ for each new tool, choosing an existing module or creating a new one as appropriate.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: After unit tests pass, validate the changes using HTTP mode testing (start the server and use curl commands)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_common_helpers.py : Helper-level integration tests targeting low-level helper functions in tools/common.py (e.g., make_blockscout_request, get_blockscout_base_url) must be located in tests/integration/test_common_helpers.py and verify basic network connectivity and response structure.
README.md (20)
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Truncate large data fields in API responses and flag the truncation, providing guidance on how to retrieve the full data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For paginated tools, include the exact notice '**SUPPORTS PAGINATION**: If response includes 'pagination' field, use the provided next_call to get additional pages.' in the docstring.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Simplify address objects in API responses to a single address string to save LLM context.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For paginated tools, do not expose individual pagination parameters; use a single, opaque cursor string and handle it with apply_cursor_to_params.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must be implemented in Python
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must communicate with AI agents or chat applications through stdin
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Use the exact same version string in both `pyproject.toml` and `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to Dockerfile : The MCP server must be runnable both locally and through Docker
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
TESTING.md (25)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to AGENTS.md : Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: After unit tests pass, validate the changes using HTTP mode testing (start the server and use curl commands)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_*_integration.py : Tool-level integration tests targeting high-level MCP tool functions (e.g., get_latest_block, get_tokens_by_address) must be located in files matching tests/integration/test_*_integration.py and should validate data extraction and schema against live API responses.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must name the data or system touched and any hard constraints (such as authentication, size, or date limits).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/010-implementation-rules.mdc:0-0
Timestamp: 2025-07-04T20:20:03.070Z
Learning: Local testing hints are in TESTING.md.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a standardized ToolResponse[YourDataModel] object using the build_tool_response helper.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must be implemented in Python
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must communicate with AI agents or chat applications through stdin
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to Dockerfile : The MCP server must be runnable both locally and through Docker
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a strongly-typed ToolResponse[YourDataModel] instead of generic ToolResponse[dict].
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Simplify address objects in API responses to a single address string to save LLM context.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : For tools returning a `ToolResponse` object, do not parse JSON from string results in your test; instead, mock the serialization function (`json.dumps`) if used internally, and make assertions on the structured `ToolResponse` object and its attributes.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Avoid returning ToolResponse[dict] or ToolResponse[Any]; always prefer specific ToolResponse[YourDataModel].
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Always raise exceptions for error conditions; never return error messages in ToolResponse notes.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : When testing tools that transform a list of items, programmatically generate the `expected_result` from the `mock_api_response` instead of writing out large, repetitive expected results.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_*_integration.py : Add integration tests in tests/integration/test_{tool_module}_integration.py when adding or modifying tool functions that interact with live APIs
blockscout_mcp_server/api/helpers.py (3)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/common.py : Create a request helper function for new APIs in blockscout_mcp_server/tools/common.py.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
.cursor/rules/230-api-route-tests.mdc (14)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Ensure all external API calls are properly mocked using `unittest.mock.patch` and `AsyncMock`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_*_integration.py : Add integration tests in tests/integration/test_{tool_module}_integration.py when adding or modifying tool functions that interact with live APIs
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/test_server.py : Create or update the unit test file tests/test_server.py when adding or modifying server functionality
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_*_integration.py : Tool-level integration tests targeting high-level MCP tool functions (e.g., get_latest_block, get_tokens_by_address) must be located in files matching tests/integration/test_*_integration.py and should validate data extraction and schema against live API responses.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/* : Group related integration tests using descriptive class names or clear function naming patterns, use descriptive test names indicating the contract/schema being validated, separate helper-level and tool-level tests into different files when appropriate, and include clear comments explaining the choice of test data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Assert that mocked API helper functions (such as `make_blockscout_request`) are called exactly once with the correct `api_path` and `params` in your tests.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Use the `mock_ctx` pytest fixture from `tests/conftest.py` for mocking the MCP Context object in tests; do not create a manual MagicMock for the context within your test functions.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: After unit tests pass, validate the changes using HTTP mode testing (start the server and use curl commands)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Group related tests using descriptive class names or clear function naming patterns.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : When testing tools that transform a list of items, programmatically generate the `expected_result` from the `mock_api_response` instead of writing out large, repetitive expected results.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : For tools returning a `ToolResponse` object, do not parse JSON from string results in your test; instead, mock the serialization function (`json.dumps`) if used internally, and make assertions on the structured `ToolResponse` object and its attributes.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Write tests covering success scenarios, error cases, and edge cases.
.cursor/AGENTS.md (15)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/AGENTS.md : Update the corresponding guidance in the 'Rule Application Guidelines' section of `.cursor/AGENTS.md` to reflect the changes made to the rule file.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/rules/*.mdc : When you create, modify, or delete any `.mdc` file in `.cursor/rules/`, you MUST update `.cursor/AGENTS.md` accordingly.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to AGENTS.md : Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Applies to .cursor/AGENTS.md : Keep rule application descriptions brief (1-2 lines) and focused on clearly specifying when the rule should be applied.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/900-rules-maintenance.mdc:0-0
Timestamp: 2025-07-04T20:35:06.726Z
Learning: Before finishing any task involving rule files, double-check that AGENTS.md is updated.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `AGENTS.md` to understand the project structure. When adding a new module, ensure it is consistent with the approach reflected in this document.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/200-development-testing-workflow.mdc` for instructions related to unit and integration testing applicable when a new helper function or MCP tool function is added or modified
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/010-implementation-rules.mdc:0-0
Timestamp: 2025-07-04T20:20:03.070Z
Learning: The project structure is reflected in AGENTS.md.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/300-ruff-lint-and-format.mdc` for instructions applicable to identifying and fixing linting and formatting issues
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/010-implementation-rules.mdc:0-0
Timestamp: 2025-07-04T20:20:03.070Z
Learning: Applies to **/*.py : ALL linting and formatting issues must be resolved before committing or pushing code. Use the Ruff rules defined in .cursor/rules/300-ruff-lint-and-format.mdc to identify and fix issues.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/010-implementation-rules.mdc` for general coding instructions before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must name the data or system touched and any hard constraints (such as authentication, size, or date limits).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to pyproject.toml : When updating the version of the MCP server, update the `version` field in the `[project]` section of `pyproject.toml`.
AGENTS.md (29)
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to AGENTS.md : Update AGENTS.md documentation to reflect new or modified tool modules, including updates to the project structure and examples sections.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `AGENTS.md` to understand the project structure. When adding a new module, ensure it is consistent with the approach reflected in this document.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to pyproject.toml : When updating the version of the MCP server, update the `version` field in the `[project]` section of `pyproject.toml`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must be implemented in Python
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Create or modify a tool module file in blockscout_mcp_server/tools/ for each new tool, choosing an existing module or creating a new one as appropriate.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Use the exact same version string in both `pyproject.toml` and `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_*_integration.py : Add integration tests in tests/integration/test_{tool_module}_integration.py when adding or modifying tool functions that interact with live APIs
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_*_integration.py : Tool-level integration tests targeting high-level MCP tool functions (e.g., get_latest_block, get_tokens_by_address) must be located in files matching tests/integration/test_*_integration.py and should validate data extraction and schema against live API responses.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Ensure all external API calls are properly mocked using `unittest.mock.patch` and `AsyncMock`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_common_helpers.py : Add integration tests in tests/integration/test_common_helpers.py when modifying helper functions in tools/common.py
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/* : Group related integration tests using descriptive class names or clear function naming patterns, use descriptive test names indicating the contract/schema being validated, separate helper-level and tool-level tests into different files when appropriate, and include clear comments explaining the choice of test data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Run integration tests (pytest -m integration) when you have added or modified any existing MCP tool function, modified helper functions in tools/common.py, added or changed any integration test, or changed data extraction or transformation logic
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_common_helpers.py : Helper-level integration tests targeting low-level helper functions in tools/common.py (e.g., make_blockscout_request, get_blockscout_base_url) must be located in tests/integration/test_common_helpers.py and verify basic network connectivity and response structure.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Group related tests using descriptive class names or clear function naming patterns.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : When testing tools that transform a list of items, programmatically generate the `expected_result` from the `mock_api_response` instead of writing out large, repetitive expected results.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/tools/test_*.py : Create or update the appropriate unit test file when adding or modifying tool functions: tests/tools/test_{tool_module}.py
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/010-implementation-rules.mdc:0-0
Timestamp: 2025-07-04T20:20:03.070Z
Learning: The technical details for the project are in SPEC.md.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must communicate with AI agents or chat applications through stdin
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must not include implementation internals such as schemas, parameter lists, versions, or other details.
SPEC.md (25)
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read the project technical description in `SPEC.md` to clearly understand how the MCP server communicates with counterparties and important aspects of the server implementation before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Update both `pyproject.toml` and `blockscout_mcp_server/__init__.py` simultaneously to maintain consistency across the codebase.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Simplify address objects in API responses to a single address string to save LLM context.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Truncate large data fields in API responses and flag the truncation, providing guidance on how to retrieve the full data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must communicate with AI agents or chat applications through stdin
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:30:10.535Z
Learning: The user akolotov prefers a simple unified registration approach `register_unified_tool(mcp, tool_function, endpoint, tool_function_rest)` over auto-generating REST wrappers. This maintains explicit REST wrapper functions while eliminating dual registration points, providing a good balance between reducing duplication and maintaining code clarity.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must be implemented in Python
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a standardized ToolResponse[YourDataModel] object using the build_tool_response helper.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a strongly-typed ToolResponse[YourDataModel] instead of generic ToolResponse[dict].
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Avoid returning ToolResponse[dict] or ToolResponse[Any]; always prefer specific ToolResponse[YourDataModel].
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : If still under the character limit, the tool description docstring may include an ultra-short usage example to clarify intent.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must name the data or system touched and any hard constraints (such as authentication, size, or date limits).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must have a hard cap of 1,000 characters and should target 500 characters or fewer; every character must justify its existence.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must not include implementation internals such as schemas, parameter lists, versions, or other details.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must state the primary trigger for use and, if vital, a guardrail (when to call and, if necessary, when not to call).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/140-tool-description.mdc:0-0
Timestamp: 2025-07-04T20:26:50.806Z
Learning: Applies to mcp/tools/**/*.py : The tool description docstring must explain the key differentiator—why to choose this tool over near-duplicates.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/120-mcp-tool-arguments.mdc:0-0
Timestamp: 2025-07-04T20:23:34.413Z
Learning: Do not add new arguments to existing MCP tool functions unless explicitly requested.
tests/api/test_routes.py (16)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Ensure all external API calls are properly mocked using `unittest.mock.patch` and `AsyncMock`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_*_integration.py : Tool-level integration tests targeting high-level MCP tool functions (e.g., get_latest_block, get_tokens_by_address) must be located in files matching tests/integration/test_*_integration.py and should validate data extraction and schema against live API responses.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/integration/test_*_integration.py : Add integration tests in tests/integration/test_{tool_module}_integration.py when adding or modifying tool functions that interact with live APIs
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Run integration tests (pytest -m integration) when you have added or modified any existing MCP tool function, modified helper functions in tools/common.py, added or changed any integration test, or changed data extraction or transformation logic
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/200-development-testing-workflow.mdc:0-0
Timestamp: 2025-07-04T20:28:28.716Z
Learning: Applies to tests/test_server.py : Create or update the unit test file tests/test_server.py when adding or modifying server functionality
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : Assert that mocked API helper functions (such as `make_blockscout_request`) are called exactly once with the correct `api_path` and `params` in your tests.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : When testing tools that transform a list of items, programmatically generate the `expected_result` from the `mock_api_response` instead of writing out large, repetitive expected results.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/210-unit-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:30:09.292Z
Learning: Applies to tests/tools/*.py : For tools returning a `ToolResponse` object, do not parse JSON from string results in your test; instead, mock the serialization function (`json.dumps`) if used internally, and make assertions on the structured `ToolResponse` object and its attributes.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : When making multiple independent API calls, use asyncio.gather with return_exceptions=True and handle exceptions appropriately.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a standardized ToolResponse[YourDataModel] object using the build_tool_response helper.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_common_helpers.py : Helper-level integration tests targeting low-level helper functions in tools/common.py (e.g., make_blockscout_request, get_blockscout_base_url) must be located in tests/integration/test_common_helpers.py and verify basic network connectivity and response structure.
API.md (13)
Learnt from: akolotov
PR: blockscout/mcp-server#145
File: .cursor/rules/800-api-documentation-guidelines.mdc:14-35
Timestamp: 2025-07-10T23:39:32.021Z
Learning: In the Blockscout MCP Server project, API documentation in API.md intentionally omits example responses because the responses from Blockscout MCP tools are very large, and including them would make the document size unmanageable.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Truncate large data fields in API responses and flag the truncation, providing guidance on how to retrieve the full data.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For paginated tools, include the exact notice '**SUPPORTS PAGINATION**: If response includes 'pagination' field, use the provided next_call to get additional pages.' in the docstring.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-04T20:16:41.182Z
Learning: Read `.cursor/rules/110-new-mcp-tool.mdc` for instructions on adding a new MCP tool to the server or modifying an existing one before responding to a user request
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Simplify address objects in API responses to a single address string to save LLM context.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a standardized ToolResponse[YourDataModel] object using the build_tool_response helper.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a strongly-typed ToolResponse[YourDataModel] instead of generic ToolResponse[dict].
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/220-integration-testing-guidelines.mdc:0-0
Timestamp: 2025-07-04T20:31:56.480Z
Learning: Applies to tests/integration/test_*_integration.py : Tool-level integration tests targeting high-level MCP tool functions (e.g., get_latest_block, get_tokens_by_address) must be located in files matching tests/integration/test_*_integration.py and should validate data extraction and schema against live API responses.
blockscout_mcp_server/api/routes.py (13)
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:21:50.236Z
Learning: The user akolotov prefers a unified tool registration approach where a single function registers tools in both MCP and REST API instead of having separate registration points in blockscout_mcp_server/server.py and blockscout_mcp_server/api/routes.py. This would eliminate duplication and reduce maintenance burden.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/server.py : Register each new tool in blockscout_mcp_server/server.py by importing the tool function and registering it with the @mcp.tool() decorator.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/config.py : Add new API endpoint configuration to blockscout_mcp_server/config.py when introducing a new external API endpoint.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must wrap Blockscout APIs and expose blockchain data (balances, tokens, NFTs, contract metadata) via the Model Context Protocol (MCP)
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : Create or modify a tool module file in blockscout_mcp_server/tools/ for each new tool, choosing an existing module or creating a new one as appropriate.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that use fixed API endpoints (like BENS), use the appropriate request helper (e.g., make_bens_request).
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : For tools that query Blockscout API, use dynamic chain resolution via get_blockscout_base_url and make_blockscout_request.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/common.py : Create a request helper function for new APIs in blockscout_mcp_server/tools/common.py.
Learnt from: akolotov
PR: blockscout/mcp-server#142
File: blockscout_mcp_server/api/routes.py:242-258
Timestamp: 2025-07-10T19:30:10.535Z
Learning: The user akolotov prefers a simple unified registration approach `register_unified_tool(mcp, tool_function, endpoint, tool_function_rest)` over auto-generating REST wrappers. This maintains explicit REST wrapper functions while eliminating dual registration points, providing a good balance between reducing duplication and maintaining code clarity.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/130-version-management.mdc:0-0
Timestamp: 2025-07-04T20:25:11.277Z
Learning: Applies to blockscout_mcp_server/__init__.py : When updating the version of the MCP server, update the `__version__` variable in `blockscout_mcp_server/__init__.py`.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : When making multiple independent API calls, use asyncio.gather with return_exceptions=True and handle exceptions appropriately.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/110-new-mcp-tool.mdc:0-0
Timestamp: 2025-07-04T20:22:01.665Z
Learning: Applies to blockscout_mcp_server/tools/*.py : All tools MUST return a standardized ToolResponse[YourDataModel] object using the build_tool_response helper.
Learnt from: CR
PR: blockscout/mcp-server#0
File: .cursor/rules/000-role-and-task.mdc:0-0
Timestamp: 2025-07-04T20:18:25.795Z
Learning: Applies to **/*.py : The MCP server must be implemented in Python
🧬 Code Graph Analysis (2)
blockscout_mcp_server/server.py (1)
blockscout_mcp_server/api/routes.py (1)
register_api_routes
(223-258)
tests/test_server.py (1)
blockscout_mcp_server/api/routes.py (1)
register_api_routes
(223-258)
🪛 LanguageTool
SPEC.md
[style] ~27-~27: ‘in conjunction with’ might be wordy. Consider a shorter alternative.
Context: ... - Enabled by using the --rest
flag in conjunction with --http
. - This mode extends the st...
(EN_WORDINESS_PREMIUM_IN_CONJUNCTION_WITH)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Run Integration Tests
- GitHub Check: Docker build and docker push
🔇 Additional comments (37)
pyproject.toml (1)
12-13
: Trailing comma makes thedependencies
array invalid TOMLTOML 1.0 forbids trailing commas in arrays. The current comma after the last element will break
pip install
flows that parsepyproject.toml
.- "uvicorn>=0.23.1", # For HTTP Streamable mode + "uvicorn>=0.23.1" # For HTTP Streamable mode⛔ Skipped due to learnings
Learnt from: CR PR: blockscout/mcp-server#0 File: .cursor/rules/010-implementation-rules.mdc:0-0 Timestamp: 2025-07-04T20:20:03.070Z Learning: Applies to pyproject.toml : If any new package needs to be installed it needs to be done with 'sudo `which uv` pip install --system "<package>"' command. Don't forget to update pyproject.toml with the new package.
.cursor/rules/160-static-content-caching.mdc (1)
1-9
: Update.cursor/AGENTS.md
to reflect the new rulePer the maintenance rules, every new/modified
*.mdc
file requires a corresponding update of the “Rule Application Guidelines” section inAGENTS.md
.
Please add a short blurb describing the static-content-caching rule and its intent..cursor/rules/200-development-testing-workflow.mdc (1)
30-37
: Verify that230-api-route-tests.mdc
exists (or fix broken link)The workflow now references
[230-api-route-tests.mdc]
, but that file isn’t part of this PR. If it’s missing, the link will be dead in rendered docs; if it exists, ensure it’s committed..cursor/rules/800-api-documentation-guidelines.mdc (1)
1-42
: LGTM! Well-structured API documentation guidelines.The guidelines provide a clear, consistent template for documenting REST API endpoints. The format covers all essential elements: tool names, descriptions, parameter tables, and realistic curl examples. This will ensure standardized documentation across the project.
.cursor/rules/150-rest-api-implementation.mdc (1)
1-34
: LGTM! Comprehensive REST API implementation guidelines.The guidelines establish excellent standards for REST endpoint implementation, covering naming conventions, centralized parameter validation, proper error handling, and versioned route registration. The requirement for documentation updates ensures consistency across the project.
blockscout_mcp_server/server.py (4)
78-78
: LGTM! Proper CLI option definition.The new
--rest
flag is correctly defined with appropriate help text and default value.
84-87
: LGTM! Clear documentation of server modes.The docstring clearly explains the different server modes and flag combinations, making the CLI interface intuitive for users.
89-96
: LGTM! Proper conditional REST API registration.The conditional logic correctly handles the REST API mode by importing and registering routes only when both
--http
and--rest
flags are provided, with appropriate startup messages.
102-103
: LGTM! Proper error handling for invalid flag combinations.The code correctly raises a
BadParameter
exception when--rest
is used without--http
, providing clear feedback to users..cursor/AGENTS.md (3)
21-25
: LGTM! Proper integration of new API guidelines.The new "API Endpoints & Static Content" section correctly references the REST API implementation and static content caching rules, maintaining consistency with the existing documentation structure.
31-31
: LGTM! Good addition of API route testing guidance.The reference to API route testing guidelines is properly integrated into the testing section, ensuring comprehensive test coverage for the new REST API functionality.
37-47
: LGTM! Clear documentation rules integration.The new "Documentation Rules" section and its repetition under "Meta Operations" ensure that API documentation guidelines are prominently featured and consistently applied across the project.
tests/test_server.py (4)
10-18
: LGTM! Proper error case testing.The test correctly verifies that using
--rest
without--http
raises a CLI error. The ANSI color code stripping ensures stable assertions across different terminal environments.
21-34
: LGTM! Good mocking strategy for route registration.The test properly mocks the routes module and verifies that route registration occurs when both
--http
and--rest
flags are used. The module cleanup ensures test isolation.
36-47
: LGTM! Verification of HTTP-only mode.The test correctly verifies that using only
--http
starts the server without registering REST routes, ensuring the conditional logic works as expected.
49-56
: LGTM! Complete test coverage for stdio mode.The test verifies that the default stdio mode works correctly by mocking the FastMCP.run method, ensuring backward compatibility is maintained.
blockscout_mcp_server/api/helpers.py (2)
1-67
: Well-designed helper module for REST API utilities.The module provides a clean separation of concerns with centralized parameter handling, validation, and error management. The implementation follows good patterns and integrates well with the Starlette framework.
18-21
: Good approach for centralized type handling.The parameter type mapping provides a clean way to handle different parameter types consistently across all endpoints.
tests/api/test_routes.py (3)
1-481
: Comprehensive and well-structured test suite.The test module provides excellent coverage of all REST API endpoints with both positive and negative test cases. The use of fixtures, proper mocking, and descriptive test names makes the test suite maintainable and reliable.
13-25
: Good fixture design for testing FastMCP applications.The fixtures properly set up the test environment with a FastMCP instance and configured HTTP client, enabling comprehensive testing of the API routes.
27-59
: Excellent testing of static routes and clean app behavior.The tests verify that static routes work correctly after registration and are properly unavailable on unconfigured instances, ensuring the registration mechanism works as expected.
SPEC.md (3)
11-36
: Clear and comprehensive operational modes documentation.The updated documentation effectively explains the three operational modes and their relationships, making it easy for users to understand when and how to use each mode.
76-112
: Excellent addition of REST API architecture documentation.The new sections on REST API data flow and unified server architecture provide valuable technical context, clearly explaining how the REST API integrates with the existing MCP functionality without duplication.
148-157
: Well-structured architectural decisions section.The updated architectural decisions section effectively explains the motivation and implementation of the unified server approach, providing good context for future maintainers.
AGENTS.md (4)
9-18
: Comprehensive project structure updates.The documentation properly reflects all new components of the REST API implementation, including the api sub-package, templates directory, and llms.txt file.
44-46
: Good documentation of new test modules.The addition of the API test directory and server test module properly documents the expanded test coverage for the REST API functionality.
80-82
: Appropriate documentation of new API documentation file.The addition of API.md documentation provides users with comprehensive information about the REST API endpoints and usage.
185-188
: Well-structured API layer documentation.The new API layer section clearly documents the purpose and structure of the REST API components, maintaining consistency with the existing documentation style.
API.md (5)
1-16
: Well-structured API documentation introduction.The base URL definition and static endpoints table are clear and properly formatted.
17-72
: Comprehensive API concepts documentation.The authentication status, response structure, error handling, and pagination mechanisms are clearly explained with helpful examples.
73-122
: Clear documentation for tool discovery and general endpoints.The endpoint documentation follows a consistent format with method, path, parameters, and examples.
124-301
: Well-documented blockchain query endpoints.The block, transaction, and address tool endpoints are thoroughly documented with clear parameter tables and consistent formatting.
303-398
: Complete API endpoint documentation.The token, NFT, search, and contract tools sections maintain the same high documentation standards with clear examples.
blockscout_mcp_server/api/routes.py (4)
55-74
: Well-implemented static route handlers.The static route handlers properly handle missing content and return appropriate error responses.
76-216
: Consistent and well-structured REST wrapper implementations.All REST wrapper functions follow a uniform pattern with proper parameter extraction, validation, and error handling through decorators.
218-221
: Clean helper function for versioned route registration.The
_add_v1_tool_route
helper ensures consistent URL prefixing for all v1 endpoints.
226-235
: Clever use of closure for accessing MCP instance.The inner function design with clear documentation explaining the rationale is excellent. This approach reduces coupling and simplifies testing.
After merge of this PR, #98 is not needed |
This PR addresses functionality requested in #108 and includes all the changes made under the epic sub-issues:
/health
,/
,/llms.txt
) #136API.md
and Update Project Documentation for REST API #144Summary by CodeRabbit
New Features
--rest
) alongside existing server modes.Bug Fixes
Documentation
Tests
Chores