codal-mcp 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/.github/workflows/ci.yml +1 -1
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/.github/workflows/publish.yml +1 -1
- codal_mcp-0.2.2/LICENSE +80 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/PKG-INFO +9 -5
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/README.md +7 -3
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/pyproject.toml +2 -2
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/server.json +2 -2
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/src/codal_mcp/http.py +6 -4
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/src/codal_mcp/server.py +18 -2
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/test_codal.py +26 -1
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/uv.lock +1 -1
- codal_mcp-0.2.0/LICENSE +0 -21
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/.github/banner.png +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/.github/dependabot.yml +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/.gitignore +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/src/codal_mcp/__init__.py +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/src/codal_mcp/codal.py +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/src/codal_mcp/registry.py +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/conftest.py +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/attachment_1618277.html +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/attachment_1618277_curl.html +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/categories.json +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/companies_trim.json +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/decision_1612323.html +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/decision_1612323_sheet0.html +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/decision_1618277.html +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/decision_captcha_wall.html +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/financial_years_foolad.json +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/industry_groups.json +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/search_foolad.json +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/search_tracing_1612323.json +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/fixtures/search_tracing_1618277.json +0 -0
- {codal_mcp-0.2.0 → codal_mcp-0.2.2}/tests/test_live_codal.py +0 -0
codal_mcp-0.2.2/LICENSE
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Required Notice: Copyright (c) 2026 Sepehr Radmard (https://github.com/sepehr071)
|
|
2
|
+
|
|
3
|
+
Free for personal and non-commercial use under the terms below. Commercial use needs a
|
|
4
|
+
separate license: contact Sepehr Radmard at https://www.linkedin.com/in/sepehr-radmard or https://github.com/sepehr071.
|
|
5
|
+
|
|
6
|
+
Versions released before this license change were published under the MIT license and stay under it.
|
|
7
|
+
|
|
8
|
+
# PolyForm Noncommercial License 1.0.0
|
|
9
|
+
|
|
10
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
11
|
+
|
|
12
|
+
## Acceptance
|
|
13
|
+
|
|
14
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
15
|
+
|
|
16
|
+
## Copyright License
|
|
17
|
+
|
|
18
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
19
|
+
|
|
20
|
+
## Distribution License
|
|
21
|
+
|
|
22
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
23
|
+
|
|
24
|
+
## Notices
|
|
25
|
+
|
|
26
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
27
|
+
|
|
28
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
29
|
+
|
|
30
|
+
## Changes and New Works License
|
|
31
|
+
|
|
32
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
33
|
+
|
|
34
|
+
## Patent License
|
|
35
|
+
|
|
36
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
37
|
+
|
|
38
|
+
## Noncommercial Purposes
|
|
39
|
+
|
|
40
|
+
Any noncommercial purpose is a permitted purpose.
|
|
41
|
+
|
|
42
|
+
## Personal Uses
|
|
43
|
+
|
|
44
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
45
|
+
|
|
46
|
+
## Noncommercial Organizations
|
|
47
|
+
|
|
48
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
49
|
+
|
|
50
|
+
## Fair Use
|
|
51
|
+
|
|
52
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
53
|
+
|
|
54
|
+
## No Other Rights
|
|
55
|
+
|
|
56
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
57
|
+
|
|
58
|
+
## Patent Defense
|
|
59
|
+
|
|
60
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
61
|
+
|
|
62
|
+
## Violations
|
|
63
|
+
|
|
64
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
69
|
+
|
|
70
|
+
## Definitions
|
|
71
|
+
|
|
72
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
73
|
+
|
|
74
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
75
|
+
|
|
76
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
77
|
+
|
|
78
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
79
|
+
|
|
80
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: codal-mcp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Unofficial read-only MCP server for codal.ir (کدال): disclosures, letters and financial statements of Iranian listed companies.
|
|
5
5
|
Project-URL: Homepage, https://github.com/sepehr071/codal-mcp
|
|
6
6
|
Project-URL: Issues, https://github.com/sepehr071/codal-mcp/issues
|
|
7
7
|
Project-URL: Website, https://mcpfarsi.ir/
|
|
8
8
|
Author-email: Sepehr Radmard <sepehrr80@gmail.com>
|
|
9
|
-
License-Expression:
|
|
9
|
+
License-Expression: PolyForm-Noncommercial-1.0.0
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Keywords: annual-report,bourse,codal,codal-ir,disclosures,eps,financial-statements,iran,listed-companies,mcp,model-context-protocol,persian,tehran-stock-exchange,tse
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -44,7 +44,7 @@ codal-mcp is an unofficial, read-only MCP server with 5 tools that turns those l
|
|
|
44
44
|
[](https://pypi.org/project/codal-mcp/)
|
|
45
45
|
[](https://github.com/sepehr071/codal-mcp/actions/workflows/ci.yml)
|
|
46
46
|
[](https://registry.modelcontextprotocol.io/?q=codal-mcp)
|
|
47
|
-
[](https://github.com/sepehr071/codal-mcp/blob/main/LICENSE)
|
|
48
48
|
|
|
49
49
|
[](https://vscode.dev/redirect/mcp/install?name=codal&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22codal-mcp%22%5D%7D)
|
|
50
50
|
|
|
@@ -400,6 +400,10 @@ notice. Data is informational. Nothing here is financial advice.
|
|
|
400
400
|
|
|
401
401
|
Built and maintained by **Sepehr Radmard** (سپهر رادمرد). Connect on [LinkedIn](https://www.linkedin.com/in/sepehr-radmard) or follow [@sepehr071 on GitHub](https://github.com/sepehr071) for more MCP servers for Iranian websites, all listed in [iran-mcp](https://github.com/sepehr071/iran-mcp). If this saves you time, a star on the repo helps other people find it.
|
|
402
402
|
|
|
403
|
-
## License
|
|
403
|
+
## مجوز استفاده (License)
|
|
404
404
|
|
|
405
|
-
|
|
405
|
+
<a href="https://www.linkedin.com/in/sepehr-radmard"><img src="https://raw.githubusercontent.com/sepehr071/iran-mcp/main/assets/license-banner.png" alt="استفادهٔ شخصی و غیرتجاری رایگان است؛ برای استفادهٔ تجاری با سپهر رادمرد تماس بگیرید. Free for personal and non-commercial use; commercial use needs a license." width="100%"></a>
|
|
406
|
+
|
|
407
|
+
**استفادهٔ شخصی و غیرتجاری رایگان است.** استفاده در شرکت، محصول پولی یا پروژهٔ مشتری به مجوز تجاری نیاز دارد؛ از راه [لینکدین](https://www.linkedin.com/in/sepehr-radmard) یا [گیت‌هاب](https://github.com/sepehr071) با سپهر رادمرد تماس بگیرید. متن کامل: [PolyForm Noncommercial 1.0.0](https://github.com/sepehr071/codal-mcp/blob/main/LICENSE). نسخه‌های پیش از 0.2.2 با مجوز MIT منتشر شده‌اند و همان مجوز را دارند.
|
|
408
|
+
|
|
409
|
+
Free for personal and non-commercial use under the [PolyForm Noncommercial License 1.0.0](https://github.com/sepehr071/codal-mcp/blob/main/LICENSE). Using it in a company, a paid product or a client project needs a commercial license: contact Sepehr Radmard on [LinkedIn](https://www.linkedin.com/in/sepehr-radmard) or [GitHub](https://github.com/sepehr071). Versions before 0.2.2 were released under MIT and stay under it.
|
|
@@ -15,7 +15,7 @@ codal-mcp is an unofficial, read-only MCP server with 5 tools that turns those l
|
|
|
15
15
|
[](https://pypi.org/project/codal-mcp/)
|
|
16
16
|
[](https://github.com/sepehr071/codal-mcp/actions/workflows/ci.yml)
|
|
17
17
|
[](https://registry.modelcontextprotocol.io/?q=codal-mcp)
|
|
18
|
-
[](https://github.com/sepehr071/codal-mcp/blob/main/LICENSE)
|
|
19
19
|
|
|
20
20
|
[](https://vscode.dev/redirect/mcp/install?name=codal&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22codal-mcp%22%5D%7D)
|
|
21
21
|
|
|
@@ -371,6 +371,10 @@ notice. Data is informational. Nothing here is financial advice.
|
|
|
371
371
|
|
|
372
372
|
Built and maintained by **Sepehr Radmard** (سپهر رادمرد). Connect on [LinkedIn](https://www.linkedin.com/in/sepehr-radmard) or follow [@sepehr071 on GitHub](https://github.com/sepehr071) for more MCP servers for Iranian websites, all listed in [iran-mcp](https://github.com/sepehr071/iran-mcp). If this saves you time, a star on the repo helps other people find it.
|
|
373
373
|
|
|
374
|
-
## License
|
|
374
|
+
## مجوز استفاده (License)
|
|
375
375
|
|
|
376
|
-
|
|
376
|
+
<a href="https://www.linkedin.com/in/sepehr-radmard"><img src="https://raw.githubusercontent.com/sepehr071/iran-mcp/main/assets/license-banner.png" alt="استفادهٔ شخصی و غیرتجاری رایگان است؛ برای استفادهٔ تجاری با سپهر رادمرد تماس بگیرید. Free for personal and non-commercial use; commercial use needs a license." width="100%"></a>
|
|
377
|
+
|
|
378
|
+
**استفادهٔ شخصی و غیرتجاری رایگان است.** استفاده در شرکت، محصول پولی یا پروژهٔ مشتری به مجوز تجاری نیاز دارد؛ از راه [لینکدین](https://www.linkedin.com/in/sepehr-radmard) یا [گیت‌هاب](https://github.com/sepehr071) با سپهر رادمرد تماس بگیرید. متن کامل: [PolyForm Noncommercial 1.0.0](https://github.com/sepehr071/codal-mcp/blob/main/LICENSE). نسخه‌های پیش از 0.2.2 با مجوز MIT منتشر شده‌اند و همان مجوز را دارند.
|
|
379
|
+
|
|
380
|
+
Free for personal and non-commercial use under the [PolyForm Noncommercial License 1.0.0](https://github.com/sepehr071/codal-mcp/blob/main/LICENSE). Using it in a company, a paid product or a client project needs a commercial license: contact Sepehr Radmard on [LinkedIn](https://www.linkedin.com/in/sepehr-radmard) or [GitHub](https://github.com/sepehr071). Versions before 0.2.2 were released under MIT and stay under it.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "codal-mcp"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Unofficial read-only MCP server for codal.ir (کدال): disclosures, letters and financial statements of Iranian listed companies."
|
|
5
5
|
readme = "README.md"
|
|
6
|
-
license = "
|
|
6
|
+
license = "PolyForm-Noncommercial-1.0.0"
|
|
7
7
|
license-files = ["LICENSE"]
|
|
8
8
|
authors = [{ name = "Sepehr Radmard", email = "sepehrr80@gmail.com" }]
|
|
9
9
|
requires-python = ">=3.10"
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
10
|
"websiteUrl": "https://github.com/sepehr071/codal-mcp",
|
|
11
|
-
"version": "0.2.
|
|
11
|
+
"version": "0.2.2",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "pypi",
|
|
15
15
|
"registryBaseUrl": "https://pypi.org",
|
|
16
16
|
"identifier": "codal-mcp",
|
|
17
|
-
"version": "0.2.
|
|
17
|
+
"version": "0.2.2",
|
|
18
18
|
"runtimeHint": "uvx",
|
|
19
19
|
"transport": {
|
|
20
20
|
"type": "stdio"
|
|
@@ -45,7 +45,7 @@ PAGE_HEADERS = {
|
|
|
45
45
|
MIN_INTERVAL = 2.0 # seconds between two requests to codal.ir; all requests are serialized
|
|
46
46
|
JITTER = (0.1, 0.5) # extra seconds added to each gap
|
|
47
47
|
BLOCK_COOLDOWN = 60 # seconds to stop calling codal.ir after a 429 or captcha (shared servers recover fast)
|
|
48
|
-
MAX_RETRIES = 1 # timeouts, network errors and 5xx only; 429 and 403 are never retried
|
|
48
|
+
MAX_RETRIES = 1 # read timeouts, network errors and 5xx only; connect timeouts, 429 and 403 are never retried
|
|
49
49
|
RETRY_DELAY = 2.0 # seconds before the retry
|
|
50
50
|
CACHE_TTL = 120 # seconds; default for searches
|
|
51
51
|
CACHE_MAX = 64
|
|
@@ -118,7 +118,7 @@ def _next_proxy(client: httpx.AsyncClient) -> bool:
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
async def _close_later(client: httpx.AsyncClient) -> None:
|
|
121
|
-
await asyncio.sleep(40) # longer than the
|
|
121
|
+
await asyncio.sleep(40) # longer than any request (the tool DEADLINE is 15 s)
|
|
122
122
|
await client.aclose()
|
|
123
123
|
|
|
124
124
|
|
|
@@ -140,7 +140,7 @@ def _get_client() -> httpx.AsyncClient:
|
|
|
140
140
|
max_connections=4,
|
|
141
141
|
),
|
|
142
142
|
headers=HEADERS,
|
|
143
|
-
timeout=httpx.Timeout(
|
|
143
|
+
timeout=httpx.Timeout(10, connect=4), # answers take 0.3-4 s; keeps a retry within the tool DEADLINE
|
|
144
144
|
limits=httpx.Limits(max_connections=4),
|
|
145
145
|
follow_redirects=False,
|
|
146
146
|
trust_env=False,
|
|
@@ -179,7 +179,9 @@ async def fetch(url: str, params: dict[str, Any] | None = None, text: bool = Fal
|
|
|
179
179
|
try:
|
|
180
180
|
r, content, client = await _request(url, query, headers, host)
|
|
181
181
|
except ApiError as e:
|
|
182
|
-
|
|
182
|
+
# A connect timeout is codal.ir ignoring this IP (it hangs for non-Iranian ones): a retry only waits again.
|
|
183
|
+
# curl_cffi raises a plain TimeoutException for both kinds, so its message tells them apart.
|
|
184
|
+
if last or e.status is not None or "Connection timed out" in str(e.__cause__):
|
|
183
185
|
raise
|
|
184
186
|
await asyncio.sleep(RETRY_DELAY)
|
|
185
187
|
continue
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""MCP server entry point: registers every read-only codal.ir tool."""
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
3
4
|
import functools
|
|
4
5
|
import inspect
|
|
5
6
|
import json
|
|
@@ -9,8 +10,13 @@ from mcp.server import MCPServer
|
|
|
9
10
|
from mcp.types import ToolAnnotations
|
|
10
11
|
|
|
11
12
|
from . import __version__, codal # noqa: F401 (imports register the tools)
|
|
13
|
+
from .http import ApiError
|
|
12
14
|
from .registry import TOOLS
|
|
13
15
|
|
|
16
|
+
# Seconds one tool call may take, waiting for the request queue and retries included: hosts like the mcpfarsi router
|
|
17
|
+
# cut a call at 20 s, and a clear error before that lets them retry elsewhere.
|
|
18
|
+
DEADLINE = 15
|
|
19
|
+
|
|
14
20
|
INSTRUCTIONS = """\
|
|
15
21
|
Unofficial, read-only access to codal.ir (سامانه کدال), the disclosure system of Iranian listed companies:
|
|
16
22
|
financial statements, monthly reports, meeting decisions, dividends, capital increases, material news.
|
|
@@ -48,11 +54,21 @@ def _slim(v, top=False):
|
|
|
48
54
|
|
|
49
55
|
|
|
50
56
|
def compact(fn):
|
|
51
|
-
"""Return the tool result as one compact JSON text block (the SDK default sends it twice, indented).
|
|
57
|
+
"""Return the tool result as one compact JSON text block (the SDK default sends it twice, indented).
|
|
58
|
+
|
|
59
|
+
The call fails with ApiError once it runs past DEADLINE.
|
|
60
|
+
"""
|
|
52
61
|
|
|
53
62
|
@functools.wraps(fn)
|
|
54
63
|
async def run(*args, **kwargs):
|
|
55
|
-
|
|
64
|
+
try:
|
|
65
|
+
result = await asyncio.wait_for(fn(*args, **kwargs), DEADLINE)
|
|
66
|
+
except asyncio.TimeoutError:
|
|
67
|
+
raise ApiError(
|
|
68
|
+
f"codal.ir did not answer within {DEADLINE} s. It often answers only Iranian connections "
|
|
69
|
+
"(CODAL_MCP_PROXY sets an Iranian proxy). Try again in a moment."
|
|
70
|
+
) from None
|
|
71
|
+
return json.dumps(_slim(result, top=True), ensure_ascii=False, separators=(",", ":"))
|
|
56
72
|
|
|
57
73
|
run.__doc__ = inspect.cleandoc(fn.__doc__ or "")
|
|
58
74
|
return run
|
|
@@ -4,7 +4,7 @@ import httpx
|
|
|
4
4
|
import pytest
|
|
5
5
|
from conftest import FIXTURES, fixture, page
|
|
6
6
|
|
|
7
|
-
from codal_mcp import http
|
|
7
|
+
from codal_mcp import http, server
|
|
8
8
|
|
|
9
9
|
pytestmark = pytest.mark.anyio
|
|
10
10
|
|
|
@@ -233,3 +233,28 @@ async def test_server_error_is_retried_once(client, api):
|
|
|
233
233
|
api[Q] = flaky
|
|
234
234
|
r = await client.call_tool("cd_search_letters", {})
|
|
235
235
|
assert not r.is_error and len(calls) == 2
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
async def test_connect_timeout_is_not_retried_but_read_timeout_is(client, api):
|
|
239
|
+
def hang(request):
|
|
240
|
+
raise httpx.TimeoutException("Failed to perform, curl: (28) Connection timed out after 4010 milliseconds.")
|
|
241
|
+
|
|
242
|
+
api[Q] = hang
|
|
243
|
+
r = await client.call_tool("cd_search_letters", {})
|
|
244
|
+
assert r.is_error and "did not answer in time" in r.content[0].text and len(api.calls) == 1
|
|
245
|
+
|
|
246
|
+
def slow(request):
|
|
247
|
+
raise httpx.TimeoutException("Failed to perform, curl: (28) Operation timed out after 14000 milliseconds.")
|
|
248
|
+
|
|
249
|
+
api[Q] = slow
|
|
250
|
+
await client.call_tool("cd_search_letters", {"page": 2})
|
|
251
|
+
assert len(api.calls) == 3
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
async def test_call_past_deadline_fails_with_clear_error(client, api, monkeypatch):
|
|
255
|
+
monkeypatch.setattr(server, "DEADLINE", 0.2)
|
|
256
|
+
monkeypatch.setattr(http, "MIN_INTERVAL", 1) # the second request waits in the queue past the deadline
|
|
257
|
+
api[Q] = by_tracing
|
|
258
|
+
serve_letters(api)
|
|
259
|
+
r = await client.call_tool("cd_letter", {"tracing_no": 1618277})
|
|
260
|
+
assert r.is_error and "did not answer within 0.2 s" in r.content[0].text
|
codal_mcp-0.2.0/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Sepehr Radmard
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|