cited-cli 0.5.0__tar.gz → 0.5.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.
Files changed (128) hide show
  1. {cited_cli-0.5.0 → cited_cli-0.5.2}/PKG-INFO +5 -5
  2. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/pyproject.toml +1 -1
  3. cited_cli-0.5.2/packages/core/src/cited_core/__init__.py +1 -0
  4. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/api/client.py +10 -2
  5. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/api/endpoints.py +4 -0
  6. cited_cli-0.5.2/packages/core/src/cited_core/free_audit.py +39 -0
  7. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/README.md +5 -4
  8. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/SKILL.md +4 -3
  9. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/pyproject.toml +3 -3
  10. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/plan_gating.py +1 -0
  11. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/remote.py +56 -2
  12. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tool_changelog.yaml +28 -0
  13. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/_helpers.py +103 -10
  14. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/audit.py +37 -0
  15. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/tests/test_auth_provider.py +41 -32
  16. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/tests/test_plan_gating.py +74 -1
  17. cited_cli-0.5.2/packages/mcp/tests/test_surface_invariants.py +333 -0
  18. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/tests/test_tools.py +645 -22
  19. {cited_cli-0.5.0 → cited_cli-0.5.2}/pyproject.toml +4 -4
  20. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/audit.py +93 -1
  21. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/conftest.py +3 -1
  22. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_api_client.py +0 -2
  23. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_auth.py +31 -18
  24. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_config.py +0 -2
  25. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_feature_parity.py +26 -26
  26. cited_cli-0.5.2/tests/test_free_audit.py +173 -0
  27. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_live_pipeline.py +7 -9
  28. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_mcp_server.py +1 -0
  29. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_mcp_tools.py +39 -20
  30. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_output.py +1 -3
  31. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_pipeline.py +1138 -248
  32. cited_cli-0.5.0/packages/core/src/cited_core/__init__.py +0 -1
  33. {cited_cli-0.5.0 → cited_cli-0.5.2}/.github/workflows/changelog-guard.yml +0 -0
  34. {cited_cli-0.5.0 → cited_cli-0.5.2}/.github/workflows/ci.yml +0 -0
  35. {cited_cli-0.5.0 → cited_cli-0.5.2}/.github/workflows/release.yml +0 -0
  36. {cited_cli-0.5.0 → cited_cli-0.5.2}/.gitignore +0 -0
  37. {cited_cli-0.5.0 → cited_cli-0.5.2}/CLAUDE.md +0 -0
  38. {cited_cli-0.5.0 → cited_cli-0.5.2}/DEMO.md +0 -0
  39. {cited_cli-0.5.0 → cited_cli-0.5.2}/FUTURE.md +0 -0
  40. {cited_cli-0.5.0 → cited_cli-0.5.2}/LICENSE +0 -0
  41. {cited_cli-0.5.0 → cited_cli-0.5.2}/README.md +0 -0
  42. {cited_cli-0.5.0 → cited_cli-0.5.2}/TEST_RUNBOOK.md +0 -0
  43. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/.claude-plugin/marketplace.json +0 -0
  44. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/.claude-plugin/plugin.json +0 -0
  45. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/.mcp.json +0 -0
  46. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/CLAUDE_DESKTOP_SETUP.md +0 -0
  47. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/agents/geo-analyst.md +0 -0
  48. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/commands/audit.md +0 -0
  49. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/commands/recommend.md +0 -0
  50. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/commands/status.md +0 -0
  51. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/settings.json +0 -0
  52. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/skills/business-setup/SKILL.md +0 -0
  53. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/skills/explore/SKILL.md +0 -0
  54. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/skills/geo-audit/SKILL.md +0 -0
  55. {cited_cli-0.5.0 → cited_cli-0.5.2}/cited-plugins/skills/geo-recommend/SKILL.md +0 -0
  56. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/api/__init__.py +0 -0
  57. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/auth/__init__.py +0 -0
  58. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/auth/oauth_server.py +0 -0
  59. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/auth/store.py +0 -0
  60. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/config/__init__.py +0 -0
  61. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/config/constants.py +0 -0
  62. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/config/manager.py +0 -0
  63. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/core/src/cited_core/errors.py +0 -0
  64. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/__init__.py +0 -0
  65. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/__main__.py +0 -0
  66. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/auth_provider.py +0 -0
  67. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/context.py +0 -0
  68. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/server.py +0 -0
  69. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tool_manager.py +0 -0
  70. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/__init__.py +0 -0
  71. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/action_plan.py +0 -0
  72. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/agent.py +0 -0
  73. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/analytics.py +0 -0
  74. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/auth.py +0 -0
  75. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/billing.py +0 -0
  76. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/business.py +0 -0
  77. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/changelog.py +0 -0
  78. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/hq.py +0 -0
  79. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/job.py +0 -0
  80. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/recommend.py +0 -0
  81. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/src/cited_mcp/tools/solution.py +0 -0
  82. {cited_cli-0.5.0 → cited_cli-0.5.2}/packages/mcp/tests/conftest.py +0 -0
  83. {cited_cli-0.5.0 → cited_cli-0.5.2}/scripts/dev-install.sh +0 -0
  84. {cited_cli-0.5.0 → cited_cli-0.5.2}/scripts/mcp_test_harness.py +0 -0
  85. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/__init__.py +0 -0
  86. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/__main__.py +0 -0
  87. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/api/__init__.py +0 -0
  88. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/api/client.py +0 -0
  89. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/api/endpoints.py +0 -0
  90. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/app.py +0 -0
  91. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/auth/__init__.py +0 -0
  92. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/auth/oauth_server.py +0 -0
  93. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/auth/store.py +0 -0
  94. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/__init__.py +0 -0
  95. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/agent.py +0 -0
  96. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/analytics.py +0 -0
  97. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/auth.py +0 -0
  98. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/business.py +0 -0
  99. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/config_cmd.py +0 -0
  100. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/hq.py +0 -0
  101. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/job.py +0 -0
  102. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/mcp_cmd.py +0 -0
  103. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/named_audit.py +0 -0
  104. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/recommend.py +0 -0
  105. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/commands/solution.py +0 -0
  106. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/config/__init__.py +0 -0
  107. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/config/constants.py +0 -0
  108. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/config/manager.py +0 -0
  109. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/__init__.py +0 -0
  110. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/context.py +0 -0
  111. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/server.py +0 -0
  112. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/__init__.py +0 -0
  113. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/_helpers.py +0 -0
  114. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/audit.py +0 -0
  115. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/auth.py +0 -0
  116. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/business.py +0 -0
  117. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/job.py +0 -0
  118. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/recommend.py +0 -0
  119. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/mcp/tools/solution.py +0 -0
  120. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/output/__init__.py +0 -0
  121. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/output/formatter.py +0 -0
  122. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/output/progress.py +0 -0
  123. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/output/tables.py +0 -0
  124. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/utils/__init__.py +0 -0
  125. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/utils/errors.py +0 -0
  126. {cited_cli-0.5.0 → cited_cli-0.5.2}/src/cited_cli/utils/interactive.py +0 -0
  127. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/__init__.py +0 -0
  128. {cited_cli-0.5.0 → cited_cli-0.5.2}/tests/test_version.py +0 -0
