semantic-scholar-mcp 0.2.7__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.
- semantic_scholar_mcp-0.2.7/.claude/scripts/deny-check.sh +69 -0
- semantic_scholar_mcp-0.2.7/.claude/settings.json +36 -0
- semantic_scholar_mcp-0.2.7/.devcontainer/Dockerfile +122 -0
- semantic_scholar_mcp-0.2.7/.devcontainer/devcontainer.json +52 -0
- semantic_scholar_mcp-0.2.7/.devcontainer/init-firewall.sh +118 -0
- semantic_scholar_mcp-0.2.7/.env.example +28 -0
- semantic_scholar_mcp-0.2.7/.github/dependabot.yml +43 -0
- semantic_scholar_mcp-0.2.7/.github/workflows/auto-release.yml +76 -0
- semantic_scholar_mcp-0.2.7/.github/workflows/ci.yml +85 -0
- semantic_scholar_mcp-0.2.7/.github/workflows/claude-code-review.yml +78 -0
- semantic_scholar_mcp-0.2.7/.github/workflows/claude.yml +64 -0
- semantic_scholar_mcp-0.2.7/.github/workflows/release.yml +62 -0
- semantic_scholar_mcp-0.2.7/.github/workflows/test-pypi.yml +40 -0
- semantic_scholar_mcp-0.2.7/.gitignore +206 -0
- semantic_scholar_mcp-0.2.7/.mcp.json +32 -0
- semantic_scholar_mcp-0.2.7/AGENTS.md +4 -0
- semantic_scholar_mcp-0.2.7/CLAUDE.md +978 -0
- semantic_scholar_mcp-0.2.7/DASHBOARD.md +336 -0
- semantic_scholar_mcp-0.2.7/LICENSE +21 -0
- semantic_scholar_mcp-0.2.7/PKG-INFO +257 -0
- semantic_scholar_mcp-0.2.7/PROPOSE.md +1018 -0
- semantic_scholar_mcp-0.2.7/README.md +227 -0
- semantic_scholar_mcp-0.2.7/TODO.md +321 -0
- semantic_scholar_mcp-0.2.7/docs/ARCHITECTURE.md +715 -0
- semantic_scholar_mcp-0.2.7/docs/DEVELOPER_GUIDE.md +1227 -0
- semantic_scholar_mcp-0.2.7/docs/RELEASE_PROCESS.md +442 -0
- semantic_scholar_mcp-0.2.7/docs/STATUS_SERENA_MIGRATION.md +57 -0
- semantic_scholar_mcp-0.2.7/docs/USER_GUIDE.md +868 -0
- semantic_scholar_mcp-0.2.7/docs/api-specifications/semantic-scholar-datasets-v1.json +287 -0
- semantic_scholar_mcp-0.2.7/docs/api-specifications/semantic-scholar-graph-v1.json +2437 -0
- semantic_scholar_mcp-0.2.7/docs/api-specifications/semantic-scholar-recommendations-v1.json +383 -0
- semantic_scholar_mcp-0.2.7/docs/pdf_markdown_plan.md +44 -0
- semantic_scholar_mcp-0.2.7/docs/serena_migration_conversation_summary.md +45 -0
- semantic_scholar_mcp-0.2.7/docs/uml/01-overview-class-diagram.puml +325 -0
- semantic_scholar_mcp-0.2.7/docs/uml/01-overview-class-diagram.svg +562 -0
- semantic_scholar_mcp-0.2.7/docs/uml/02-overview-component-diagram.puml +110 -0
- semantic_scholar_mcp-0.2.7/docs/uml/02-overview-component-diagram.svg +1 -0
- semantic_scholar_mcp-0.2.7/docs/uml/03-overview-deployment-diagram.puml +88 -0
- semantic_scholar_mcp-0.2.7/docs/uml/03-overview-deployment-diagram.svg +1 -0
- semantic_scholar_mcp-0.2.7/docs/uml/04-flow-paper-search-sequence.puml +124 -0
- semantic_scholar_mcp-0.2.7/docs/uml/04-flow-paper-search-sequence.svg +1 -0
- semantic_scholar_mcp-0.2.7/docs/uml/05-flow-paper-retrieval-activity.puml +113 -0
- semantic_scholar_mcp-0.2.7/docs/uml/05-flow-paper-retrieval-activity.svg +1 -0
- semantic_scholar_mcp-0.2.7/docs/uml/06-pattern-circuit-breaker-state.puml +57 -0
- semantic_scholar_mcp-0.2.7/docs/uml/06-pattern-circuit-breaker-state.svg +1 -0
- semantic_scholar_mcp-0.2.7/docs/uml/README.md +145 -0
- semantic_scholar_mcp-0.2.7/pyproject.toml +181 -0
- semantic_scholar_mcp-0.2.7/scripts/add_return_statements.py +120 -0
- semantic_scholar_mcp-0.2.7/scripts/batch_fix_server.py +218 -0
- semantic_scholar_mcp-0.2.7/scripts/batch_replace_decorators.sh +52 -0
- semantic_scholar_mcp-0.2.7/scripts/convert_all_tools_serena.py +221 -0
- semantic_scholar_mcp-0.2.7/scripts/convert_md_to_yaml.py +163 -0
- semantic_scholar_mcp-0.2.7/scripts/convert_to_serena_style.py +357 -0
- semantic_scholar_mcp-0.2.7/scripts/convert_tools_to_serena.py +450 -0
- semantic_scholar_mcp-0.2.7/scripts/debug_mcp.sh +55 -0
- semantic_scholar_mcp-0.2.7/scripts/final_fix.py +106 -0
- semantic_scholar_mcp-0.2.7/scripts/final_serena_fix.py +93 -0
- semantic_scholar_mcp-0.2.7/scripts/fix_all_indents.py +54 -0
- semantic_scholar_mcp-0.2.7/scripts/fix_all_returns.py +120 -0
- semantic_scholar_mcp-0.2.7/scripts/fix_indentation.py +65 -0
- semantic_scholar_mcp-0.2.7/scripts/fix_try_blocks.py +181 -0
- semantic_scholar_mcp-0.2.7/scripts/quality_checks.sh +64 -0
- semantic_scholar_mcp-0.2.7/scripts/release.sh +88 -0
- semantic_scholar_mcp-0.2.7/scripts/remove_all_try.py +54 -0
- semantic_scholar_mcp-0.2.7/scripts/server_standalone.py +17 -0
- semantic_scholar_mcp-0.2.7/scripts/test_yaml_injection.py +98 -0
- semantic_scholar_mcp-0.2.7/scripts/tool_categories.txt +23 -0
- semantic_scholar_mcp-0.2.7/src/core/__init__.py +62 -0
- semantic_scholar_mcp-0.2.7/src/core/config.py +405 -0
- semantic_scholar_mcp-0.2.7/src/core/core.py +177 -0
- semantic_scholar_mcp-0.2.7/src/core/error_handler.py +543 -0
- semantic_scholar_mcp-0.2.7/src/core/exceptions.py +839 -0
- semantic_scholar_mcp-0.2.7/src/core/interfaces.py +154 -0
- semantic_scholar_mcp-0.2.7/src/core/logging.py +665 -0
- semantic_scholar_mcp-0.2.7/src/core/metrics_collector.py +475 -0
- semantic_scholar_mcp-0.2.7/src/core/py.typed +2 -0
- semantic_scholar_mcp-0.2.7/src/core/types.py +507 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/__init__.py +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/__main__.py +6 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/api_client.py +1276 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/dashboard/__init__.py +6 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/dashboard/server.py +255 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/dashboard/static/css/style.css +333 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/dashboard/static/js/app.js +367 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/dashboard/stats.py +217 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/dashboard/templates/index.html +119 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/instruction_loader.py +364 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/models.py +628 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/pdf_processor.py +668 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/py.typed +2 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/batch_get_authors.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/batch_get_authors.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/get_author.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/get_author.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/get_author_papers.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/get_author_papers.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/search_authors.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/author/search_authors.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_dataset_download_links.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_dataset_download_links.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_dataset_info.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_dataset_info.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_dataset_releases.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_dataset_releases.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_incremental_dataset_updates.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/dataset/get_incremental_dataset_updates.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/batch_get_papers.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/batch_get_papers.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/bulk_search_papers.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/bulk_search_papers.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_authors.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_authors.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_citations.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_citations.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_references.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_references.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_with_embeddings.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/get_paper_with_embeddings.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/search_papers.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/search_papers.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/search_papers_match.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/search_papers_match.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/search_papers_with_embeddings.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/paper/search_papers_with_embeddings.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/pdf/get_paper_fulltext.md +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/pdf/get_paper_fulltext.yml +16 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/autocomplete_query.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/autocomplete_query.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/check_api_key_status.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/check_api_key_status.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/get_recommendations_batch.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/get_recommendations_batch.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/get_recommendations_for_paper.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/get_recommendations_for_paper.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/search_snippets.md +4 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/resources/tool_instructions/prompts/search_snippets.yml +7 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/server.py +2243 -0
- semantic_scholar_mcp-0.2.7/src/semantic_scholar_mcp/utils.py +286 -0
- semantic_scholar_mcp-0.2.7/test_server_startup.py +54 -0
- semantic_scholar_mcp-0.2.7/tests/conftest.py +444 -0
- semantic_scholar_mcp-0.2.7/tests/test_dataset_api_spec.py +421 -0
- semantic_scholar_mcp-0.2.7/tests/test_error_handling.py +584 -0
- semantic_scholar_mcp-0.2.7/tests/test_field_validation_spec.py +424 -0
- semantic_scholar_mcp-0.2.7/tests/test_pdf_processor.py +364 -0
- semantic_scholar_mcp-0.2.7/tests/test_recommendations_api_spec.py +361 -0
- semantic_scholar_mcp-0.2.7/tests/test_semantic_scholar_api_spec.py +498 -0
- semantic_scholar_mcp-0.2.7/uv.lock +1716 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# JSON 入力を読み取り、コマンドとツール名を抽出
|
|
4
|
+
input=$(cat)
|
|
5
|
+
command=$(echo "$input" | jq -r '.tool_input.command' 2>/dev/null || echo "")
|
|
6
|
+
tool_name=$(echo "$input" | jq -r '.tool_name' 2>/dev/null || echo "")
|
|
7
|
+
|
|
8
|
+
# Bash コマンドのみをチェック
|
|
9
|
+
if [ "$tool_name" != "Bash" ]; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# settings.json から拒否パターンを読み取り
|
|
14
|
+
settings_file="$HOME/.claude/settings.json"
|
|
15
|
+
|
|
16
|
+
# Bash コマンドの全拒否パターンを取得
|
|
17
|
+
deny_patterns=$(jq -r '.permissions.deny[] | select(startswith("Bash(")) | gsub("^Bash\\("; "") | gsub("\\)$"; "")' "$settings_file" 2>/dev/null)
|
|
18
|
+
|
|
19
|
+
# コマンドが拒否パターンにマッチするかチェックする関数
|
|
20
|
+
matches_deny_pattern() {
|
|
21
|
+
local cmd="$1"
|
|
22
|
+
local pattern="$2"
|
|
23
|
+
|
|
24
|
+
# 先頭・末尾の空白を削除
|
|
25
|
+
cmd="${cmd#"${cmd%%[![:space:]]*}"}" # 先頭の空白を削除
|
|
26
|
+
cmd="${cmd%"${cmd##*[![:space:]]}"}" # 末尾の空白を削除
|
|
27
|
+
|
|
28
|
+
# glob パターンマッチング(ワイルドカード対応)
|
|
29
|
+
[[ "$cmd" == $pattern ]]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# まずコマンド全体をチェック
|
|
33
|
+
while IFS= read -r pattern; do
|
|
34
|
+
# 空行をスキップ
|
|
35
|
+
[ -z "$pattern" ] && continue
|
|
36
|
+
|
|
37
|
+
# コマンド全体がパターンにマッチするかチェック
|
|
38
|
+
if matches_deny_pattern "$command" "$pattern"; then
|
|
39
|
+
echo "Error: コマンドが拒否されました: '$command' (パターン: '$pattern')" >&2
|
|
40
|
+
exit 2
|
|
41
|
+
fi
|
|
42
|
+
done <<<"$deny_patterns"
|
|
43
|
+
|
|
44
|
+
# コマンドを論理演算子で分割し、各部分もチェック
|
|
45
|
+
# セミコロン、&& と || で分割(パイプ | と単一 & は分割しない)
|
|
46
|
+
temp_command="${command//;/$'\n'}"
|
|
47
|
+
temp_command="${temp_command//&&/$'\n'}"
|
|
48
|
+
temp_command="${temp_command//\|\|/$'\n'}"
|
|
49
|
+
|
|
50
|
+
IFS=$'\n'
|
|
51
|
+
for cmd_part in $temp_command; do
|
|
52
|
+
# 空の部分をスキップ
|
|
53
|
+
[ -z "$(echo "$cmd_part" | tr -d '[:space:]')" ] && continue
|
|
54
|
+
|
|
55
|
+
# 各拒否パターンに対してチェック
|
|
56
|
+
while IFS= read -r pattern; do
|
|
57
|
+
# 空行をスキップ
|
|
58
|
+
[ -z "$pattern" ] && continue
|
|
59
|
+
|
|
60
|
+
# このコマンド部分がパターンにマッチするかチェック
|
|
61
|
+
if matches_deny_pattern "$cmd_part" "$pattern"; then
|
|
62
|
+
echo "Error: コマンドが拒否されました: '$cmd_part' (パターン: '$pattern')" >&2
|
|
63
|
+
exit 2
|
|
64
|
+
fi
|
|
65
|
+
done <<<"$deny_patterns"
|
|
66
|
+
done
|
|
67
|
+
|
|
68
|
+
# コマンドを許可
|
|
69
|
+
exit 0
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"project": {
|
|
3
|
+
"name": "Semantic Scholar MCP",
|
|
4
|
+
"type": "python-mcp",
|
|
5
|
+
"root": "/home/user/semantic-scholar-mcp",
|
|
6
|
+
"python_version": "3.10",
|
|
7
|
+
"package_manager": "uv"
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
"development": {
|
|
11
|
+
"auto_format": true,
|
|
12
|
+
"lint_on_save": true,
|
|
13
|
+
"test_command": "uv run pytest",
|
|
14
|
+
"build_command": "uv build",
|
|
15
|
+
"run_command": "uv run python -m semantic_scholar_mcp"
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
"mcp": {
|
|
19
|
+
"server_file": "scripts/server_standalone.py",
|
|
20
|
+
"inspector_command": "uv run mcp dev scripts/server_standalone.py",
|
|
21
|
+
"test_file": "test_simple_search.py"
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
"hooks": {
|
|
25
|
+
"SessionStart": [
|
|
26
|
+
{
|
|
27
|
+
"hooks": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
FROM node:20
|
|
2
|
+
|
|
3
|
+
ARG TZ
|
|
4
|
+
ENV TZ="$TZ"
|
|
5
|
+
|
|
6
|
+
# Install basic development tools and iptables/ipset
|
|
7
|
+
RUN apt update && apt install -y less \
|
|
8
|
+
git \
|
|
9
|
+
procps \
|
|
10
|
+
sudo \
|
|
11
|
+
fzf \
|
|
12
|
+
zsh \
|
|
13
|
+
man-db \
|
|
14
|
+
unzip \
|
|
15
|
+
gnupg2 \
|
|
16
|
+
gh \
|
|
17
|
+
iptables \
|
|
18
|
+
ipset \
|
|
19
|
+
iproute2 \
|
|
20
|
+
dnsutils \
|
|
21
|
+
aggregate \
|
|
22
|
+
jq \
|
|
23
|
+
python3 \
|
|
24
|
+
python3-pip \
|
|
25
|
+
python3-venv \
|
|
26
|
+
python3-dev \
|
|
27
|
+
build-essential \
|
|
28
|
+
curl \
|
|
29
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
30
|
+
|
|
31
|
+
# Install uv (Python package manager)
|
|
32
|
+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
33
|
+
|
|
34
|
+
# Add uv to PATH
|
|
35
|
+
ENV PATH="/root/.cargo/bin:$PATH"
|
|
36
|
+
|
|
37
|
+
# Ensure default node user has access to /usr/local/share
|
|
38
|
+
RUN mkdir -p /usr/local/share/npm-global && \
|
|
39
|
+
chown -R node:node /usr/local/share
|
|
40
|
+
|
|
41
|
+
ARG USERNAME=node
|
|
42
|
+
|
|
43
|
+
# Persist bash history.
|
|
44
|
+
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
|
45
|
+
&& mkdir /commandhistory \
|
|
46
|
+
&& touch /commandhistory/.bash_history \
|
|
47
|
+
&& chown -R $USERNAME /commandhistory
|
|
48
|
+
|
|
49
|
+
# Set `DEVCONTAINER` environment variable to help with orientation
|
|
50
|
+
ENV DEVCONTAINER=true
|
|
51
|
+
|
|
52
|
+
# Environment variables for development
|
|
53
|
+
ENV PYTHONPATH=/workspace/src
|
|
54
|
+
ENV DEBUG_MCP_MODE=true
|
|
55
|
+
ENV LOG_MCP_MESSAGES=true
|
|
56
|
+
ENV LOG_API_PAYLOADS=true
|
|
57
|
+
ENV MCP_MODE=false
|
|
58
|
+
|
|
59
|
+
# Create workspace and config directories and set permissions
|
|
60
|
+
RUN mkdir -p /workspace /home/node/.claude && \
|
|
61
|
+
chown -R node:node /workspace /home/node/.claude
|
|
62
|
+
|
|
63
|
+
WORKDIR /workspace
|
|
64
|
+
|
|
65
|
+
RUN ARCH=$(dpkg --print-architecture) && \
|
|
66
|
+
wget "https://github.com/dandavison/delta/releases/download/0.18.2/git-delta_0.18.2_${ARCH}.deb" && \
|
|
67
|
+
sudo dpkg -i "git-delta_0.18.2_${ARCH}.deb" && \
|
|
68
|
+
rm "git-delta_0.18.2_${ARCH}.deb"
|
|
69
|
+
|
|
70
|
+
# Set up non-root user
|
|
71
|
+
USER node
|
|
72
|
+
|
|
73
|
+
# Install uv for node user
|
|
74
|
+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
75
|
+
|
|
76
|
+
# Install Python development tools globally
|
|
77
|
+
RUN /home/node/.cargo/bin/uv tool install pytest
|
|
78
|
+
RUN /home/node/.cargo/bin/uv tool install pytest-asyncio
|
|
79
|
+
RUN /home/node/.cargo/bin/uv tool install pytest-cov
|
|
80
|
+
RUN /home/node/.cargo/bin/uv tool install ruff
|
|
81
|
+
RUN /home/node/.cargo/bin/uv tool install mypy
|
|
82
|
+
RUN /home/node/.cargo/bin/uv tool install twine
|
|
83
|
+
RUN /home/node/.cargo/bin/uv tool install build
|
|
84
|
+
|
|
85
|
+
# Install MCP Inspector for debugging
|
|
86
|
+
RUN /home/node/.cargo/bin/uv tool install mcp
|
|
87
|
+
|
|
88
|
+
# Install global packages
|
|
89
|
+
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
|
|
90
|
+
ENV PATH=$PATH:/usr/local/share/npm-global/bin:/home/node/.cargo/bin:/home/node/.local/bin
|
|
91
|
+
|
|
92
|
+
# Set the default shell to zsh rather than sh
|
|
93
|
+
ENV SHELL=/bin/zsh
|
|
94
|
+
|
|
95
|
+
# Default powerline10k theme
|
|
96
|
+
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \
|
|
97
|
+
-p git \
|
|
98
|
+
-p fzf \
|
|
99
|
+
-a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
|
|
100
|
+
-a "source /usr/share/doc/fzf/examples/completion.zsh" \
|
|
101
|
+
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
|
102
|
+
-x
|
|
103
|
+
|
|
104
|
+
# Install Claude
|
|
105
|
+
RUN npm install -g @anthropic-ai/claude-code
|
|
106
|
+
|
|
107
|
+
# Pre-create workspace structure and install project dependencies
|
|
108
|
+
WORKDIR /workspace
|
|
109
|
+
RUN mkdir -p src tests docs .claude scripts && \
|
|
110
|
+
chown -R node:node /workspace
|
|
111
|
+
|
|
112
|
+
# Create a minimal pyproject.toml for dependency pre-installation
|
|
113
|
+
COPY --chown=node:node pyproject.toml uv.lock* ./
|
|
114
|
+
RUN /home/node/.cargo/bin/uv sync --frozen || true
|
|
115
|
+
|
|
116
|
+
# Copy and set up firewall script
|
|
117
|
+
COPY init-firewall.sh /usr/local/bin/
|
|
118
|
+
USER root
|
|
119
|
+
RUN chmod +x /usr/local/bin/init-firewall.sh && \
|
|
120
|
+
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
|
|
121
|
+
chmod 0440 /etc/sudoers.d/node-firewall
|
|
122
|
+
USER node
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Claude Code Sandbox",
|
|
3
|
+
"build": {
|
|
4
|
+
"dockerfile": "Dockerfile",
|
|
5
|
+
"args": {
|
|
6
|
+
"TZ": "${localEnv:TZ:America/Los_Angeles}"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"runArgs": [
|
|
10
|
+
"--cap-add=NET_ADMIN",
|
|
11
|
+
"--cap-add=NET_RAW"
|
|
12
|
+
],
|
|
13
|
+
"customizations": {
|
|
14
|
+
"vscode": {
|
|
15
|
+
"extensions": [
|
|
16
|
+
"dbaeumer.vscode-eslint",
|
|
17
|
+
"esbenp.prettier-vscode",
|
|
18
|
+
"eamodio.gitlens"
|
|
19
|
+
],
|
|
20
|
+
"settings": {
|
|
21
|
+
"editor.formatOnSave": true,
|
|
22
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
23
|
+
"editor.codeActionsOnSave": {
|
|
24
|
+
"source.fixAll.eslint": "explicit"
|
|
25
|
+
},
|
|
26
|
+
"terminal.integrated.defaultProfile.linux": "zsh",
|
|
27
|
+
"terminal.integrated.profiles.linux": {
|
|
28
|
+
"bash": {
|
|
29
|
+
"path": "bash",
|
|
30
|
+
"icon": "terminal-bash"
|
|
31
|
+
},
|
|
32
|
+
"zsh": {
|
|
33
|
+
"path": "zsh"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"remoteUser": "node",
|
|
40
|
+
"mounts": [
|
|
41
|
+
"source=claude-code-bashhistory,target=/commandhistory,type=volume",
|
|
42
|
+
"source=claude-code-config,target=/home/node/.claude,type=volume"
|
|
43
|
+
],
|
|
44
|
+
"remoteEnv": {
|
|
45
|
+
"NODE_OPTIONS": "--max-old-space-size=4096",
|
|
46
|
+
"CLAUDE_CONFIG_DIR": "/home/node/.claude",
|
|
47
|
+
"POWERLEVEL9K_DISABLE_GITSTATUS": "true"
|
|
48
|
+
},
|
|
49
|
+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=delegated",
|
|
50
|
+
"workspaceFolder": "/workspace",
|
|
51
|
+
"postCreateCommand": "sudo /usr/local/bin/init-firewall.sh"
|
|
52
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail # Exit on error, undefined vars, and pipeline failures
|
|
3
|
+
IFS=$'\n\t' # Stricter word splitting
|
|
4
|
+
|
|
5
|
+
# Flush existing rules and delete existing ipsets
|
|
6
|
+
iptables -F
|
|
7
|
+
iptables -X
|
|
8
|
+
iptables -t nat -F
|
|
9
|
+
iptables -t nat -X
|
|
10
|
+
iptables -t mangle -F
|
|
11
|
+
iptables -t mangle -X
|
|
12
|
+
ipset destroy allowed-domains 2>/dev/null || true
|
|
13
|
+
|
|
14
|
+
# First allow DNS and localhost before any restrictions
|
|
15
|
+
# Allow outbound DNS
|
|
16
|
+
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
|
|
17
|
+
# Allow inbound DNS responses
|
|
18
|
+
iptables -A INPUT -p udp --sport 53 -j ACCEPT
|
|
19
|
+
# Allow outbound SSH
|
|
20
|
+
iptables -A OUTPUT -p tcp --dport 22 -j ACCEPT
|
|
21
|
+
# Allow inbound SSH responses
|
|
22
|
+
iptables -A INPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
|
|
23
|
+
# Allow localhost
|
|
24
|
+
iptables -A INPUT -i lo -j ACCEPT
|
|
25
|
+
iptables -A OUTPUT -o lo -j ACCEPT
|
|
26
|
+
|
|
27
|
+
# Create ipset with CIDR support
|
|
28
|
+
ipset create allowed-domains hash:net
|
|
29
|
+
|
|
30
|
+
# Fetch GitHub meta information and aggregate + add their IP ranges
|
|
31
|
+
echo "Fetching GitHub IP ranges..."
|
|
32
|
+
gh_ranges=$(curl -s https://api.github.com/meta)
|
|
33
|
+
if [ -z "$gh_ranges" ]; then
|
|
34
|
+
echo "ERROR: Failed to fetch GitHub IP ranges"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
if ! echo "$gh_ranges" | jq -e '.web and .api and .git' >/dev/null; then
|
|
39
|
+
echo "ERROR: GitHub API response missing required fields"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
echo "Processing GitHub IPs..."
|
|
44
|
+
while read -r cidr; do
|
|
45
|
+
if [[ ! "$cidr" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/[0-9]{1,2}$ ]]; then
|
|
46
|
+
echo "ERROR: Invalid CIDR range from GitHub meta: $cidr"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
echo "Adding GitHub range $cidr"
|
|
50
|
+
ipset add allowed-domains "$cidr"
|
|
51
|
+
done < <(echo "$gh_ranges" | jq -r '(.web + .api + .git)[]' | aggregate -q)
|
|
52
|
+
|
|
53
|
+
# Resolve and add other allowed domains
|
|
54
|
+
for domain in \
|
|
55
|
+
"registry.npmjs.org" \
|
|
56
|
+
"api.anthropic.com" \
|
|
57
|
+
"sentry.io" \
|
|
58
|
+
"statsig.anthropic.com" \
|
|
59
|
+
"statsig.com"; do
|
|
60
|
+
echo "Resolving $domain..."
|
|
61
|
+
ips=$(dig +short A "$domain")
|
|
62
|
+
if [ -z "$ips" ]; then
|
|
63
|
+
echo "ERROR: Failed to resolve $domain"
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
while read -r ip; do
|
|
68
|
+
if [[ ! "$ip" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
|
69
|
+
echo "ERROR: Invalid IP from DNS for $domain: $ip"
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
echo "Adding $ip for $domain"
|
|
73
|
+
ipset add allowed-domains "$ip"
|
|
74
|
+
done < <(echo "$ips")
|
|
75
|
+
done
|
|
76
|
+
|
|
77
|
+
# Get host IP from default route
|
|
78
|
+
HOST_IP=$(ip route | grep default | cut -d" " -f3)
|
|
79
|
+
if [ -z "$HOST_IP" ]; then
|
|
80
|
+
echo "ERROR: Failed to detect host IP"
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
HOST_NETWORK=$(echo "$HOST_IP" | sed "s/\.[0-9]*$/.0\/24/")
|
|
85
|
+
echo "Host network detected as: $HOST_NETWORK"
|
|
86
|
+
|
|
87
|
+
# Set up remaining iptables rules
|
|
88
|
+
iptables -A INPUT -s "$HOST_NETWORK" -j ACCEPT
|
|
89
|
+
iptables -A OUTPUT -d "$HOST_NETWORK" -j ACCEPT
|
|
90
|
+
|
|
91
|
+
# Set default policies to DROP first
|
|
92
|
+
iptables -P INPUT DROP
|
|
93
|
+
iptables -P FORWARD DROP
|
|
94
|
+
iptables -P OUTPUT DROP
|
|
95
|
+
|
|
96
|
+
# First allow established connections for already approved traffic
|
|
97
|
+
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
|
98
|
+
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
|
99
|
+
|
|
100
|
+
# Then allow only specific outbound traffic to allowed domains
|
|
101
|
+
iptables -A OUTPUT -m set --match-set allowed-domains dst -j ACCEPT
|
|
102
|
+
|
|
103
|
+
echo "Firewall configuration complete"
|
|
104
|
+
echo "Verifying firewall rules..."
|
|
105
|
+
if curl --connect-timeout 5 https://example.com >/dev/null 2>&1; then
|
|
106
|
+
echo "ERROR: Firewall verification failed - was able to reach https://example.com"
|
|
107
|
+
exit 1
|
|
108
|
+
else
|
|
109
|
+
echo "Firewall verification passed - unable to reach https://example.com as expected"
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# Verify GitHub API access
|
|
113
|
+
if ! curl --connect-timeout 5 https://api.github.com/zen >/dev/null 2>&1; then
|
|
114
|
+
echo "ERROR: Firewall verification failed - unable to reach https://api.github.com"
|
|
115
|
+
exit 1
|
|
116
|
+
else
|
|
117
|
+
echo "Firewall verification passed - able to reach https://api.github.com as expected"
|
|
118
|
+
fi
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Environment configuration
|
|
2
|
+
ENVIRONMENT=development
|
|
3
|
+
|
|
4
|
+
# Semantic Scholar API (optional - works without key but with lower rate limits)
|
|
5
|
+
SEMANTIC_SCHOLAR_API_KEY=
|
|
6
|
+
|
|
7
|
+
# Logging
|
|
8
|
+
LOG_LEVEL=INFO
|
|
9
|
+
LOG_FORMAT=json
|
|
10
|
+
|
|
11
|
+
# Cache settings
|
|
12
|
+
CACHE__ENABLED=true
|
|
13
|
+
CACHE__TTL_SECONDS=3600
|
|
14
|
+
CACHE__BACKEND=memory
|
|
15
|
+
|
|
16
|
+
# Rate limiting
|
|
17
|
+
RATE_LIMIT__ENABLED=true
|
|
18
|
+
RATE_LIMIT__REQUESTS_PER_SECOND=1.0
|
|
19
|
+
RATE_LIMIT__BURST_SIZE=10
|
|
20
|
+
|
|
21
|
+
# Circuit breaker
|
|
22
|
+
CIRCUIT_BREAKER__ENABLED=true
|
|
23
|
+
CIRCUIT_BREAKER__FAILURE_THRESHOLD=5
|
|
24
|
+
CIRCUIT_BREAKER__RECOVERY_TIMEOUT=60.0
|
|
25
|
+
|
|
26
|
+
# Metrics
|
|
27
|
+
METRICS__ENABLED=true
|
|
28
|
+
METRICS__BACKEND=memory
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Python dependencies
|
|
4
|
+
- package-ecosystem: "pip"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "weekly"
|
|
8
|
+
day: "monday"
|
|
9
|
+
time: "09:00"
|
|
10
|
+
open-pull-requests-limit: 10
|
|
11
|
+
reviewers:
|
|
12
|
+
- "hy20191108"
|
|
13
|
+
labels:
|
|
14
|
+
- "dependencies"
|
|
15
|
+
- "python"
|
|
16
|
+
commit-message:
|
|
17
|
+
prefix: "chore"
|
|
18
|
+
include: "scope"
|
|
19
|
+
groups:
|
|
20
|
+
development-dependencies:
|
|
21
|
+
patterns:
|
|
22
|
+
- "pytest*"
|
|
23
|
+
- "black"
|
|
24
|
+
- "ruff"
|
|
25
|
+
- "mypy"
|
|
26
|
+
- "coverage*"
|
|
27
|
+
|
|
28
|
+
# GitHub Actions
|
|
29
|
+
- package-ecosystem: "github-actions"
|
|
30
|
+
directory: "/"
|
|
31
|
+
schedule:
|
|
32
|
+
interval: "weekly"
|
|
33
|
+
day: "monday"
|
|
34
|
+
time: "09:00"
|
|
35
|
+
open-pull-requests-limit: 5
|
|
36
|
+
reviewers:
|
|
37
|
+
- "hy20191108"
|
|
38
|
+
labels:
|
|
39
|
+
- "dependencies"
|
|
40
|
+
- "github-actions"
|
|
41
|
+
commit-message:
|
|
42
|
+
prefix: "ci"
|
|
43
|
+
include: "scope"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Auto Create GitHub Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
create-release:
|
|
10
|
+
name: Create GitHub Release
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Extract version from tag
|
|
19
|
+
id: version
|
|
20
|
+
run: |
|
|
21
|
+
TAG_NAME=${GITHUB_REF#refs/tags/}
|
|
22
|
+
VERSION=${TAG_NAME#v}
|
|
23
|
+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
|
|
24
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
25
|
+
|
|
26
|
+
- name: Generate release notes
|
|
27
|
+
id: notes
|
|
28
|
+
run: |
|
|
29
|
+
cat > release_notes.md <<EOF
|
|
30
|
+
## Release ${{ steps.version.outputs.version }}
|
|
31
|
+
|
|
32
|
+
### What's Changed
|
|
33
|
+
|
|
34
|
+
This release includes:
|
|
35
|
+
- Simplified version management (manual versioning)
|
|
36
|
+
- Streamlined GitHub Actions workflows
|
|
37
|
+
- Updated documentation for uv-based development
|
|
38
|
+
- Improved release process clarity
|
|
39
|
+
|
|
40
|
+
### Installation
|
|
41
|
+
|
|
42
|
+
\`\`\`bash
|
|
43
|
+
# Using uvx (recommended)
|
|
44
|
+
uvx semantic-scholar-mcp
|
|
45
|
+
|
|
46
|
+
# Or using pip
|
|
47
|
+
pip install semantic-scholar-mcp
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
### Documentation
|
|
51
|
+
|
|
52
|
+
- [User Guide](https://github.com/hy20191108/semantic-scholar-mcp#readme)
|
|
53
|
+
- [Release Process](https://github.com/hy20191108/semantic-scholar-mcp/blob/main/docs/RELEASE_PROCESS.md)
|
|
54
|
+
- [Developer Guide](https://github.com/hy20191108/semantic-scholar-mcp/blob/main/docs/DEVELOPER_GUIDE.md)
|
|
55
|
+
|
|
56
|
+
### Full Changelog
|
|
57
|
+
|
|
58
|
+
**Full Changelog**: https://github.com/hy20191108/semantic-scholar-mcp/compare/v0.2.5...${{ steps.version.outputs.tag_name }}
|
|
59
|
+
EOF
|
|
60
|
+
|
|
61
|
+
- name: Create GitHub Release
|
|
62
|
+
uses: softprops/action-gh-release@v2
|
|
63
|
+
with:
|
|
64
|
+
tag_name: ${{ steps.version.outputs.tag_name }}
|
|
65
|
+
name: Release ${{ steps.version.outputs.version }}
|
|
66
|
+
body_path: release_notes.md
|
|
67
|
+
draft: false
|
|
68
|
+
prerelease: false
|
|
69
|
+
generate_release_notes: true
|
|
70
|
+
env:
|
|
71
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
72
|
+
|
|
73
|
+
- name: Release created
|
|
74
|
+
run: |
|
|
75
|
+
echo "✅ GitHub Release created: ${{ steps.version.outputs.tag_name }}"
|
|
76
|
+
echo "🚀 PyPI publish will be triggered automatically"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
lint:
|
|
12
|
+
name: Code Linting
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v7
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
cache-dependency-glob: "uv.lock"
|
|
23
|
+
|
|
24
|
+
- name: Set up Python 3.10
|
|
25
|
+
run: uv python install 3.10
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --all-extras
|
|
29
|
+
|
|
30
|
+
- name: Run ruff check
|
|
31
|
+
run: uv run ruff check . --output-format=github
|
|
32
|
+
|
|
33
|
+
- name: Run ruff format check
|
|
34
|
+
run: uv run ruff format --check .
|
|
35
|
+
|
|
36
|
+
typecheck:
|
|
37
|
+
name: Type Checking
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout code
|
|
41
|
+
uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Install uv
|
|
44
|
+
uses: astral-sh/setup-uv@v7
|
|
45
|
+
with:
|
|
46
|
+
enable-cache: true
|
|
47
|
+
cache-dependency-glob: "uv.lock"
|
|
48
|
+
|
|
49
|
+
- name: Set up Python 3.10
|
|
50
|
+
run: uv python install 3.10
|
|
51
|
+
|
|
52
|
+
- name: Install dependencies
|
|
53
|
+
run: uv sync --all-extras
|
|
54
|
+
|
|
55
|
+
- name: Run mypy
|
|
56
|
+
run: uv run mypy src/ --show-error-codes --pretty
|
|
57
|
+
|
|
58
|
+
test:
|
|
59
|
+
name: Tests (Python 3.10)
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
steps:
|
|
62
|
+
- name: Checkout code
|
|
63
|
+
uses: actions/checkout@v4
|
|
64
|
+
|
|
65
|
+
- name: Install uv
|
|
66
|
+
uses: astral-sh/setup-uv@v7
|
|
67
|
+
with:
|
|
68
|
+
enable-cache: true
|
|
69
|
+
cache-dependency-glob: "uv.lock"
|
|
70
|
+
|
|
71
|
+
- name: Set up Python 3.10
|
|
72
|
+
run: uv python install 3.10
|
|
73
|
+
|
|
74
|
+
- name: Install dependencies
|
|
75
|
+
run: uv sync --all-extras
|
|
76
|
+
|
|
77
|
+
- name: Run tests with coverage
|
|
78
|
+
run: uv run pytest tests/ -v --tb=short --cov=src/semantic_scholar_mcp --cov-report=xml
|
|
79
|
+
|
|
80
|
+
- name: Upload coverage to Codecov
|
|
81
|
+
uses: codecov/codecov-action@v5
|
|
82
|
+
with:
|
|
83
|
+
file: ./coverage.xml
|
|
84
|
+
fail_ci_if_error: false
|
|
85
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|