mcp-retail-sim 0.1.0__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.
- mcp_retail_sim-0.1.0/LICENSE +21 -0
- mcp_retail_sim-0.1.0/PKG-INFO +160 -0
- mcp_retail_sim-0.1.0/README.md +138 -0
- mcp_retail_sim-0.1.0/pyproject.toml +41 -0
- mcp_retail_sim-0.1.0/pyproject.toml.orig +36 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/__init__.py +3 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/__main__.py +4 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/cli.py +43 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/data/inventory.json +2002 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/data/policies.json +23 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/data/products.json +9514 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/helpers.py +41 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/prompts.py +20 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/resources.py +74 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/server.py +3 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/store.py +222 -0
- mcp_retail_sim-0.1.0/src/mcp_retail_sim/tools.py +96 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vish063
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-retail-sim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Synthetic retail MCP server for shopping-agent demos and evaluation
|
|
5
|
+
Keywords: mcp,fastmcp,retail,simulator,agent,model-context-protocol
|
|
6
|
+
Author: vish063
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Requires-Dist: fastmcp>=4.1.0
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Project-URL: Repository, https://github.com/vish063/mcp-retail-sim
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# mcp-retail-sim
|
|
24
|
+
|
|
25
|
+
Synthetic **retail store MCP server** for building and evaluating shopping / support agents.
|
|
26
|
+
|
|
27
|
+
No real payments, inventory DB, or third-party APIs — fixtures load into memory so demos and evals stay deterministic.
|
|
28
|
+
|
|
29
|
+
## What you get
|
|
30
|
+
|
|
31
|
+
| Primitive | Examples |
|
|
32
|
+
|---|---|
|
|
33
|
+
| **Tools** | `search`, `get_product_details`, `check_inventory`, `add_to_cart`, `place_order`, `get_order_details` |
|
|
34
|
+
| **Resources** | `product://{sku}`, `policy://returns`, `policy://shipping`, `policy://privacy` |
|
|
35
|
+
| **Prompts** | `compare_products`, `find_best_deal` |
|
|
36
|
+
| **Transports** | **stdio** (default) · **Streamable HTTP** |
|
|
37
|
+
|
|
38
|
+
Cart/order flows are **stateless** at the protocol layer: the client passes a `cart_id` handle (no server login session).
|
|
39
|
+
|
|
40
|
+
Same tools, resources, and prompts are available on **both** transports — only how the client connects changes.
|
|
41
|
+
|
|
42
|
+
## Transports
|
|
43
|
+
|
|
44
|
+
| | **stdio** | **Streamable HTTP** |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| **Start** | Client spawns the process | You start the server; it listens on a port |
|
|
47
|
+
| **Connect** | Pipes (stdin/stdout) | URL, e.g. `http://127.0.0.1:8050/mcp` |
|
|
48
|
+
| **Lifetime** | Usually tied to the client | Long-lived until you stop it |
|
|
49
|
+
| **Typical use** | Cursor, Claude Desktop, Inspector spawn | LangChain / remote-style clients, multi-client |
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# stdio (default) — for desktop hosts / Inspector spawn
|
|
53
|
+
uv run mcp-retail-sim
|
|
54
|
+
# same as:
|
|
55
|
+
uv run mcp-retail-sim --transport stdio
|
|
56
|
+
|
|
57
|
+
# Streamable HTTP — long-lived local server
|
|
58
|
+
uv run mcp-retail-sim --transport http --host 127.0.0.1 --port 8050
|
|
59
|
+
# MCP endpoint: http://127.0.0.1:8050/mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
CLI flags (HTTP only uses host/port):
|
|
63
|
+
|
|
64
|
+
| Flag | Default | Meaning |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `--transport` | `stdio` | `stdio` or `http` |
|
|
67
|
+
| `--host` | `127.0.0.1` | Bind address for HTTP |
|
|
68
|
+
| `--port` | `8050` | Bind port for HTTP |
|
|
69
|
+
|
|
70
|
+
Once published to PyPI, the same commands work with `uvx mcp-retail-sim` instead of `uv run mcp-retail-sim`.
|
|
71
|
+
|
|
72
|
+
## Quick start (from this repo)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cd mcp-retail-sim
|
|
76
|
+
uv sync
|
|
77
|
+
uv run mcp-retail-sim --help
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### MCP Inspector
|
|
81
|
+
|
|
82
|
+
**stdio** — Inspector starts the server for you (do not also run the server yourself):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx @modelcontextprotocol/inspector uv run mcp-retail-sim
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**HTTP** — start the server first, then point Inspector at the URL:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# terminal 1
|
|
92
|
+
uv run mcp-retail-sim --transport http --port 8050
|
|
93
|
+
|
|
94
|
+
# terminal 2
|
|
95
|
+
npx @modelcontextprotocol/inspector \
|
|
96
|
+
--server-url http://127.0.0.1:8050/mcp \
|
|
97
|
+
--transport http
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Cursor / Claude Desktop (stdio)
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"mcp-retail-sim": {
|
|
106
|
+
"command": "uvx",
|
|
107
|
+
"args": ["mcp-retail-sim"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
For a local checkout before publish, use `uv` + `run` + `mcp-retail-sim` (with working directory set to this project) instead of `uvx`.
|
|
114
|
+
|
|
115
|
+
### LangChain / HTTP client sketch
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
# Server must already be running:
|
|
119
|
+
# uv run mcp-retail-sim --transport http --port 8050
|
|
120
|
+
|
|
121
|
+
config = {
|
|
122
|
+
"mcpServers": {
|
|
123
|
+
"mcp-retail-sim": {
|
|
124
|
+
"url": "http://127.0.0.1:8050/mcp",
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Architecture (high level)
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
Client (agent / Inspector / LangChain)
|
|
134
|
+
│
|
|
135
|
+
├─ stdio: client spawns process, JSON-RPC over pipes
|
|
136
|
+
└─ http: client connects to http://host:port/mcp
|
|
137
|
+
▼
|
|
138
|
+
┌─────────────────────────────┐
|
|
139
|
+
│ mcp-retail-sim (FastMCP) │
|
|
140
|
+
│ tools · resources · prompts│
|
|
141
|
+
│ cli: --transport stdio|http│
|
|
142
|
+
└─────────────┬───────────────┘
|
|
143
|
+
│
|
|
144
|
+
▼
|
|
145
|
+
┌─────────────────────────────┐
|
|
146
|
+
│ In-memory store │
|
|
147
|
+
│ ← fixtures (products, │
|
|
148
|
+
│ inventory, policies) │
|
|
149
|
+
│ + carts / orders │
|
|
150
|
+
└─────────────────────────────┘
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Status
|
|
154
|
+
|
|
155
|
+
MVP: tools, resources, prompts, **stdio + Streamable HTTP**.
|
|
156
|
+
Failure injection is planned (see [`scope.md`](./scope.md)) — not shipped yet.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# mcp-retail-sim
|
|
2
|
+
|
|
3
|
+
Synthetic **retail store MCP server** for building and evaluating shopping / support agents.
|
|
4
|
+
|
|
5
|
+
No real payments, inventory DB, or third-party APIs — fixtures load into memory so demos and evals stay deterministic.
|
|
6
|
+
|
|
7
|
+
## What you get
|
|
8
|
+
|
|
9
|
+
| Primitive | Examples |
|
|
10
|
+
|---|---|
|
|
11
|
+
| **Tools** | `search`, `get_product_details`, `check_inventory`, `add_to_cart`, `place_order`, `get_order_details` |
|
|
12
|
+
| **Resources** | `product://{sku}`, `policy://returns`, `policy://shipping`, `policy://privacy` |
|
|
13
|
+
| **Prompts** | `compare_products`, `find_best_deal` |
|
|
14
|
+
| **Transports** | **stdio** (default) · **Streamable HTTP** |
|
|
15
|
+
|
|
16
|
+
Cart/order flows are **stateless** at the protocol layer: the client passes a `cart_id` handle (no server login session).
|
|
17
|
+
|
|
18
|
+
Same tools, resources, and prompts are available on **both** transports — only how the client connects changes.
|
|
19
|
+
|
|
20
|
+
## Transports
|
|
21
|
+
|
|
22
|
+
| | **stdio** | **Streamable HTTP** |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| **Start** | Client spawns the process | You start the server; it listens on a port |
|
|
25
|
+
| **Connect** | Pipes (stdin/stdout) | URL, e.g. `http://127.0.0.1:8050/mcp` |
|
|
26
|
+
| **Lifetime** | Usually tied to the client | Long-lived until you stop it |
|
|
27
|
+
| **Typical use** | Cursor, Claude Desktop, Inspector spawn | LangChain / remote-style clients, multi-client |
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# stdio (default) — for desktop hosts / Inspector spawn
|
|
31
|
+
uv run mcp-retail-sim
|
|
32
|
+
# same as:
|
|
33
|
+
uv run mcp-retail-sim --transport stdio
|
|
34
|
+
|
|
35
|
+
# Streamable HTTP — long-lived local server
|
|
36
|
+
uv run mcp-retail-sim --transport http --host 127.0.0.1 --port 8050
|
|
37
|
+
# MCP endpoint: http://127.0.0.1:8050/mcp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
CLI flags (HTTP only uses host/port):
|
|
41
|
+
|
|
42
|
+
| Flag | Default | Meaning |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `--transport` | `stdio` | `stdio` or `http` |
|
|
45
|
+
| `--host` | `127.0.0.1` | Bind address for HTTP |
|
|
46
|
+
| `--port` | `8050` | Bind port for HTTP |
|
|
47
|
+
|
|
48
|
+
Once published to PyPI, the same commands work with `uvx mcp-retail-sim` instead of `uv run mcp-retail-sim`.
|
|
49
|
+
|
|
50
|
+
## Quick start (from this repo)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cd mcp-retail-sim
|
|
54
|
+
uv sync
|
|
55
|
+
uv run mcp-retail-sim --help
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### MCP Inspector
|
|
59
|
+
|
|
60
|
+
**stdio** — Inspector starts the server for you (do not also run the server yourself):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx @modelcontextprotocol/inspector uv run mcp-retail-sim
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**HTTP** — start the server first, then point Inspector at the URL:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# terminal 1
|
|
70
|
+
uv run mcp-retail-sim --transport http --port 8050
|
|
71
|
+
|
|
72
|
+
# terminal 2
|
|
73
|
+
npx @modelcontextprotocol/inspector \
|
|
74
|
+
--server-url http://127.0.0.1:8050/mcp \
|
|
75
|
+
--transport http
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Cursor / Claude Desktop (stdio)
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"mcp-retail-sim": {
|
|
84
|
+
"command": "uvx",
|
|
85
|
+
"args": ["mcp-retail-sim"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For a local checkout before publish, use `uv` + `run` + `mcp-retail-sim` (with working directory set to this project) instead of `uvx`.
|
|
92
|
+
|
|
93
|
+
### LangChain / HTTP client sketch
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
# Server must already be running:
|
|
97
|
+
# uv run mcp-retail-sim --transport http --port 8050
|
|
98
|
+
|
|
99
|
+
config = {
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"mcp-retail-sim": {
|
|
102
|
+
"url": "http://127.0.0.1:8050/mcp",
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Architecture (high level)
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Client (agent / Inspector / LangChain)
|
|
112
|
+
│
|
|
113
|
+
├─ stdio: client spawns process, JSON-RPC over pipes
|
|
114
|
+
└─ http: client connects to http://host:port/mcp
|
|
115
|
+
▼
|
|
116
|
+
┌─────────────────────────────┐
|
|
117
|
+
│ mcp-retail-sim (FastMCP) │
|
|
118
|
+
│ tools · resources · prompts│
|
|
119
|
+
│ cli: --transport stdio|http│
|
|
120
|
+
└─────────────┬───────────────┘
|
|
121
|
+
│
|
|
122
|
+
▼
|
|
123
|
+
┌─────────────────────────────┐
|
|
124
|
+
│ In-memory store │
|
|
125
|
+
│ ← fixtures (products, │
|
|
126
|
+
│ inventory, policies) │
|
|
127
|
+
│ + carts / orders │
|
|
128
|
+
└─────────────────────────────┘
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Status
|
|
132
|
+
|
|
133
|
+
MVP: tools, resources, prompts, **stdio + Streamable HTTP**.
|
|
134
|
+
Failure injection is planned (see [`scope.md`](./scope.md)) — not shipped yet.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-retail-sim"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Synthetic retail MCP server for shopping-agent demos and evaluation"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.10"
|
|
9
|
+
keywords = [
|
|
10
|
+
"mcp",
|
|
11
|
+
"fastmcp",
|
|
12
|
+
"retail",
|
|
13
|
+
"simulator",
|
|
14
|
+
"agent",
|
|
15
|
+
"model-context-protocol",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Topic :: Software Development :: Testing",
|
|
27
|
+
]
|
|
28
|
+
dependencies = ["fastmcp>=4.1.0"]
|
|
29
|
+
|
|
30
|
+
[[project.authors]]
|
|
31
|
+
name = "vish063"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
mcp-retail-sim = "mcp_retail_sim.cli:main"
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Repository = "https://github.com/vish063/mcp-retail-sim"
|
|
38
|
+
|
|
39
|
+
[build-system]
|
|
40
|
+
requires = ["uv_build>=0.13.0,<0.14.0"]
|
|
41
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-retail-sim"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Synthetic retail MCP server for shopping-agent demos and evaluation"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.10"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "vish063" },
|
|
11
|
+
]
|
|
12
|
+
keywords = ["mcp", "fastmcp", "retail", "simulator", "agent", "model-context-protocol"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: Software Development :: Testing",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"fastmcp>=4.1.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
mcp-retail-sim = "mcp_retail_sim.cli:main"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Repository = "https://github.com/vish063/mcp-retail-sim"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["uv_build>=0.13.0,<0.14.0"]
|
|
36
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""CLI entry for mcp-retail-sim (stdio or Streamable HTTP)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
|
|
7
|
+
from mcp_retail_sim.server import mcp
|
|
8
|
+
import mcp_retail_sim.tools # noqa: F401 — register tools
|
|
9
|
+
import mcp_retail_sim.resources # noqa: F401 — register resources
|
|
10
|
+
import mcp_retail_sim.prompts # noqa: F401 — register prompts
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
14
|
+
parser = argparse.ArgumentParser(
|
|
15
|
+
prog="mcp-retail-sim",
|
|
16
|
+
description="Synthetic retail MCP server (stdio or Streamable HTTP).",
|
|
17
|
+
)
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"--transport",
|
|
20
|
+
choices=("stdio", "http"),
|
|
21
|
+
default="stdio",
|
|
22
|
+
help="MCP transport (default: stdio)",
|
|
23
|
+
)
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
"--host",
|
|
26
|
+
default="127.0.0.1",
|
|
27
|
+
help="HTTP bind host (default: 127.0.0.1; used only for http)",
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--port",
|
|
31
|
+
type=int,
|
|
32
|
+
default=8050,
|
|
33
|
+
help="HTTP bind port (default: 8050; used only for http)",
|
|
34
|
+
)
|
|
35
|
+
return parser.parse_args(argv)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def main(argv: list[str] | None = None) -> None:
|
|
39
|
+
args = parse_args(argv)
|
|
40
|
+
if args.transport == "stdio":
|
|
41
|
+
mcp.run(transport="stdio")
|
|
42
|
+
else:
|
|
43
|
+
mcp.run(transport="http", host=args.host, port=args.port)
|