clevertech-mcp-server 0.3.2__tar.gz → 0.3.4__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.
Files changed (39) hide show
  1. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/PKG-INFO +33 -41
  2. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/README.md +31 -39
  3. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/pyproject.toml +2 -3
  4. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/auth.py +1 -1
  5. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/rate_limit.py +1 -0
  6. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/server.py +28 -15
  7. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/tools/building.py +21 -35
  8. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/tools/business.py +4 -17
  9. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/tools/dls.py +24 -96
  10. clevertech_mcp_server-0.3.4/src/clevertech_mcp/tools/geo.py +60 -0
  11. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/tools/meta.py +2 -14
  12. clevertech_mcp_server-0.3.4/src/clevertech_mcp/tools/property.py +193 -0
  13. clevertech_mcp_server-0.3.2/.github/workflows/publish.yml +0 -50
  14. clevertech_mcp_server-0.3.2/.github/workflows/test.yml +0 -38
  15. clevertech_mcp_server-0.3.2/.gitignore +0 -30
  16. clevertech_mcp_server-0.3.2/Dockerfile +0 -22
  17. clevertech_mcp_server-0.3.2/package.json +0 -12
  18. clevertech_mcp_server-0.3.2/railway.toml +0 -12
  19. clevertech_mcp_server-0.3.2/railway_custom_domain.py +0 -50
  20. clevertech_mcp_server-0.3.2/src/clevertech_mcp/login.py +0 -149
  21. clevertech_mcp_server-0.3.2/src/clevertech_mcp/tools/geo.py +0 -117
  22. clevertech_mcp_server-0.3.2/src/clevertech_mcp/tools/property.py +0 -344
  23. clevertech_mcp_server-0.3.2/tests/__init__.py +0 -0
  24. clevertech_mcp_server-0.3.2/tests/conftest.py +0 -206
  25. clevertech_mcp_server-0.3.2/tests/test_auth.py +0 -347
  26. clevertech_mcp_server-0.3.2/tests/test_building.py +0 -181
  27. clevertech_mcp_server-0.3.2/tests/test_business.py +0 -164
  28. clevertech_mcp_server-0.3.2/tests/test_dls.py +0 -197
  29. clevertech_mcp_server-0.3.2/tests/test_login.py +0 -274
  30. clevertech_mcp_server-0.3.2/tests/test_property.py +0 -221
  31. clevertech_mcp_server-0.3.2/tests/test_server.py +0 -127
  32. clevertech_mcp_server-0.3.2/tests/test_zoning.py +0 -133
  33. clevertech_mcp_server-0.3.2/uv.lock +0 -832
  34. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/LICENSE +0 -0
  35. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/__init__.py +0 -0
  36. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/client.py +0 -0
  37. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/config.py +0 -0
  38. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/tools/__init__.py +0 -0
  39. {clevertech_mcp_server-0.3.2 → clevertech_mcp_server-0.3.4}/src/clevertech_mcp/tools/zoning.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: clevertech-mcp-server
3
- Version: 0.3.2
4
- Summary: MCP Server for CleverTech Canadian government data APIs
3
+ Version: 0.3.4
4
+ Summary: CleverTech MCP server — Canadian government data for AI agents: property, permits, zoning, business registry, and GPS ↔ DLS conversion. Free tier available.
5
5
  Author-email: CleverTech <dev@clevertech.ca>
6
6
  License: MIT
7
7
  License-File: LICENSE
@@ -22,15 +22,14 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  # CleverTech MCP Server
24
24
 
25
- <!-- mcp-name: ca.clevertech/clevertech-mcp-server -->
26
-
27
- **Canadian government data for AI agents.** Property assessments, building permits, zoning, business registry, DLS grid conversion — 50 free queries/day, no signup.
25
+ **CleverTech MCP server for AI agents.** Canadian government data — property assessments, building permits, zoning, business registry, and GPS ↔ DLS conversion. Free tier available, no signup.
28
26
 
29
27
  ```bash
30
- uvx clevertech-mcp-server
28
+ npx @clevertech/mcp-server
31
29
  ```
32
30
 