@@ -1,23 +1,23 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: cited-cli
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: CLI for the Cited GEO platform
5
5
  Author-email: Cited <support@youcited.com>
6
6
  License-Expression: LicenseRef-Proprietary
7
7
  License-File: LICENSE
8
8
  Requires-Python: >=3.11
9
- Requires-Dist: cited-core>=0.5.0
9
+ Requires-Dist: cited-core>=0.5.2
10
10
  Requires-Dist: rich>=13.0.0
11
11
  Requires-Dist: typer>=0.15.0
12
12
  Provides-Extra: dev
13
- Requires-Dist: cited-mcp>=0.5.0; extra == 'dev'
13
+ Requires-Dist: cited-mcp>=0.5.2; extra == 'dev'
14
14
  Requires-Dist: mypy>=1.10; extra == 'dev'
15
15
  Requires-Dist: pytest>=8.0; extra == 'dev'
16
16
  Requires-Dist: respx>=0.21; extra == 'dev'
17
17
  Requires-Dist: ruff>=0.4; extra == 'dev'
18
18
  Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
19
19
  Provides-Extra: mcp
20
- Requires-Dist: cited-mcp>=0.5.0; extra == 'mcp'
20
+ Requires-Dist: cited-mcp>=0.5.2; extra == 'mcp'
21
21
  Description-Content-Type: text/markdown
22
22
 
23
23
  # Cited CLI
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cited-core"
7
- version = "0.5.0"
7
+ version = "0.5.2"
8
8
  description = "Core library for the Cited GEO platform"
9
9
  license = "LicenseRef-Proprietary"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1 @@
1
+ __version__ = "0.5.2"
@@ -72,8 +72,16 @@ class CitedClient:
72
72
  message = response.text or message
73
73
  raise CitedAPIError(response.status_code, str(message), error_code)
74
74
 
