mirror of
https://github.com/Sun-ZhenXing/mcp-template-python.git
synced 2026-02-04 02:03:32 +00:00
chore: Refactor code structure for improved readability and maintainability
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
# Trace files
|
||||
radar.duckdb*
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.*
|
||||
|
||||
@@ -70,4 +70,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:${PORT}/health || exit 1
|
||||
|
||||
EXPOSE ${PORT}
|
||||
CMD ["sh", "-c", "uv run --no-sync prod --host 0.0.0.0 --port ${PORT}"]
|
||||
CMD ["sh", "-c", "uv run --no-sync mcp-template-python --host 0.0.0.0 --port ${PORT}"]
|
||||
|
||||
36
Makefile
36
Makefile
@@ -1,52 +1,54 @@
|
||||
.PHONY: i dev prod build clean update lint docker-build docker-run helm-install helm-upgrade helm-uninstall helm-lint rename
|
||||
|
||||
args := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
|
||||
|
||||
i:
|
||||
uv sync --all-extras --all-packages $(filter-out i,$(MAKECMDGOALS))
|
||||
uv sync --all-extras --all-packages $(args)
|
||||
|
||||
dev:
|
||||
uv run --no-sync python -c "__import__('mcp_template_python.__main__').__main__.dev()" $(filter-out dev,$(MAKECMDGOALS)) || echo shutdown
|
||||
uv run --no-sync python -c "__import__('mcp_template_python.__main__').__main__.dev()" $(args) || echo shutdown
|
||||
|
||||
prod:
|
||||
uv run --no-sync python -c "__import__('mcp_template_python.__main__').__main__.main()" $(filter-out prod,$(MAKECMDGOALS))
|
||||
uv run --no-sync python -c "__import__('mcp_template_python.__main__').__main__.main()" $(args)
|
||||
|
||||
build:
|
||||
uv build $(filter-out build,$(MAKECMDGOALS))
|
||||
uv build $(args)
|
||||
|
||||
clean:
|
||||
rm -rf .venv .ruff_cache dist/ build/ *.egg-info $(filter-out clean,$(MAKECMDGOALS))
|
||||
rm -rf .venv .ruff_cache dist/ build/ *.egg-info $(args)
|
||||
|
||||
update:
|
||||
uv sync --all-extras --all-packages -U $(filter-out update,$(MAKECMDGOALS))
|
||||
uv sync --all-extras --all-packages -U $(args)
|
||||
|
||||
lint:
|
||||
uv run ruff check . $(filter-out lint,$(MAKECMDGOALS))
|
||||
uv run ruff check . $(args)
|
||||
|
||||
docker-build:
|
||||
docker compose build $(filter-out docker-build,$(MAKECMDGOALS))
|
||||
docker compose build $(args)
|
||||
|
||||
docker-run:
|
||||
docker compose up -d $(filter-out docker-run,$(MAKECMDGOALS))
|
||||
docker compose up -d $(args)
|
||||
|
||||
helm-lint:
|
||||
helm lint helm/mcp-template-python
|
||||
helm lint helm/mcp-template-python $(args)
|
||||
|
||||
helm-install:
|
||||
helm install mcp-template-python helm/mcp-template-python
|
||||
helm install mcp-template-python helm/mcp-template-python $(args)
|
||||
|
||||
helm-upgrade:
|
||||
helm upgrade mcp-template-python helm/mcp-template-python
|
||||
helm upgrade mcp-template-python helm/mcp-template-python $(args)
|
||||
|
||||
helm-install-prod:
|
||||
helm install mcp-template-python helm/mcp-template-python -f values-production.yaml
|
||||
helm install mcp-template-python helm/mcp-template-python -f values-production.yaml $(args)
|
||||
|
||||
helm-upgrade-prod:
|
||||
helm upgrade mcp-template-python helm/mcp-template-python -f values-production.yaml
|
||||
helm upgrade mcp-template-python helm/mcp-template-python -f values-production.yaml $(args)
|
||||
|
||||
helm-uninstall:
|
||||
helm uninstall mcp-template-python
|
||||
helm uninstall mcp-template-python $(args)
|
||||
|
||||
rename:
|
||||
uv run python tools/rename.py $(filter-out rename,$(MAKECMDGOALS))
|
||||
uv run python tools/rename.py $(args)
|
||||
|
||||
%:
|
||||
@:
|
||||
@true
|
||||
|
||||
@@ -15,7 +15,7 @@ class AppSettings(BaseSettings):
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_prefix="APP_",
|
||||
extra="allow",
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
mcp: MCPSettings = MCPSettings()
|
||||
|
||||
@@ -8,7 +8,7 @@ class CORSSettings(BaseSettings):
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_prefix="CORS_",
|
||||
extra="allow",
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
allow_origins: str = "*"
|
||||
|
||||
@@ -8,7 +8,7 @@ class MCPSettings(BaseSettings):
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_prefix="MCP_",
|
||||
extra="allow",
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
default_mcp: str = "math"
|
||||
|
||||
Reference in New Issue
Block a user