tenderapi-mcp 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,3 @@
1
+ """TenderAPI MCP server package."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,161 @@
1
+ """TenderAPI MCP server — exposes BOAMP + TED procurement data as MCP tools.
2
+
3
+ Thin wrapper over the public REST API at https://tenderapi.fr.
4
+
5
+ Config (env vars):
6
+ TENDERAPI_KEY — required, obtain at https://tenderapi.fr/
7
+ TENDERAPI_BASE_URL — optional, default https://tenderapi.fr
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import os
13
+ from typing import Any
14
+
15
+ import httpx
16
+ from mcp.server.fastmcp import FastMCP
17
+
18
+ BASE_URL = os.getenv("TENDERAPI_BASE_URL", "https://tenderapi.fr").rstrip("/")
19
+ API_KEY = os.getenv("TENDERAPI_KEY", "")
20
+ TIMEOUT = float(os.getenv("TENDERAPI_TIMEOUT", "30"))
21
+
22
+ mcp = FastMCP("tenderapi")
23
+
24
+
25
+ def _headers() -> dict[str, str]:
26
+ if not API_KEY:
27
+ raise RuntimeError(
28
+ "TENDERAPI_KEY env var is not set. Get a free key at https://tenderapi.fr/"
29
+ )
30
+ return {"X-API-Key": API_KEY, "User-Agent": "tenderapi-mcp/0.1"}
31
+
32
+
33
+ def _drop_none(params: dict[str, Any]) -> dict[str, Any]:
34
+ return {k: v for k, v in params.items() if v is not None}
35
+
36
+
37
+ async def _get(path: str, params: dict[str, Any] | None = None) -> dict[str, Any]:
38
+ async with httpx.AsyncClient(timeout=TIMEOUT) as client:
39
+ r = await client.get(f"{BASE_URL}{path}", params=params or {}, headers=_headers())
40
+ if r.status_code >= 400:
41
+ raise RuntimeError(f"TenderAPI {r.status_code}: {r.text[:400]}")
42
+ return r.json()
43
+
44
+
45
+ @mcp.tool()
46
+ async def search_tenders(
47
+ cpv: str | None = None,
48
+ region: str | None = None,
49
+ budget_min: float | None = None,
50
+ budget_max: float | None = None,
51
+ deadline_after: str | None = None,
52
+ source: str | None = None,
53
+ status: str | None = None,
54
+ buyer_siret: str | None = None,
55
+ country: str | None = None,
56
+ page: int = 1,
57
+ page_size: int = 20,
58
+ ) -> dict[str, Any]:
59
+ """Search public procurement tenders from BOAMP (France) and TED (EU).
60
+
61
+ Returns a paginated list of tender notices matching the filters.
62
+
63
+ Args:
64
+ cpv: CPV classification code (e.g. "72000000" for IT services).
65
+ region: French region slug, lowercase (e.g. "occitanie", "ile-de-france", "bretagne").
66
+ budget_min: Minimum estimated budget, EUR.
67
+ budget_max: Maximum estimated budget, EUR.
68
+ deadline_after: ISO date (YYYY-MM-DD); only tenders with submission deadline after this date.
69
+ source: "boamp" (France) or "ted" (EU-wide). Omit to include both.
70
+ status: "open" | "closed" | "awarded".
71
+ buyer_siret: Exact SIRET of the French contracting authority (14 digits).
72
+ country: ISO 3-letter country code (default FR).
73
+ page: 1-indexed page number.
74
+ page_size: Results per page, 1-100.
75
+
76
+ Returns a dict with keys: total, page, page_size, results (list of tenders).
77
+ """
78
+ params = _drop_none({
79
+ "cpv": cpv, "region": region,
80
+ "budget_min": budget_min, "budget_max": budget_max,
81
+ "deadline_after": deadline_after, "source": source, "status": status,
82
+ "buyer_siret": buyer_siret, "country": country,
83
+ "page": page, "page_size": page_size,
84
+ })
85
+ return await _get("/tenders", params)
86
+
87
+
88
+ @mcp.tool()
89
+ async def search_awards(
90
+ cpv: str | None = None,
91
+ region: str | None = None,
92
+ winner_name: str | None = None,
93
+ winner_siret: str | None = None,
94
+ awarded_after: str | None = None,
95
+ amount_min: float | None = None,
96
+ source: str | None = None,
97
+ page: int = 1,
98
+ page_size: int = 20,
99
+ ) -> dict[str, Any]:
100
+ """Search award notices — who won which public contract, for how much.
101
+
102
+ Requires Starter tier or above.
103
+
104
+ Args:
105
+ cpv: CPV code filter.
106
+ region: Region slug.
107
+ winner_name: Partial match on the winning company name.
108
+ winner_siret: Exact SIRET match (14 digits).
109
+ awarded_after: ISO date; awards with an award date after this.
110
+ amount_min: Minimum contract amount, EUR.
111
+ source: "boamp" or "ted".
112
+ page / page_size: Pagination.
113
+ """
114
+ params = _drop_none({
115
+ "cpv": cpv, "region": region,
116
+ "winner_name": winner_name, "winner_siret": winner_siret,
117
+ "awarded_after": awarded_after, "amount_min": amount_min,
118
+ "source": source, "page": page, "page_size": page_size,
119
+ })
120
+ return await _get("/awards", params)
121
+
122
+
123
+ @mcp.tool()
124
+ async def winner_intel(
125
+ cpv: str | None = None,
126
+ region: str | None = None,
127
+ year: int | None = None,
128
+ limit: int = 10,
129
+ ) -> dict[str, Any]:
130
+ """Aggregated winner statistics — top companies by contract count and total amount.
131
+
132
+ Requires Pro tier. Use for competitive intelligence: "which companies win
133
+ IT contracts in Occitanie in 2025?".
134
+
135
+ Args:
136
+ cpv: CPV code filter.
137
+ region: Region slug.
138
+ year: Integer year filter (e.g. 2025).
139
+ limit: Top N results (default 10, max 50).
140
+ """
141
+ params = _drop_none({"cpv": cpv, "region": region, "year": year, "limit": limit})
142
+ return await _get("/awards/winner-intel", params)
143
+
144
+
145
+ @mcp.tool()
146
+ async def me() -> dict[str, Any]:
147
+ """Return the authenticated key's tier, quota remaining, and available features.
148
+
149
+ Useful for the agent to check quota before launching many calls or to pick
150
+ a tier-appropriate strategy.
151
+ """
152
+ return await _get("/me")
153
+
154
+
155
+ def main() -> None:
156
+ """CLI entry point — starts the MCP server over stdio."""
157
+ mcp.run()
158
+
159
+
160
+ if __name__ == "__main__":
161
+ main()
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: tenderapi-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for TenderAPI — French (BOAMP) and EU (TED) public procurement data
5
+ Project-URL: Homepage, https://tenderapi.fr
6
+ Project-URL: Documentation, https://tenderapi.fr/docs
7
+ Project-URL: Repository, https://github.com/IDNSIDNS/tenderapi-mcp
8
+ Project-URL: Issues, https://github.com/IDNSIDNS/tenderapi-mcp/issues
9
+ Author-email: TenderAPI <contact@tenderapi.fr>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,boamp,eu,france,mcp,procurement,ted
13
+ Requires-Python: >=3.10
14
+ Requires-Dist: httpx>=0.27
15
+ Requires-Dist: mcp>=1.0.0
16
+ Description-Content-Type: text/markdown
17
+
18
+ # TenderAPI MCP server
19
+
20
+ Expose TenderAPI (French BOAMP + EU TED public procurement data) as MCP tools for AI agents — Claude Desktop, Cursor, Continue, Zed, etc.
21
+
22
+ A thin wrapper over the public REST API at <https://tenderapi.fr>.
23
+
24
+ ## Install
25
+
26
+ Requires Python 3.10+.
27
+
28
+ From PyPI (once published):
29
+
30
+ ```bash
31
+ pip install tenderapi-mcp
32
+ ```
33
+
34
+ From source:
35
+
36
+ ```bash
37
+ git clone https://github.com/IDNSIDNS/tenderapi-mcp
38
+ cd tenderapi-mcp
39
+ pip install -e .
40
+ ```
41
+
42
+ ## Configure
43
+
44
+ Get a free API key at <https://tenderapi.fr/>.
45
+
46
+ Set the env var:
47
+
48
+ ```bash
49
+ export TENDERAPI_KEY=ta_your_key_here
50
+ ```
51
+
52
+ ## Use with Claude Desktop
53
+
54
+ Edit your Claude Desktop config:
55
+
56
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
57
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
58
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "tenderapi": {
64
+ "command": "tenderapi-mcp",
65
+ "env": {
66
+ "TENDERAPI_KEY": "ta_your_key_here"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ Restart Claude Desktop. The `tenderapi` server should appear in the tool picker.
74
+
75
+ ## Use with other MCP clients
76
+
77
+ Any MCP client supporting stdio transport. The binary `tenderapi-mcp` (installed by pip) is the entry point.
78
+
79
+ ## Tools exposed
80
+
81
+ | Tool | Tier | Description |
82
+ |------|------|-------------|
83
+ | `search_tenders` | Free | Search BOAMP + TED tenders with typed filters (CPV, region, budget, deadline, source…) |
84
+ | `search_awards` | Starter | Search award notices (who won which contract, for how much) |
85
+ | `winner_intel` | Pro | Aggregated winner stats — top companies by CPV / region / year |
86
+ | `me` | — | Current key tier, quota remaining, available features |
87
+
88
+ ## Tiers
89
+
90
+ - **Free**: 100 req/day — tenders only
91
+ - **Starter** (5 €/mo HT): 5 000 req/day — adds awards + webhooks
92
+ - **Pro** (15 €/mo HT): 50 000 req/day — adds winner intelligence
93
+
94
+ See <https://tenderapi.fr/#pricing>.
95
+
96
+ ## Local development
97
+
98
+ Override the API base URL via `TENDERAPI_BASE_URL` (default `https://tenderapi.fr`).
99
+
100
+ ## License
101
+
102
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,7 @@
1
+ tenderapi_mcp/__init__.py,sha256=N7M8780myosa4_-5RGBhRlg-wlJe8TrN9gy9CtJ4CHk,59
2
+ tenderapi_mcp/server.py,sha256=6fyDtUl75uly72FTbQjTQqQCkqVYZ2WmsC2kGtURLN8,5346
3
+ tenderapi_mcp-0.1.0.dist-info/METADATA,sha256=MSJxfSTN42E19wUwul3VRo4TBKu4ZFVOTdXQw6ZicRA,2686
4
+ tenderapi_mcp-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
5
+ tenderapi_mcp-0.1.0.dist-info/entry_points.txt,sha256=XTfInXTekOHmmNT8_TPrzlmJjg5wI33Ug69HHVFZDqA,60
6
+ tenderapi_mcp-0.1.0.dist-info/licenses/LICENSE,sha256=Mv8B-cHZieORQhNCpfdJj7aXSdvOk8Sm6f-xs3ZBDcY,1066
7
+ tenderapi_mcp-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ tenderapi-mcp = tenderapi_mcp.server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TenderAPI
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.