75
- def get(self, path: str, params: dict[str, Any] | None = None) -> Any:
76
- response = self._client.get(path, params=params)
75
+ def get(
76
+ self,
77
+ path: str,
78
+ params: dict[str, Any] | None = None,
79
+ timeout: float | None = None,
80
+ ) -> Any:
81
+ kwargs: dict[str, Any] = {"params": params}
82
+ if timeout is not None:
83
+ kwargs["timeout"] = timeout
84
+ response = self._client.get(path, **kwargs)
77
85
  return self._handle_response(response)
78
86
 
79
87
  def post(
@@ -43,6 +43,10 @@ AUDIT_EXPORT_PDF = "/audit/{job_id}/export/pdf"
43
43
  AUDIT_EXPORT_URL = "/audit/{job_id}/export/url"
44
44
  AUDIT_HISTORY = "/audit/history"
45
45
  AUDIT_CANCEL = "/audit/{job_id}/cancel"
46
+
47
+ # Free audit (no login; same audit the youcited.com homepage prompt runs)
48
+ FREE_AUDIT = "/free-audit"
49
+ FREE_AUDIT_REPORT = "/free-audit/report/{token}"
46
50
  AUDIT_DELETE = "/audit/{job_id}"
47
51
  AUDIT_PROVIDERS = "/audit/{job_id}/providers"
48
52
  AUDIT_QUESTION_DETAIL = "/audit/{job_id}/question/{question_id}"
@@ -0,0 +1,39 @@
1
+ """Free audit: the no-login GEO audit behind the youcited.com homepage prompt.
2
+
3
+ ``GET /free-audit?url=...`` starts an audit (or returns the one already run for
4
+ that domain in the last 24 hours) and hands back a ``report_url``. Fetching the
5
+ report returns status while the audit runs and the full report once it is done.
6
+ Neither call needs a token, so these work before the user has an account.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from typing import Any
12
+
13
+ from cited_core.api import endpoints
14
+ from cited_core.api.client import LONG_TIMEOUT, CitedClient
15
+
16
+
17
+ def report_token(report_url: str) -> str:
18
+ """Extract the report token from a ``report_url`` returned by the API."""
19
+ return report_url.rstrip("/").rsplit("/", 1)[-1]
20
+
21
+
22
+ def check_free_audit(client: CitedClient, url: str) -> dict[str, Any]:
23
+ """Start (or resume) the free audit for ``url`` and return its current report.
24
+
25
+ Safe to call repeatedly: the API reuses the same audit for a domain, so
26
+ calling again later returns progress or, once complete, the full report.
27
+ """
28
+ # Starting a new audit generates its questions in-request, which can be slow.
29
+ started = client.get(endpoints.FREE_AUDIT, params={"url": url}, timeout=LONG_TIMEOUT)
30
+ token = report_token(started["report_url"])
31
+ report: dict[str, Any] = client.get(endpoints.FREE_AUDIT_REPORT.format(token=token))
32
+ report.setdefault("report_url", started["report_url"])
33
+ report.setdefault("share_url", started.get("share_url"))
34
+ report.setdefault("domain", started.get("domain"))
35
+ return report
36
+
37
+
38
+ def is_finished(report: dict[str, Any]) -> bool:
39
+ return report.get("status") not in ("pending", "processing")
@@ -1,6 +1,6 @@
1
1
  # cited-mcp
2
2
 
3
- MCP server for the [Cited](https://youcited.com) Generative Engine Optimization (GEO) platform. Exposes 56 tools that let AI assistants like Claude manage businesses, run GEO audits, generate recommendations, work a prioritized action plan, verify fixes via the Validation Engine, and create solutions — all through the [Model Context Protocol](https://modelcontextprotocol.io/).
3
+ MCP server for the [Cited](https://youcited.com) Generative Engine Optimization (GEO) platform. Exposes 74 tools that let AI assistants like Claude manage businesses, run GEO audits, generate recommendations, work a prioritized action plan, verify fixes via the Validation Engine, and create solutions — all through the [Model Context Protocol](https://modelcontextprotocol.io/).
4
4
 
5
5
  ## Install
6
6
 
@@ -146,6 +146,7 @@ Cited adds new tools regularly. To access new tools after a release, **disconnec
146
146
  ### Audits
147
147
  | Tool | Description |
148
148
  |------|-------------|
149
+ | `free_audit` | Free GEO audit of any website, no login needed. Call again with the same URL for progress and the full report |
149
150
  | `start_audit` | Run a GEO audit using a template |
150
151
  | `get_audit_status` | Check audit job status |
151
152
  | `get_audit_result` | Get completed audit results |
@@ -231,9 +232,9 @@ Tools are gated by subscription tier. All tiers can read data; write operations
231
232
 
232
233
  | Tier | Tools Available |
233
234
  |------|----------------|
234
- | **Growth** (entry) | Auth, list/get businesses, crawl, health scores, audits (start/status/result/list), all recommendation tools, action-plan reads (get_action_plan, get_quick_wins), Validation Engine reads, job status — **22 tools** |
235
- | **Scale** | Everything in Growth + create/update/delete businesses, create/update/delete audit templates, all solution tools, batch solutions, export audit, cancel job, action-plan writes (mark_action_done, dismiss_action, get_action_progress) — **38 tools** |
236
- | **Pro** | Everything in Scale + usage stats, HQ dashboard, analytics, agent API — **56 tools** |
235
+ | **Growth** (entry) | Auth, list/get businesses, crawl, health scores, audits (start/status/result/list), all recommendation tools, action-plan reads (get_action_plan, get_quick_wins), Validation Engine reads, job status, free audit — **32 tools** |
236
+ | **Scale** | Everything in Growth + create/update/delete businesses, create/update/delete audit templates, all solution tools, batch solutions, export audit, cancel job, action-plan writes (mark_action_done, dismiss_action, get_action_progress) — **63 tools** |
237
+ | **Pro** | Everything in Scale + usage stats, HQ dashboard, analytics, agent API — **74 tools** |
237
238
 
238
239
  When a user calls a tool above their plan, the server returns a structured error with an upgrade link:
239
240
 
@@ -19,6 +19,7 @@ The typical flow is: **Business Setup → Audit → Recommendations → Solution
19
19
 
20
20
  ### 2. Run an Audit
21
21
  - `create_audit_template` — Define what questions to audit (e.g., "What is [business]?", "Best [industry] tools")
22
+ - `free_audit` — Free GEO audit of any website, no login or plan needed. Use it when the user has no Cited account yet. Call again with the same `url` every ~30 seconds until `status` is `completed` (2-4 minutes).
22
23
  - `start_audit` — Launch the audit using a template (2-4 minutes). Poll `get_audit_status` every 30-60 seconds.
23
24
  - `get_audit_result` — Returns a summary by default (aggregate KPIs, competitor leaderboard, question IDs). Use `full=True` for detailed per-question citations — warning: full results can be very large.
24
25
 
@@ -50,9 +51,9 @@ The typical flow is: **Business Setup → Audit → Recommendations → Solution
50
51
 
51
52
  Tools are gated by subscription tier. If a tool is above the user's plan, it returns an upgrade message with a billing link.
52
53
 
53
- - **Growth** (entry tier): Read-only — list/get businesses, run audits, view recommendations (19 tools)
54
- - **Scale**: Full write access — create/update/delete, solutions, export, cancel (32 tools)
55
- - **Pro**: Everything + HQ dashboard, analytics, agent API (42 tools)
54
+ - **Growth** (entry tier): Read-only — list/get businesses, run audits, view recommendations (32 tools)
55
+ - **Scale**: Full write access — create/update/delete, solutions, export, cancel (63 tools)
56
+ - **Pro**: Everything + HQ dashboard, analytics, agent API (74 tools)
56
57
 
57
58
  Always call `check_auth_status` first — it shows the user's plan and remaining limits.
58
59
 
@@ -4,15 +4,15 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cited-mcp"
7
- version = "0.5.0"
7
+ version = "0.5.2"
8
8
  description = "MCP server for the Cited GEO platform"
9
9
  readme = "README.md"
10
10
  license = "LicenseRef-Proprietary"
11
11
  requires-python = ">=3.11"
12
12
  authors = [{ name = "Cited", email = "support@youcited.com" }]
13
13
  dependencies = [
14
- "cited-core>=0.5.0",
15
- "mcp>=1.27.0",
14
+ "cited-core>=0.5.2",
15
+ "mcp>=1.27.0,<2",
16
16
  "PyJWT>=2.8.0",
17
17
  "PyYAML>=6.0",
18
18
  ]
@@ -165,6 +165,7 @@ _BASE_TOOLS: set[str] = {
165
165
  "get_pricing",
166
166
  "upgrade_plan",
167
167
  "whats_new",
168
+ "free_audit",
168
169
  "list_businesses",
169
170
  "get_business",
170
171
  "crawl_business",
@@ -204,6 +204,56 @@ class _OAuthEventLogMiddleware:
204
204
  logger.info("[oauth-event] %s", kv)
205
205
 
206
206
 
207
+ class _RequestContextMiddleware:
208
+ """ASGI middleware that captures the request's source IP and User-Agent
209
+ into contextvars consumed by the tool-call decorator.
210
+
211
+ Why: ``tool_call`` log lines previously carried no source-identifying
212
+ metadata beyond the (possibly absent) decoded user JWT. When a probe
213
+ came in with a non-standard token — logged as user=``unknown`` — there
214
+ was no way to trace the source. Threading an HTTP request object
215
+ through every tool function is invasive; contextvars stay scoped to
216
+ the request's async task without touching tool signatures.
217
+
218
+ For stdio transport this middleware is not in the chain, so the
219
+ contextvars stay None and the log fields render as null.
220
+
221
+ We prefer the leftmost value of ``X-Forwarded-For`` when present
222
+ because the ALB inserts the original client IP there and the immediate
223
+ ``scope["client"]`` is the ALB's internal address. Trusting X-F-F is
224
+ only safe behind a known proxy — which is the deploy topology here.
225
+ """
226
+
227
+ def __init__(self, app: ASGIApp) -> None:
228
+ self.app = app
229
+
230
+ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
231
+ if scope["type"] != "http":
232
+ await self.app(scope, receive, send)
233
+ return
234
+
235
+ from cited_mcp.tools._helpers import _request_ip, _request_ua
236
+
237
+ headers = {k: v for k, v in scope.get("headers", [])}
238
+ xff = headers.get(b"x-forwarded-for", b"").decode("latin-1", errors="replace")
239
+ if xff:
240
+ ip: str | None = xff.split(",")[0].strip() or None
241
+ else:
242
+ client = scope.get("client") or ("?", 0)
243
+ ip = client[0] if client and client[0] != "?" else None
244
+
245
+ ua_bytes = headers.get(b"user-agent", b"")
246
+ ua = ua_bytes.decode("latin-1", errors="replace")[:120] if ua_bytes else None
247
+
248
+ token_ip = _request_ip.set(ip)
249
+ token_ua = _request_ua.set(ua)
250
+ try:
251
+ await self.app(scope, receive, send)
252
+ finally:
253
+ _request_ip.reset(token_ip)
254
+ _request_ua.reset(token_ua)
255
+
256
+
207
257
  @asynccontextmanager
208
258
  async def cited_remote_lifespan(server: FastMCP) -> AsyncIterator[CitedContext]:
209
259
  """Lifespan for the remote MCP server.
@@ -403,9 +453,13 @@ def run_remote_server() -> None:
403
453
  starlette_app = server.streamable_http_app()
404
454
  # Order: oauth-event log on the OUTSIDE of the registration patcher so
405
455
  # patcher-rejected /register calls (400 invalid_redirect_uri) still
406
- # produce an event line.
456
+ # produce an event line. RequestContextMiddleware sits innermost so
457
+ # its contextvars (ip, user_agent) are set in the same task that
458
+ # dispatches the tool call.
407
459
  patched_app = _OAuthEventLogMiddleware(
408
- _PatchRegistrationMiddleware(starlette_app)
460
+ _PatchRegistrationMiddleware(
461
+ _RequestContextMiddleware(starlette_app)
462
+ )
409
463
  )
410
464
 
411
465
  config = uvicorn.Config(
@@ -21,6 +21,34 @@
21
21
  # this file.
22
22
 
23
23
  versions:
24
+ - version: "0.5.2"
25
+ released: "2026-10-14"
26
+ # Adds free_audit: the no-login GEO audit behind the youcited.com homepage
27
+ # prompt, so agents can audit a site before the user has an account.
28
+ fingerprint: "8e42f3842abe"
29
+ tools_added:
30
+ - name: free_audit
31
+ description: |
32
+ Free GEO visibility audit of any website, no login or plan needed.
33
+ The first call starts it; call again with the same url for progress
34
+ and the full report (questions, whether the site was cited, which
35
+ domains AI cited instead). Requires the cited backend with
36
+ GET /free-audit (YouCited/cited#132).
37
+ tools_changed: []
38
+ tools_removed: []
39
+
40
+ - version: "0.5.1"
41
+ released: "2026-05-18"
42
+ # Telemetry-only release: tool surface is unchanged (fingerprint matches
43
+ # 0.5.0). Adds forensic fields to every tool_call log line — ip,
44
+ # user_agent, and a new auth_kind discriminator (anonymous / agent_key /
45
+ # oauth_email / oauth_no_email / oauth_malformed / stdio_email /
46
+ # stdio_no_email / stdio_malformed). Also fixes client_id extraction
47
+ # which was reading from user_jwt claims (always null in prod) instead
48
+ # of the OAuth access token. Motivated by a 2026-05-02 dev probe that
49
+ # logged user=unknown with no traceable source.
50
+ fingerprint: "5bef45100c53"
51
+
24
52
  - version: "0.5.0"
25
53
  released: "2026-05-11"
26
54
  # Three new read-only list_* tools to enable persona/product/buyer-intent
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import contextlib
4
+ import contextvars
4
5
  import functools
5
6
  import hashlib
6
7
  import json
@@ -22,6 +23,20 @@ from cited_mcp.context import CitedContext
22
23
 
23
24
  logger = logging.getLogger("cited_mcp.usage")
24
25
 
26
+ # ---------------------------------------------------------------------------
27
+ # Per-request forensic context (set by remote.py _RequestContextMiddleware).
28
+ #
29
+ # These let tool_call log lines carry the request's source IP and User-Agent
30
+ # without threading an HTTP request object through every tool function. For
31
+ # stdio transport (no HTTP) they remain None and are emitted as null in logs.
32
+ # ---------------------------------------------------------------------------
33
+ _request_ip: contextvars.ContextVar[str | None] = contextvars.ContextVar(
34
+ "cited_mcp_request_ip", default=None
35
+ )
36
+ _request_ua: contextvars.ContextVar[str | None] = contextvars.ContextVar(
37
+ "cited_mcp_request_ua", default=None
38
+ )
39
+
25
40
  # ---------------------------------------------------------------------------
26
41
  # Response size guardrails
27
42
  # ---------------------------------------------------------------------------
@@ -244,18 +259,84 @@ def _extract_user(token: str | None) -> str:
244
259
  return "unknown"
245
260
 
246
261
 
247
- def _extract_client_id(token: str | None) -> str | None:
248
- """Decode OAuth client_id from a JWT (for connector-mix analytics)."""
249
- if not token:
262
+ def _extract_client_id_from_oauth() -> str | None:
263
+ """Return the OAuth client_id from the current access token, truncated.
264
+
265
+ The MCP server's client_id is itself a signed JWT (RFC 7591 dynamic
266
+ registration encoded into the id), so we truncate to a 12-char prefix
267
+ sufficient to group connector traffic without bloating log lines.
268
+
269
+ Returns None for stdio transport (no OAuth context), or whenever the
270
+ access-token contextvar is unset.
271
+
272
+ Note: this used to decode the user_jwt looking for client_id/aud/azp
273
+ claims, but backend session JWTs do not carry OAuth-client identity —
274
+ so the field was always empty in production logs. This implementation
275
+ reads from the OAuth access token instead.
276
+ """
277
+ try:
278
+ from mcp.server.auth.middleware.auth_context import get_access_token
279
+ except ImportError:
250
280
  return None
251
281
  try:
252
- payload = pyjwt.decode(token, options={"verify_signature": False})
253
- cid = payload.get("client_id") or payload.get("aud") or payload.get("azp")
254
- if isinstance(cid, list):
255
- cid = cid[0] if cid else None
256
- return str(cid) if cid else None
282
+ access_token = get_access_token()
257
283
  except Exception:
258
284
  return None
285
+ if not access_token:
286
+ return None
287
+ cid = getattr(access_token, "client_id", None)
288
+ if not cid:
289
+ return None
290
+ return str(cid)[:12]
291
+
292
+
293
+ def _extract_auth_kind(
294
+ ctx: Context[Any, CitedContext, Any], token: str | None
295
+ ) -> str:
296
+ """Categorize the auth path for forensic logging.
297
+
298
+ Returns one of:
299
+ - ``anonymous`` — no token, no agent key
300
+ - ``agent_key`` — CitedClient has agent_api_key set (stdio mode)
301
+ - ``oauth_email`` — OAuth flow, user_jwt has email claim
302
+ - ``oauth_no_email`` — OAuth flow, user_jwt decoded but no email
303
+ - ``oauth_malformed`` — OAuth flow, user_jwt couldn't be decoded
304
+ - ``stdio_email`` — stdio mode, token is a JWT with email claim
305
+ - ``stdio_no_email`` — stdio mode, token decoded but no email
306
+ - ``stdio_malformed`` — stdio mode, token isn't a parseable JWT
307
+
308
+ Lets us tell apart the practical cases — including the case where
309
+ ``_extract_user`` returns ``"unknown"`` because the token was not a
310
+ JWT at all versus because the JWT had no email/sub claim. Without
311
+ this, the ``<unknown>`` bucket in usage reports is unactionable.
312
+ """
313
+ try:
314
+ lc = ctx.request_context.lifespan_context
315
+ if getattr(lc.client, "agent_api_key", None):
316
+ return "agent_key"
317
+ except Exception:
318
+ pass
319
+
320
+ method = "stdio"
321
+ try:
322
+ from mcp.server.auth.middleware.auth_context import get_access_token
323
+
324
+ if get_access_token() is not None:
325
+ method = "oauth"
326
+ except Exception:
327
+ pass
328
+
329
+ if not token:
330
+ return "anonymous" if method == "stdio" else "oauth_no_token"
331
+
332
+ try:
333
+ payload = pyjwt.decode(token, options={"verify_signature": False})
334
+ except Exception:
335
+ return f"{method}_malformed"
336
+
337
+ if payload.get("email"):
338
+ return f"{method}_email"
339
+ return f"{method}_no_email"
259
340
 
260
341
 
261
342
  # ---------------------------------------------------------------------------
@@ -384,7 +465,8 @@ def log_tool_call(
384
465
  token = _resolve_token(ctx)
385
466
  rl_key = _rate_limit_key(token)
386
467
  user = _extract_user(token)
387
- client_id = _extract_client_id(token)
468
+ auth_kind = _extract_auth_kind(ctx, token)
469
+ client_id = _extract_client_id_from_oauth()
388
470
  request_id = uuid.uuid4().hex[:12]
389
471
  start = time.monotonic()
390
472
  build = _get_build_identity()
@@ -399,7 +481,10 @@ def log_tool_call(
399
481
  "request_id": request_id,
400
482
  "tool": tool_name,
401
483
  "user": user,
484
+ "auth_kind": auth_kind,
402
485
  "client_id": client_id,
486
+ "ip": _request_ip.get(),
487
+ "user_agent": _request_ua.get(),
403
488
  "server_version": build["server_version"],
404
489
  "tools_fingerprint": build["tools_fingerprint"],
405
490
  "deployment_id": build["deployment_id"],
@@ -407,7 +492,15 @@ def log_tool_call(
407
492
  if resources:
408
493
  payload["resources"] = resources
409
494
  payload.update(extra)
410
- logger.info(json.dumps(payload, default=str))
495
+ # CodeQL flags this as clear-text logging of sensitive data because
496
+ # `user` is sourced from a JWT email claim. This is by design —
497
+ # operator usage reports (scripts/mcp_usage_report.py) attribute
498
+ # tool calls to users by email, which is necessary for forensics
499
+ # and abuse investigation. Logs flow to a private CloudWatch group
500
+ # with restricted IAM access. Email is not transmitted anywhere
501
+ # else from this line. If we later move to hashed identifiers,
502
+ # the suppression can be removed.
503
+ logger.info(json.dumps(payload, default=str)) # noqa: E501 lgtm[py/clear-text-logging-sensitive-data]
411
504
 
412
505
  # Rate limit check
413
506
  if rl_err := _check_rate_limit(rl_key):
@@ -1,12 +1,15 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import os
3
4
  from typing import Any
4
5
 
5
6
  from mcp.server.fastmcp import Context
6
7
  from mcp.types import ToolAnnotations
7
8
 
8
9
  from cited_core.api import endpoints
10
+ from cited_core.api.client import CitedClient
9
11
  from cited_core.errors import CitedAPIError
12
+ from cited_core.free_audit import check_free_audit, is_finished
10
13
  from cited_mcp.context import CitedContext
11
14
  from cited_mcp.server import mcp
12
15
  from cited_mcp.tools._helpers import (
@@ -366,3 +369,37 @@ async def list_audits(
366
369
  return cited_ctx.client.get(endpoints.AUDIT_HISTORY, params=params)
367
370
  except CitedAPIError as e:
368
371
  return _api_error_response(e)
372
+
373
+
374
+ @mcp.tool(
375
+ title="Free Audit",
376
+ annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=False, idempotentHint=True, openWorldHint=True), # noqa: E501
377
+ )
378
+ @log_tool_call
379
+ async def free_audit(ctx: Context[Any, CitedContext, Any], url: str) -> Any:
380
+ """Run a free GEO visibility audit for any website. No login or plan needed.
381
+
382
+ Checks how often AI assistants cite the site for a handful of buyer
383
+ questions and which sites they cite instead. The first call starts the
384
+ audit (2-4 minutes); call again with the same url to get progress, and the
385
+ full report once status is "completed". Re-running a domain within 24 hours
386
+ returns the same audit.
387
+
388
+ Args:
389
+ ctx: MCP context
390
+ url: Website to audit, e.g. "example.com"
391
+ """
392
+ cited_ctx = _get_ctx(ctx)
393
+ # Anonymous client: no user cookie. The hosted server's agent key (when set)
394
+ # exempts it from the backend's per-IP limit, which all its users share.
395
+ agent_key = os.environ.get("CITED_AGENT_API_KEY") or cited_ctx.client.agent_api_key
396
+ client = CitedClient(base_url=cited_ctx.api_url, agent_api_key=agent_key)
397
+ try:
398
+ report = check_free_audit(client, url)
399
+ except CitedAPIError as e:
400
+ return _api_error_response(e)
401
+ finally:
402
+ client.close()
403
+ if not is_finished(report):
404
+ report["hint"] = "Audit still running. Call free_audit again with the same url in ~30s."
405
+ return _truncate_response(report)
@@ -1,4 +1,5 @@
1
1
  """Tests for the CitedOAuthProvider — specifically JWT expiry handling."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  import asyncio
@@ -59,14 +60,16 @@ class TestLoadAccessToken:
59
60
  def test_rejects_expired_user_jwt(self):
60
61
  provider = _make_provider()
61
62
  now = int(time.time())
62
- token = provider._encode_token({
63
- "typ": "access",
64
- "sub": "client-123",
65
- "scopes": ["cited"],
66
- "user_jwt": _make_jwt(-60), # expired backend JWT
67
- "exp": now + 3600,
68
- "iat": now,
69
- })
63
+ token = provider._encode_token(
64
+ {
65
+ "typ": "access",
66
+ "sub": "client-123",
67
+ "scopes": ["cited"],
68
+ "user_jwt": _make_jwt(-60), # expired backend JWT
69
+ "exp": now + 3600,
70
+ "iat": now,
71
+ }
72
+ )
70
73
 
71
74
  result = run(provider.load_access_token(token))
72
75
  assert result is None
@@ -75,14 +78,16 @@ class TestLoadAccessToken:
75
78
  provider = _make_provider()
76
79
  valid_jwt = _make_jwt(3600)
77
80
  now = int(time.time())
78
- token = provider._encode_token({
79
- "typ": "access",
80
- "sub": "client-123",
81
- "scopes": ["cited"],
82
- "user_jwt": valid_jwt,
83
- "exp": now + 3600,
84
- "iat": now,
85
- })
81
+ token = provider._encode_token(
82
+ {
83
+ "typ": "access",
84
+ "sub": "client-123",
85
+ "scopes": ["cited"],
86
+ "user_jwt": valid_jwt,
87
+ "exp": now + 3600,
88
+ "iat": now,
89
+ }
90
+ )
86
91
 
87
92
  result = run(provider.load_access_token(token))
88
93
  assert result is not None
@@ -94,14 +99,16 @@ class TestLoadRefreshToken:
94
99
  provider = _make_provider()
95
100
  client = _make_client()
96
101
  now = int(time.time())
97
- token = provider._encode_token({
98
- "typ": "refresh",
99
- "sub": client.client_id,
100
- "scopes": ["cited"],
101
- "user_jwt": _make_jwt(-60), # expired backend JWT
102
- "exp": now + 86400,
103
- "iat": now,
104
- })
102
+ token = provider._encode_token(
103
+ {
104
+ "typ": "refresh",
105
+ "sub": client.client_id,
106
+ "scopes": ["cited"],
107
+ "user_jwt": _make_jwt(-60), # expired backend JWT
108
+ "exp": now + 86400,
109
+ "iat": now,
110
+ }
111
+ )
105
112
 
106
113
  result = run(provider.load_refresh_token(client, token))
107
114
  assert result is None
@@ -111,14 +118,16 @@ class TestLoadRefreshToken:
111
118
  client = _make_client()
112
119
  valid_jwt = _make_jwt(3600)
113
120
  now = int(time.time())
114
- token = provider._encode_token({
115
- "typ": "refresh",
116
- "sub": client.client_id,
117
- "scopes": ["cited"],
118
- "user_jwt": valid_jwt,
119
- "exp": now + 86400,
120
- "iat": now,
121
- })
121
+ token = provider._encode_token(
122
+ {
123
+ "typ": "refresh",
124
+ "sub": client.client_id,
125
+ "scopes": ["cited"],
126
+ "user_jwt": valid_jwt,
127
+ "exp": now + 86400,
128
+ "iat": now,
129
+ }
130
+ )
122
131
 
123
132
  result = run(provider.load_refresh_token(client, token))
124
133
  assert result is not None