33
31
  [![PyPI version](https://badge.fury.io/py/clevertech-mcp-server.svg)](https://pypi.org/project/clevertech-mcp-server/)
32
+ [![npm version](https://badge.fury.io/npm/%40clevertech%2Fmcp-server.svg)](https://www.npmjs.com/package/@clevertech/mcp-server)
34
33
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
35
34
 
36
35
  ---
@@ -45,8 +44,8 @@ Add to your `~/.claude/claude_desktop_config.json`:
45
44
  {
46
45
  "mcpServers": {
47
46
  "clevertech": {
48
- "command": "uvx",
49
- "args": ["clevertech-mcp-server"]
47
+ "command": "npx",
48
+ "args": ["-y", "@clevertech/mcp-server"]
50
49
  }
51
50
  }
52
51
  }
@@ -73,8 +72,8 @@ Add to your MCP configuration:
73
72
  {
74
73
  "mcpServers": {
75
74
  "clevertech": {
76
- "command": "uvx",
77
- "args": ["clevertech-mcp-server"]
75
+ "command": "npx",
76
+ "args": ["-y", "@clevertech/mcp-server"]
78
77
  }
79
78
  }
80
79
  }
@@ -83,12 +82,16 @@ Add to your MCP configuration:
83
82
  ### Direct CLI
84
83
 
85
84
  ```bash
85
+ # npm (Node.js)
86
+ npx @clevertech/mcp-server
87
+
88
+ # uv / PyPI
86
89
  uvx clevertech-mcp-server
87
90
  ```
88
91
 
89
92
  ---
90
93
 
91
- ## Available Tools (12)
94
+ ## Available Tools (11)
92
95
 
93
96
  | Tool | Description |
94
97
  |------|-------------|
@@ -135,48 +138,38 @@ Use `list_cities` to see live availability, API capabilities per city, and prope
135
138
 
136
139
  ## Pricing
137
140
 
138
- No signup required to start. Free tier gives you 50 queries/day out of the box.
141
+ No signup required to start. Free tier gives you 50 queries/day out of the box. All subscription prices are in CAD — see [clevertech.ca/pricing](https://clevertech.ca/pricing) for full details.
139
142
 
140
143
  | Tier | Queries/Day | Price | API Key |
141
144
  |------|-------------|-------|---------|
142
145
  | **Free** | 50 | $0 | Not required |
143
- | **Developer** | 200 | Free | [Sign up →](https://clevertech.ca/keys) |
144
- | **Pro** | 2,000 | $10/mo | [Sign up →](https://clevertech.ca/keys) |
145
- | **Enterprise** | 10,000 | $40/mo | [Sign up →](https://clevertech.ca/keys) |
146
-
147
- [Get your API key →](https://clevertech.ca/keys)
148
-
149
- ### Using an API Key
146
+ | **Developer** | 2,000 | $149 CAD/mo | [Sign up →](https://clevertech.ca/keys) |
147
+ | **Team Pro** | 10,000 | $499 CAD/mo | [Sign up →](https://clevertech.ca/keys) |
148
+ | **Enterprise** | Custom | On inquiry | [Contact →](https://clevertech.ca/pricing#enterprise) |
150
149
 
151
- Set the ``CLEVERTECH_API_KEY`` environment variable (recommended):
150
+ **Prepaid bundles** (no subscription; calls never expire): 2,000 calls for $29, 10,000 for $99, or 50,000 for $399 CAD.
152
151
 
153
- ```bash
154
- export CLEVERTECH_API_KEY=your_key_here
155
- uvx clevertech-mcp-server
156
- ```
152
+ [Get your API key →](https://clevertech.ca/keys) · [View all plans →](https://clevertech.ca/pricing)
157
153
 
158
- Or pass it as a CLI flag:
154
+ ### Using an API Key
159
155
 
160
156
  ```bash
161
- uvx clevertech-mcp-server --api-key YOUR_KEY
157
+ npx @clevertech/mcp-server --api-key YOUR_KEY
162
158
  ```
163
159
 
164
- To get a new key, use device login:
160
+ Or via environment variable:
165
161
 
166
162
  ```bash
167
- uvx clevertech-mcp-server --login
163
+ export CLEVERTECH_API_KEY=your_key_here
164
+ npx @clevertech/mcp-server
168
165
  ```
169
166
 
170
- This opens a browser for Google sign-in, then prints your API key with
171
- instructions for setting the environment variable (RFC 8628 device flow).
172
- The key is **not** saved to disk — you configure it in your MCP client.
173
-
174
167
  ---
175
168
 
176
169
  ## Features
177
170
 
178
- - **No signup required** — 50 free queries/day out of the box
179
- - **12 MCP tools** covering property, permits, zoning, business registry, and DLS
171
+ - **No signup required** — free tier with daily API allowance ([pricing](https://clevertech.ca/pricing))
172
+ - **11 MCP tools** covering property, permits, zoning, business registry, and DLS
180
173
  - **Batch DLS conversion** — convert up to 100 coordinates in one call
181
174
  - **Consolidated property reports** — assessment + permits + zoning + DLS in a single response
182
175
  - **stdio transport** — works with Claude Code, Cursor, Cline, GitHub Copilot, and any MCP-compatible agent
@@ -190,15 +183,12 @@ The key is **not** saved to disk — you configure it in your MCP client.
190
183
 
191
184
  ```bash
192
185
  # Clone and set up
193
- git clone https://github.com/clevertechca/Clevertech-mcp-server.git
194
- cd Clevertech-mcp-server
186
+ git clone https://github.com/harmssam/clevertech-mcp-server.git
187
+ cd clevertech-mcp-server
195
188
  uv sync
196
189
 
197
190
  # Run locally (stdio transport)
198
- uv run clevertech-mcp-server
199
-
200
- # Run with --login to get an API key
201
- uv run clevertech-mcp-server --login
191
+ uv run clevertech-mcp-server --transport stdio
202
192
 
203
193
  # Run with SSE transport (for HTTP-based agents)
204
194
  uv run clevertech-mcp-server --transport sse --port 8000
@@ -233,8 +223,10 @@ src/clevertech_mcp/
233
223
 
234
224
  ## Documentation
235
225
 
236
- - [Tool Reference](docs/tools.md)
226
+ - [Agent Integration Guide](docs/agents.md)
227
+ - [llms.txt](llms.txt) — machine-readable summary for AI agents
237
228
  - [MCP Protocol Specification](https://modelcontextprotocol.io)
229
+ - [CleverTech Pricing](https://clevertech.ca/pricing)
238
230
  - [CleverTech API Keys](https://clevertech.ca/keys)
239
231
 
240
232
  ---
@@ -1,14 +1,13 @@
1
1
  # CleverTech MCP Server
2
2
 
3
- <!-- mcp-name: ca.clevertech/clevertech-mcp-server -->
4
-
5
- **Canadian government data for AI agents.** Property assessments, building permits, zoning, business registry, DLS grid conversion — 50 free queries/day, no signup.
3
+ **CleverTech MCP server for AI agents.** Canadian government data — property assessments, building permits, zoning, business registry, and GPS ↔ DLS conversion. Free tier available, no signup.
6
4
 
7
5
  ```bash
8
- uvx clevertech-mcp-server
6
+ npx @clevertech/mcp-server
9
7
  ```
10
8
 
11
9
  [![PyPI version](https://badge.fury.io/py/clevertech-mcp-server.svg)](https://pypi.org/project/clevertech-mcp-server/)
10
+ [![npm version](https://badge.fury.io/npm/%40clevertech%2Fmcp-server.svg)](https://www.npmjs.com/package/@clevertech/mcp-server)
12
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
13
12
 
14
13
  ---
@@ -23,8 +22,8 @@ Add to your `~/.claude/claude_desktop_config.json`:
23
22
  {
24
23
  "mcpServers": {
25
24
  "clevertech": {
26
- "command": "uvx",
27
- "args": ["clevertech-mcp-server"]
25
+ "command": "npx",
26
+ "args": ["-y", "@clevertech/mcp-server"]
28
27
  }
29
28
  }
30
29
  }
@@ -51,8 +50,8 @@ Add to your MCP configuration:
51
50
  {
52
51
  "mcpServers": {
53
52
  "clevertech": {
54
- "command": "uvx",
55
- "args": ["clevertech-mcp-server"]
53
+ "command": "npx",
54
+ "args": ["-y", "@clevertech/mcp-server"]
56
55
  }
57
56
  }
58
57
  }
@@ -61,12 +60,16 @@ Add to your MCP configuration:
61
60
  ### Direct CLI
62
61
 
63
62
  ```bash
63
+ # npm (Node.js)
64
+ npx @clevertech/mcp-server
65
+
66
+ # uv / PyPI
64
67
  uvx clevertech-mcp-server
65
68
  ```
66
69
 
67
70
  ---
68
71
 
69
- ## Available Tools (12)
72
+ ## Available Tools (11)
70
73
 
71
74
  | Tool | Description |
72
75
  |------|-------------|
@@ -113,48 +116,38 @@ Use `list_cities` to see live availability, API capabilities per city, and prope
113
116
 
114
117
  ## Pricing
115
118
 
116
- No signup required to start. Free tier gives you 50 queries/day out of the box.
119
+ No signup required to start. Free tier gives you 50 queries/day out of the box. All subscription prices are in CAD — see [clevertech.ca/pricing](https://clevertech.ca/pricing) for full details.
117
120
 
118
121
  | Tier | Queries/Day | Price | API Key |
119
122
  |------|-------------|-------|---------|
120
123
  | **Free** | 50 | $0 | Not required |
121
- | **Developer** | 200 | Free | [Sign up →](https://clevertech.ca/keys) |
122
- | **Pro** | 2,000 | $10/mo | [Sign up →](https://clevertech.ca/keys) |
123
- | **Enterprise** | 10,000 | $40/mo | [Sign up →](https://clevertech.ca/keys) |
124
-
125
- [Get your API key →](https://clevertech.ca/keys)
126
-
127
- ### Using an API Key
124
+ | **Developer** | 2,000 | $149 CAD/mo | [Sign up →](https://clevertech.ca/keys) |
125
+ | **Team Pro** | 10,000 | $499 CAD/mo | [Sign up →](https://clevertech.ca/keys) |
126
+ | **Enterprise** | Custom | On inquiry | [Contact →](https://clevertech.ca/pricing#enterprise) |
128
127
 
129
- Set the ``CLEVERTECH_API_KEY`` environment variable (recommended):
128
+ **Prepaid bundles** (no subscription; calls never expire): 2,000 calls for $29, 10,000 for $99, or 50,000 for $399 CAD.
130
129
 
131
- ```bash
132
- export CLEVERTECH_API_KEY=your_key_here
133
- uvx clevertech-mcp-server
134
- ```
130
+ [Get your API key →](https://clevertech.ca/keys) · [View all plans →](https://clevertech.ca/pricing)
135
131
 
136
- Or pass it as a CLI flag:
132
+ ### Using an API Key
137
133
 
138
134
  ```bash
139
- uvx clevertech-mcp-server --api-key YOUR_KEY
135
+ npx @clevertech/mcp-server --api-key YOUR_KEY
140
136
  ```
141
137
 
142
- To get a new key, use device login:
138
+ Or via environment variable:
143
139
 
144
140
  ```bash
145
- uvx clevertech-mcp-server --login
141
+ export CLEVERTECH_API_KEY=your_key_here
142
+ npx @clevertech/mcp-server
146
143
  ```
147
144
 
148
- This opens a browser for Google sign-in, then prints your API key with
149
- instructions for setting the environment variable (RFC 8628 device flow).
150
- The key is **not** saved to disk — you configure it in your MCP client.
151
-
152
145
  ---
153
146
 
154
147
  ## Features
155
148
 
156
- - **No signup required** — 50 free queries/day out of the box
157
- - **12 MCP tools** covering property, permits, zoning, business registry, and DLS
149
+ - **No signup required** — free tier with daily API allowance ([pricing](https://clevertech.ca/pricing))
150
+ - **11 MCP tools** covering property, permits, zoning, business registry, and DLS
158
151
  - **Batch DLS conversion** — convert up to 100 coordinates in one call
159
152
  - **Consolidated property reports** — assessment + permits + zoning + DLS in a single response
160
153
  - **stdio transport** — works with Claude Code, Cursor, Cline, GitHub Copilot, and any MCP-compatible agent
@@ -168,15 +161,12 @@ The key is **not** saved to disk — you configure it in your MCP client.
168
161
 
169
162
  ```bash
170
163
  # Clone and set up
171
- git clone https://github.com/clevertechca/Clevertech-mcp-server.git
172
- cd Clevertech-mcp-server
164
+ git clone https://github.com/harmssam/clevertech-mcp-server.git
165
+ cd clevertech-mcp-server
173
166
  uv sync
174
167
 
175
168
  # Run locally (stdio transport)
176
- uv run clevertech-mcp-server
177
-
178
- # Run with --login to get an API key
179
- uv run clevertech-mcp-server --login
169
+ uv run clevertech-mcp-server --transport stdio
180
170
 
181
171
  # Run with SSE transport (for HTTP-based agents)
182
172
  uv run clevertech-mcp-server --transport sse --port 8000
@@ -211,8 +201,10 @@ src/clevertech_mcp/
211
201
 
212
202
  ## Documentation
213
203
 
214
- - [Tool Reference](docs/tools.md)
204
+ - [Agent Integration Guide](docs/agents.md)
205
+ - [llms.txt](llms.txt) — machine-readable summary for AI agents
215
206
  - [MCP Protocol Specification](https://modelcontextprotocol.io)
207
+ - [CleverTech Pricing](https://clevertech.ca/pricing)
216
208
  - [CleverTech API Keys](https://clevertech.ca/keys)
217
209
 
218
210
  ---
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "clevertech-mcp-server"
3
- version = "0.3.2"
4
- description = "MCP Server for CleverTech Canadian government data APIs"
3
+ version = "0.3.4"
4
+ description = "CleverTech MCP server — Canadian government data for AI agents: property, permits, zoning, business registry, and GPS ↔ DLS conversion. Free tier available."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
7
7
  license = {text = "MIT"}
@@ -37,5 +37,4 @@ packages = ["src/clevertech_mcp"]
37
37
  dev = [
38
38
  "pytest>=9.0.3",
39
39
  "pytest-asyncio>=1.4.0",
40
- "ruff>=0.9.0",
41
40
  ]
@@ -15,7 +15,7 @@ import contextvars
15
15
  from typing import Optional, TYPE_CHECKING
16
16
 
17
17
  if TYPE_CHECKING:
18
- pass
18
+ from starlette.requests import Request
19
19
 
20
20
  # ContextVar bridge for SSE transport.
21
21
  # Set by Starlette middleware on the initial SSE connection request.
@@ -8,6 +8,7 @@ Tracks requests per source IP using a sliding-window approach:
8
8
 
9
9
  import time
10
10
  import threading
11
+ from typing import Optional
11
12
 
12
13
 
13
14
  class LocalRateLimiter:
@@ -3,7 +3,10 @@ CleverTech MCP Server — main entry point.
3
3
  """
4
4
 
5
5
  import os
6
+ import sys
6
7
  import argparse
8
+ import json
9
+ import contextvars
7
10
  from mcp.server.fastmcp import FastMCP
8
11
  from starlette.middleware.base import BaseHTTPMiddleware
9
12
  from starlette.responses import HTMLResponse, JSONResponse
@@ -417,6 +420,30 @@ uv run clevertech-mcp-server</pre>
417
420
  </div>
418
421
  </section>
419
422
 
423
+ <!-- ── PRICING ──────────────────────────────────────────── -->
424
+ <section>
425
+ <h2>Pricing</h2>
426
+ <div class="card" style="font-size:0.88rem;">
427
+ <p>No signup required to start. <strong>Free tier</strong> included &mdash; see
428
+ <a href="https://clevertech.ca/pricing" style="color:#0dc5b8;">clevertech.ca/pricing</a>
429
+ for daily allowance. All prices in CAD.</p>
430
+ <table style="width:100%;margin-top:0.75rem;border-collapse:collapse;font-size:0.85rem;">
431
+ <tr style="border-bottom:1px solid #1a3550;">
432
+ <th style="text-align:left;padding:0.4rem 0;color:#0dc5b8;">Tier</th>
433
+ <th style="text-align:left;padding:0.4rem 0;color:#0dc5b8;">Price</th>
434
+ </tr>
435
+ <tr style="border-bottom:1px solid #1a3550;"><td style="padding:0.35rem 0;">Free</td><td>Free tier</td></tr>
436
+ <tr style="border-bottom:1px solid #1a3550;"><td style="padding:0.35rem 0;">Prepaid</td><td>$29 (2,000 calls)</td></tr>
437
+ <tr style="border-bottom:1px solid #1a3550;"><td style="padding:0.35rem 0;">Developer</td><td>$149/mo</td></tr>
438
+ <tr style="border-bottom:1px solid #1a3550;"><td style="padding:0.35rem 0;">Team Pro</td><td>$499/mo</td></tr>
439
+ <tr><td style="padding:0.35rem 0;">Enterprise</td><td>Custom</td></tr>
440
+ </table>
441
+ <p style="margin-top:0.75rem;">
442
+ <a href="https://clevertech.ca/keys" style="color:#0dc5b8;">Get your API key &rarr;</a>
443
+ </p>
444
+ </div>
445
+ </section>
446
+
420
447
  <!-- ── AUTHENTICATION ───────────────────────────────────── -->
421
448
  <section>
422
449
  <h2>Authentication &amp; Rate Limits</h2>
@@ -570,29 +597,15 @@ def main():
570
597
  default=None,
571
598
  help="CleverTech API key (overrides CLEVERTECH_API_KEY env var)",
572
599
  )
573
- parser.add_argument(
574
- "--login",
575
- action="store_true",
576
- default=False,
577
- help="Authenticate via device authorization flow and print API key",
578
- )
579
600
  args = parser.parse_args()
580
601
 
581
602
  config = load_config()
582
603
  config["host"] = args.host
583
604
  config["port"] = args.port
584
605
 
585
- # Resolve API key priority: --api-key > CLEVERTECH_API_KEY env var > --login
606
+ # --api-key flag overrides env var for stdio mode
586
607
  if args.api_key:
587
608
  config["api_key"] = args.api_key
588
- os.environ["CLEVERTECH_API_KEY"] = args.api_key
589
- elif os.getenv("CLEVERTECH_API_KEY"):
590
- config["api_key"] = os.getenv("CLEVERTECH_API_KEY")
591
- elif args.login:
592
- from clevertech_mcp.login import device_login
593
- api_key = device_login(config.get("api_url", "https://clevertech.ca"))
594
- config["api_key"] = api_key
595
- os.environ["CLEVERTECH_API_KEY"] = api_key
596
609
 
597
610
  mcp = create_server(config)
598
611
 
@@ -6,39 +6,6 @@ from clevertech_mcp.rate_limit import LocalRateLimiter
6
6
  from clevertech_mcp.auth import _get_user_api_key, get_upstream_key, is_authenticated, _extract_client_ip
7
7
 
8
8
 
9
- def _permit_id(r: dict) -> str:
10
- """Upstream uses permit_id; older fixtures/docs used permit_number."""
11
- return r.get("permit_id") or r.get("permit_number") or "N/A"
12
-
13
-
14
- def _permit_value(r: dict):
15
- """Upstream uses estimated_value; older fixtures used job_value."""
16
- if r.get("estimated_value") is not None:
17
- return r.get("estimated_value")
18
- return r.get("job_value")
19
-
20
-
21
- def _permit_issued(r: dict) -> str:
22
- """Upstream uses issue_date; older fixtures used issued_date."""
23
- return r.get("issue_date") or r.get("issued_date") or "N/A"
24
-
25
-
26
- def _format_permit_block(r: dict) -> list[str]:
27
- value = _permit_value(r)
28
- value_line = f"Value: ${value:,.0f}" if value is not None else "Value: N/A"
29
- return [
30
- "",
31
- "---",
32
- f"Permit: {_permit_id(r)}",
33
- f"Type: {r.get('permit_type', 'N/A')}",
34
- f"Status: {r.get('status', 'N/A')}",
35
- f"Address: {r.get('address', 'N/A')}",
36
- f"Applicant: {r.get('applicant', 'N/A')}",
37
- value_line,
38
- f"Issued: {_permit_issued(r)}",
39
- ]
40
-
41
-
42
9
  def register_building_tools(mcp: FastMCP, client: CleverTechClient, config: dict, rate_limiter: LocalRateLimiter):
43
10
  """Register building permit tools."""
44
11
 
@@ -83,7 +50,17 @@ def register_building_tools(mcp: FastMCP, client: CleverTechClient, config: dict
83
50
  lines.append(f"\n{message}")
84
51
 
85
52
  for r in results:
86
- lines.extend(_format_permit_block(r))
53
+ lines.extend([
54
+ "",
55
+ "---",
56
+ f"Permit: {r.get('permit_number', 'N/A')}",
57
+ f"Type: {r.get('permit_type', 'N/A')}",
58
+ f"Status: {r.get('status', 'N/A')}",
59
+ f"Address: {r.get('address', 'N/A')}",
60
+ f"Applicant: {r.get('applicant', 'N/A')}",
61
+ f"Value: ${r.get('job_value', 0):,.0f}" if r.get('job_value') is not None else "Value: N/A",
62
+ f"Issued: {r.get('issued_date', 'N/A')}",
63
+ ])
87
64
 
88
65
  return "\n".join(lines)
89
66
 
@@ -123,6 +100,15 @@ def register_building_tools(mcp: FastMCP, client: CleverTechClient, config: dict
123
100
  lines.append(f"\n{message}")
124
101
 
125
102
  for r in results:
126
- lines.extend(_format_permit_block(r))
103
+ lines.extend([
104
+ "",
105
+ "---",
106
+ f"Permit: {r.get('permit_number', 'N/A')}",
107
+ f"Type: {r.get('permit_type', 'N/A')}",
108
+ f"Status: {r.get('status', 'N/A')}",
109
+ f"Address: {r.get('address', 'N/A')}",
110
+ f"Value: ${r.get('job_value', 0):,.0f}" if r.get('job_value') is not None else "Value: N/A",
111
+ f"Issued: {r.get('issued_date', 'N/A')}",
112
+ ])
127
113
 
128
114
  return "\n".join(lines)
@@ -37,7 +37,6 @@ def register_business_tools(mcp: FastMCP, client: CleverTechClient, config: dict
37
37
  source_ip = _extract_client_ip(ctx)
38
38
  rate_limiter.check_or_raise(source_ip)
39
39
 
40
- # Use advanced endpoint for full parameter support
41
40
  params = {"q": q, "limit": min(limit, 100)}
42
41
  if province:
43
42
  params["province"] = province
@@ -57,26 +56,14 @@ def register_business_tools(mcp: FastMCP, client: CleverTechClient, config: dict
57
56
  lines.append(f"\n{message}")
58
57
 
59
58
  for r in results:
60
- # Upstream API field names: name, corporation_id, status_en,
61
- # province_en, city, incorporation_date, act_en, corporation_type_en
62
59
  lines.extend([
63
60
  "",
64
61
  "---",
65
- f"Name: {r.get('name', r.get('corporation_name', 'N/A'))}",
66
- f"Number: {r.get('corporation_id', r.get('corporation_number', r.get('number', 'N/A')))}",
67
- f"Status: {r.get('status_en', r.get('status', 'N/A'))}",
68
- f"Province: {r.get('province_en', r.get('province', 'N/A'))}",
62
+ f"Name: {r.get('corporation_name', r.get('name', 'N/A'))}",
63
+ f"Number: {r.get('corporation_number', r.get('number', 'N/A'))}",
64
+ f"Status: {r.get('status', 'N/A')}",
65
+ f"Jurisdiction: {r.get('jurisdiction', r.get('province', 'N/A'))}",
69
66
  ])
70
- if r.get('city'):
71
- lines.append(f"City: {r['city']}")
72
- if r.get('incorporation_date'):
73
- lines.append(f"Incorporated: {r['incorporation_date']}")
74
- if r.get('act_en'):
75
- lines.append(f"Act: {r['act_en']}")
76
- if r.get('corporation_type_en'):
77
- lines.append(f"Type: {r['corporation_type_en']}")
78
- if r.get('latest_filing_year'):
79
- lines.append(f"Latest Filing: {r['latest_filing_year']}")
80
67
  if r.get('registered_address'):
81
68
  lines.append(f"Address: {r['registered_address']}")
82
69