fix: 修正 .mcp.json 为本项目 MCP 配置 + 补充多源展示测试

- .mcp.json 原为 Mac 上另一项目(serena)残留配置,按文档 8.2 重写为 a-share-research
- 补充 test_fmt_results_multi_source_tag(验证 [多源] 展示)
- MCP 服务核心(5 工具/stdio/SSE/依赖/测试)此前已实现并经端到端验证
This commit is contained in:
2026-09-01 17:35:08 +08:00
parent 7b33182f67
commit 4fa48ff030
3 changed files with 43 additions and 11 deletions
+11 -1
View File
@@ -41,9 +41,11 @@ def _hit(title: str = "测试标题", source: str = "cls", score: float = 0.9,
sentiment: str = "positive", stock_codes: list[str] | None = None,
company_names: list[str] | None = None, summary: str = "摘要",
publish_time: str = "2026-06-16T10:00:00",
url: str = "https://example.com/1") -> dict:
url: str = "https://example.com/1",
sources: list[str] | None = None) -> dict:
return {
"title": title, "url": url, "source": source, "score": score,
"sources": sources or [source],
"publish_time": publish_time,
"event": {
"sentiment": sentiment, "importance": 4, "event_type": "重大合同",
@@ -61,6 +63,14 @@ def test_fmt_results_contains_title_and_source() -> None:
assert "0.9" in out
def test_fmt_results_multi_source_tag() -> None:
"""多源新闻显示「来源A / 来源B [多源]」。"""
hits = [_hit("多源新闻", sources=["cls", "sina"])]
out = _fmt_results(hits, "查询")
assert "cls / sina" in out
assert "[多源]" in out
def test_fmt_results_includes_event_fields() -> None:
hits = [_hit(
company_names=["宁德时代"], stock_codes=["300750"],