mirror of
https://github.com/Sun-ZhenXing/mcp-template-python.git
synced 2026-02-04 02:03:32 +00:00
chore(deps): update & add Makefile
This commit is contained in:
@@ -19,3 +19,7 @@ trim_trailing_whitespace = false
|
|||||||
|
|
||||||
[Dockerfile]
|
[Dockerfile]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = tab
|
||||||
|
|||||||
19
Makefile
Normal file
19
Makefile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
.PHONY: i dev prod build update
|
||||||
|
|
||||||
|
i:
|
||||||
|
uv sync --all-extras --all-packages $(filter-out i,$(MAKECMDGOALS))
|
||||||
|
|
||||||
|
dev:
|
||||||
|
uv run --no-sync python -c "__import__('mcp_template_python.__main__').__main__.dev()" $(filter-out dev,$(MAKECMDGOALS))
|
||||||
|
|
||||||
|
prod:
|
||||||
|
uv run --no-sync python -c "__import__('mcp_template_python.__main__').__main__.main()" $(filter-out prod,$(MAKECMDGOALS))
|
||||||
|
|
||||||
|
build:
|
||||||
|
uv build $(filter-out build,$(MAKECMDGOALS))
|
||||||
|
|
||||||
|
update:
|
||||||
|
uv sync --all-extras --all-packages -U $(filter-out update,$(MAKECMDGOALS))
|
||||||
|
|
||||||
|
%:
|
||||||
|
@:
|
||||||
10
README.md
10
README.md
@@ -14,13 +14,13 @@ This project provides an MCP application template integrated with FastAPI.
|
|||||||
Install dependencies:
|
Install dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv sync
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
Development:
|
Development:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run dev
|
make dev
|
||||||
```
|
```
|
||||||
|
|
||||||
You can access the example MCP interface (Streamable HTTP) via <http://127.0.0.1:3001/math/mcp>, or access the SSE interface via <http://127.0.0.1:3001/math/compatible/sse>.
|
You can access the example MCP interface (Streamable HTTP) via <http://127.0.0.1:3001/math/mcp>, or access the SSE interface via <http://127.0.0.1:3001/math/compatible/sse>.
|
||||||
@@ -28,7 +28,7 @@ You can access the example MCP interface (Streamable HTTP) via <http://127.0.0.1
|
|||||||
Call via command line with `--stdio`:
|
Call via command line with `--stdio`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run prod --stdio
|
make prod -- --stdio
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
@@ -36,13 +36,13 @@ uv run prod --stdio
|
|||||||
Production:
|
Production:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run --no-sync prod
|
make prod
|
||||||
```
|
```
|
||||||
|
|
||||||
Build Python Wheel package:
|
Build Python Wheel package:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv build
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker Deployment
|
## Docker Deployment
|
||||||
|
|||||||
@@ -10,13 +10,12 @@ requires-python = ">=3.10"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"fastapi[standard]>=0.115.0",
|
"fastapi[standard]>=0.115.0",
|
||||||
"mcp[cli]>=1.10.0",
|
"mcp[cli]>=1.10.0",
|
||||||
|
"pydantic>=2.11.7",
|
||||||
"pydantic-settings>=2.5.0",
|
"pydantic-settings>=2.5.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
mcp-template-python = "mcp_template_python.__main__:main"
|
mcp-template-python = "mcp_template_python.__main__:main"
|
||||||
dev = "mcp_template_python.__main__:dev"
|
|
||||||
prod = "mcp_template_python.__main__:main"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling"]
|
requires = ["hatchling"]
|
||||||
|
|||||||
@@ -60,10 +60,8 @@ def main():
|
|||||||
else:
|
else:
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
from .server import app
|
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
app,
|
f"{__module_name__}.server:app",
|
||||||
host=args.host,
|
host=args.host,
|
||||||
port=args.port,
|
port=args.port,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user