sg-mcp-server 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.
Files changed (28) hide show
  1. sg_mcp_server-0.1.0/.gitignore +46 -0
  2. sg_mcp_server-0.1.0/LICENSE +21 -0
  3. sg_mcp_server-0.1.0/PKG-INFO +174 -0
  4. sg_mcp_server-0.1.0/README.md +147 -0
  5. sg_mcp_server-0.1.0/pyproject.toml +189 -0
  6. sg_mcp_server-0.1.0/src/sg_mcp_server/__init__.py +19 -0
  7. sg_mcp_server-0.1.0/src/sg_mcp_server/__main__.py +13 -0
  8. sg_mcp_server-0.1.0/src/sg_mcp_server/_audit.py +66 -0
  9. sg_mcp_server-0.1.0/src/sg_mcp_server/_cli.py +276 -0
  10. sg_mcp_server-0.1.0/src/sg_mcp_server/_config.py +185 -0
  11. sg_mcp_server-0.1.0/src/sg_mcp_server/_diagnostics.py +444 -0
  12. sg_mcp_server-0.1.0/src/sg_mcp_server/_downstream.py +59 -0
  13. sg_mcp_server-0.1.0/src/sg_mcp_server/_engine/__init__.py +28 -0
  14. sg_mcp_server-0.1.0/src/sg_mcp_server/_engine/_errors.py +85 -0
  15. sg_mcp_server-0.1.0/src/sg_mcp_server/_engine/_execution.py +246 -0
  16. sg_mcp_server-0.1.0/src/sg_mcp_server/_engine/_relative_dates.py +182 -0
  17. sg_mcp_server-0.1.0/src/sg_mcp_server/_engine/_schema.py +652 -0
  18. sg_mcp_server-0.1.0/src/sg_mcp_server/_engine/_validation.py +1106 -0
  19. sg_mcp_server-0.1.0/src/sg_mcp_server/_errors.py +30 -0
  20. sg_mcp_server-0.1.0/src/sg_mcp_server/_json.py +5 -0
  21. sg_mcp_server-0.1.0/src/sg_mcp_server/_providers.py +248 -0
  22. sg_mcp_server-0.1.0/src/sg_mcp_server/_rendering.py +325 -0
  23. sg_mcp_server-0.1.0/src/sg_mcp_server/_schema_adapter.py +156 -0
  24. sg_mcp_server-0.1.0/src/sg_mcp_server/_server.py +373 -0
  25. sg_mcp_server-0.1.0/src/sg_mcp_server/_surface.py +124 -0
  26. sg_mcp_server-0.1.0/src/sg_mcp_server/_tool_contracts.py +324 -0
  27. sg_mcp_server-0.1.0/src/sg_mcp_server/_tools.py +177 -0
  28. sg_mcp_server-0.1.0/src/sg_mcp_server/py.typed +0 -0
@@ -0,0 +1,46 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ dist/
13
+ .eggs/
14
+ *.egg-info/
15
+ *.egg
16
+
17
+ # Virtual environments
18
+ .venv/
19
+ venv/
20
+ ENV/
21
+
22
+ # PyInstaller
23
+ *.manifest
24
+ *.spec
25
+
26
+ # Unit test / coverage reports
27
+ htmlcov/
28
+ .tox/
29
+ .nox/
30
+ .coverage*
31
+ .pytest_cache/
32
+ .cache/
33
+
34
+ # Type checker / linter caches
35
+ .pyright/
36
+ .mypy_cache/
37
+ .ruff_cache/
38
+ pyrightconfig.json
39
+
40
+ # Editors
41
+ .vscode/
42
+ .idea/
43
+
44
+ # OS
45
+ .DS_Store
46
+ Thumbs.db
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 the sg-mcp-server authors
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,174 @@
1
+ Metadata-Version: 2.5
2
+ Name: sg-mcp-server
3
+ Version: 0.1.0
4
+ Summary: Read-only MCP server for Autodesk Flow Production Tracking
5
+ Project-URL: Documentation, https://github.com/dactylo/sg-mcp-server/tree/main/docs
6
+ Project-URL: Homepage, https://github.com/dactylo/sg-mcp-server
7
+ Project-URL: Issues, https://github.com/dactylo/sg-mcp-server/issues
8
+ Project-URL: Repository, https://github.com/dactylo/sg-mcp-server
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: flow-production-tracking,mcp,server,shotgrid,shotgun
12
+ Classifier: Programming Language :: Python :: 3 :: Only
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: Programming Language :: Python :: 3.15
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: anyio>=4.9
21
+ Requires-Dist: jsonschema>=4.20
22
+ Requires-Dist: mcp<3,>=2
23
+ Requires-Dist: tzdata
24
+ Provides-Extra: official
25
+ Requires-Dist: shotgun-api3>=3.10.2; extra == 'official'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # sg-mcp-server
29
+
30
+ sg-mcp-server lets an AI assistant answer questions about your Autodesk Flow Production Tracking
31
+ site. Connect it to an MCP (Model Context Protocol) client, ask in plain language, and the
32
+ assistant looks up your site's live schema and records instead of guessing at entity types, field
33
+ names, or status values.
34
+
35
+ The server gives the client three read-only tools over MCP stdio: `sg_schema` explores entity types
36
+ and fields, `sg_query` runs bounded queries, and `sg_get` opens one record with its web link. Every
37
+ query is checked against your site's schema first: a misspelled field name returns a list of valid
38
+ alternatives and is never silently replaced.
39
+
40
+ This documentation uses SG for Flow Production Tracking, formerly named Shotgun and ShotGrid.
41
+
42
+ ## Security model
43
+
44
+ sg-mcp-server is read-only: it has no tools that create, change, or delete records. Every request
45
+ runs as one SG script (`ApiUser`) and sees what that script's permissions allow. The server does
46
+ not act as the person asking the question, so anyone who can use the MCP client can read anything
47
+ the script can read. Give the script access only to the data you intend to expose, and keep its key
48
+ in your client's private configuration.
49
+
50
+ The server appends every tool call to a local security audit, `~/.sg-mcp-server/audit.jsonl` by
51
+ default. Each entry records the script name, tool, outcome, duration, and returned record IDs, with
52
+ a hash of the request instead of its contents. If an audit write fails, the server warns on
53
+ standard error and still answers, so that call is missing from the audit.
54
+
55
+ An assistant can still misread a result or answer from incomplete data. In the
56
+ [interface study](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/benchmarks.md), no tested model answered every task correctly, so check
57
+ important answers against the records the tools return.
58
+
59
+ ## Installation
60
+
61
+ You need:
62
+
63
+ - Python 3.11 or newer and [uv](https://docs.astral.sh/uv/).
64
+ - An MCP client that can start a local stdio server.
65
+ - An SG site reachable from this machine, with a script name and API key that can read the data you
66
+ want to ask about.
67
+
68
+ From a checkout of this repository, install the command with the official SG client:
69
+
70
+ ```sh
71
+ uv tool install '.[official]'
72
+ ```
73
+
74
+ The `official` extra installs `shotgun-api3`, the Autodesk Python API the server uses to reach your
75
+ site. The base package does not include an SG client; without one, the server stops at startup with
76
+ an error that names the `official` extra.
77
+
78
+ After updating the checkout, update the installed command:
79
+
80
+ ```sh
81
+ uv tool install --reinstall '.[official]'
82
+ ```
83
+
84
+ `make install` and `make reinstall` run the same commands. Run `sg-mcp-server --version` to check
85
+ the installed version. If your MCP client cannot find `sg-mcp-server`, give it the full path in the
86
+ directory that `uv tool dir --bin` prints.
87
+
88
+ ## Quick start
89
+
90
+ ### Add the server to your MCP client
91
+
92
+ Add a stdio server to your client's MCP configuration. This example uses the common `mcpServers`
93
+ JSON shape; place it where your client expects MCP servers:
94
+
95
+ ```json
96
+ {
97
+ "mcpServers": {
98
+ "sg": {
99
+ "command": "sg-mcp-server",
100
+ "env": {
101
+ "SG_MCP_SITE_URL": "https://yoursite.shotgunstudio.com",
102
+ "SG_MCP_SCRIPT_NAME": "your-script-name",
103
+ "SG_MCP_API_KEY": "your-script-key"
104
+ }
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ Replace the three values with your site's address, script name, and API key. `SG_MCP_SITE_URL` must
111
+ be the bare HTTPS site address, with no path, query, or fragment. Restart or reconnect the client
112
+ so that it starts the server; the server runs until the client disconnects.
113
+
114
+ The server checks its settings when it starts and stops with a one-line `error:` message if one is
115
+ missing or invalid; [Troubleshooting](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/usage.md#troubleshooting) lists the causes. It does not
116
+ contact your site until the first tool call, so a wrong key or an unreachable site appears as an
117
+ error on your first question, not as a startup failure.
118
+
119
+ ### Ask your first question
120
+
121
+ Ask the assistant:
122
+
123
+ ```text
124
+ Which projects can this script see?
125
+ ```
126
+
127
+ The assistant typically calls `sg_schema` to confirm the Project entity, then `sg_query` to list
128
+ Projects, and answers with project names from your site. A list of names means the server is
129
+ working. The exact answer depends on your site's records and the script's permissions.
130
+
131
+ Next, ask "What fields are available on Shot?" to explore your site's schema before asking about
132
+ site-specific fields. [Using the server](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/usage.md) has more example questions, direct
133
+ tool-call arguments, and every setting.
134
+
135
+ ## What the tools do
136
+
137
+ | Tool | Use it for |
138
+ | ----------- | --------------------------------------------------------------------------------------------- |
139
+ | `sg_schema` | List entity types, describe one entity's fields, or search field names and labels. |
140
+ | `sg_query` | Find records with validated filters, sorting, and a row limit, or request one native summary. |
141
+ | `sg_get` | Fetch one record by entity type and numeric ID, including its web URL. |
142
+
143
+ A query returns at most 50 records unless it asks for a different limit, and never more than 200;
144
+ you can change both limits. When more records match, the result says so and suggests narrowing the
145
+ filters or requesting a summary, so the assistant does not mistake one page for every match.
146
+
147
+ ## Documentation
148
+
149
+ | If you want to... | Read |
150
+ | ------------------------------------------------------------------ | ------------------------------------------------ |
151
+ | Find example questions and tool-call arguments | [Using the server](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/usage.md) |
152
+ | Change the time zone, limits, timeout, audit path, or schema cache | [Settings](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/usage.md#settings) |
153
+ | Fix a request that fails or a server that will not start | [Troubleshooting](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/usage.md#troubleshooting) |
154
+ | Find out where a slow request spends its time | [Latency diagnostics](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/diagnostics.md) |
155
+ | Understand the three-tool design and model reliability | [Interface study](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/benchmarks.md) |
156
+ | See changes by version | [Changelog](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/CHANGELOG.md) |
157
+
158
+ ## Development
159
+
160
+ See the [development guide](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/docs/development.md) for the required tools, CI, and dependency locks.
161
+ With those tools installed, run:
162
+
163
+ ```sh
164
+ make setup
165
+ make check
166
+ ```
167
+
168
+ The checks never contact a live SG site.
169
+
170
+ ## License
171
+
172
+ sg-mcp-server is available under the [MIT License](https://github.com/dactylo/sg-mcp-server/blob/v0.1.0/LICENSE). It is an independent project and is
173
+ not affiliated with or endorsed by Autodesk. Flow Production Tracking is a product of Autodesk,
174
+ Inc.
@@ -0,0 +1,147 @@
1
+ # sg-mcp-server
2
+
3
+ sg-mcp-server lets an AI assistant answer questions about your Autodesk Flow Production Tracking
4
+ site. Connect it to an MCP (Model Context Protocol) client, ask in plain language, and the
5
+ assistant looks up your site's live schema and records instead of guessing at entity types, field
6
+ names, or status values.
7
+
8
+ The server gives the client three read-only tools over MCP stdio: `sg_schema` explores entity types
9
+ and fields, `sg_query` runs bounded queries, and `sg_get` opens one record with its web link. Every
10
+ query is checked against your site's schema first: a misspelled field name returns a list of valid
11
+ alternatives and is never silently replaced.
12
+
13
+ This documentation uses SG for Flow Production Tracking, formerly named Shotgun and ShotGrid.
14
+
15
+ ## Security model
16
+
17
+ sg-mcp-server is read-only: it has no tools that create, change, or delete records. Every request
18
+ runs as one SG script (`ApiUser`) and sees what that script's permissions allow. The server does
19
+ not act as the person asking the question, so anyone who can use the MCP client can read anything
20
+ the script can read. Give the script access only to the data you intend to expose, and keep its key
21
+ in your client's private configuration.
22
+
23
+ The server appends every tool call to a local security audit, `~/.sg-mcp-server/audit.jsonl` by
24
+ default. Each entry records the script name, tool, outcome, duration, and returned record IDs, with
25
+ a hash of the request instead of its contents. If an audit write fails, the server warns on
26
+ standard error and still answers, so that call is missing from the audit.
27
+
28
+ An assistant can still misread a result or answer from incomplete data. In the
29
+ [interface study](docs/benchmarks.md), no tested model answered every task correctly, so check
30
+ important answers against the records the tools return.
31
+
32
+ ## Installation
33
+
34
+ You need:
35
+
36
+ - Python 3.11 or newer and [uv](https://docs.astral.sh/uv/).
37
+ - An MCP client that can start a local stdio server.
38
+ - An SG site reachable from this machine, with a script name and API key that can read the data you
39
+ want to ask about.
40
+
41
+ From a checkout of this repository, install the command with the official SG client:
42
+
43
+ ```sh
44
+ uv tool install '.[official]'
45
+ ```
46
+
47
+ The `official` extra installs `shotgun-api3`, the Autodesk Python API the server uses to reach your
48
+ site. The base package does not include an SG client; without one, the server stops at startup with
49
+ an error that names the `official` extra.
50
+
51
+ After updating the checkout, update the installed command:
52
+
53
+ ```sh
54
+ uv tool install --reinstall '.[official]'
55
+ ```
56
+
57
+ `make install` and `make reinstall` run the same commands. Run `sg-mcp-server --version` to check
58
+ the installed version. If your MCP client cannot find `sg-mcp-server`, give it the full path in the
59
+ directory that `uv tool dir --bin` prints.
60
+
61
+ ## Quick start
62
+
63
+ ### Add the server to your MCP client
64
+
65
+ Add a stdio server to your client's MCP configuration. This example uses the common `mcpServers`
66
+ JSON shape; place it where your client expects MCP servers:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "sg": {
72
+ "command": "sg-mcp-server",
73
+ "env": {
74
+ "SG_MCP_SITE_URL": "https://yoursite.shotgunstudio.com",
75
+ "SG_MCP_SCRIPT_NAME": "your-script-name",
76
+ "SG_MCP_API_KEY": "your-script-key"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ Replace the three values with your site's address, script name, and API key. `SG_MCP_SITE_URL` must
84
+ be the bare HTTPS site address, with no path, query, or fragment. Restart or reconnect the client
85
+ so that it starts the server; the server runs until the client disconnects.
86
+
87
+ The server checks its settings when it starts and stops with a one-line `error:` message if one is
88
+ missing or invalid; [Troubleshooting](docs/usage.md#troubleshooting) lists the causes. It does not
89
+ contact your site until the first tool call, so a wrong key or an unreachable site appears as an
90
+ error on your first question, not as a startup failure.
91
+
92
+ ### Ask your first question
93
+
94
+ Ask the assistant:
95
+
96
+ ```text
97
+ Which projects can this script see?
98
+ ```
99
+
100
+ The assistant typically calls `sg_schema` to confirm the Project entity, then `sg_query` to list
101
+ Projects, and answers with project names from your site. A list of names means the server is
102
+ working. The exact answer depends on your site's records and the script's permissions.
103
+
104
+ Next, ask "What fields are available on Shot?" to explore your site's schema before asking about
105
+ site-specific fields. [Using the server](docs/usage.md) has more example questions, direct
106
+ tool-call arguments, and every setting.
107
+
108
+ ## What the tools do
109
+
110
+ | Tool | Use it for |
111
+ | ----------- | --------------------------------------------------------------------------------------------- |
112
+ | `sg_schema` | List entity types, describe one entity's fields, or search field names and labels. |
113
+ | `sg_query` | Find records with validated filters, sorting, and a row limit, or request one native summary. |
114
+ | `sg_get` | Fetch one record by entity type and numeric ID, including its web URL. |
115
+
116
+ A query returns at most 50 records unless it asks for a different limit, and never more than 200;
117
+ you can change both limits. When more records match, the result says so and suggests narrowing the
118
+ filters or requesting a summary, so the assistant does not mistake one page for every match.
119
+
120
+ ## Documentation
121
+
122
+ | If you want to... | Read |
123
+ | ------------------------------------------------------------------ | ------------------------------------------------ |
124
+ | Find example questions and tool-call arguments | [Using the server](docs/usage.md) |
125
+ | Change the time zone, limits, timeout, audit path, or schema cache | [Settings](docs/usage.md#settings) |
126
+ | Fix a request that fails or a server that will not start | [Troubleshooting](docs/usage.md#troubleshooting) |
127
+ | Find out where a slow request spends its time | [Latency diagnostics](docs/diagnostics.md) |
128
+ | Understand the three-tool design and model reliability | [Interface study](docs/benchmarks.md) |
129
+ | See changes by version | [Changelog](CHANGELOG.md) |
130
+
131
+ ## Development
132
+
133
+ See the [development guide](docs/development.md) for the required tools, CI, and dependency locks.
134
+ With those tools installed, run:
135
+
136
+ ```sh
137
+ make setup
138
+ make check
139
+ ```
140
+
141
+ The checks never contact a live SG site.
142
+
143
+ ## License
144
+
145
+ sg-mcp-server is available under the [MIT License](LICENSE). It is an independent project and is
146
+ not affiliated with or endorsed by Autodesk. Flow Production Tracking is a product of Autodesk,
147
+ Inc.
@@ -0,0 +1,189 @@
1
+ # ==========================================================
2
+ # Build System
3
+ # ==========================================================
4
+ [build-system]
5
+ build-backend = "hatchling.build"
6
+ requires = [ "editables~=0.3", "hatch-fancy-pypi-readme>=25.1", "hatchling>=1.27" ]
7
+
8
+ # ==========================================================
9
+ # Project Metadata
10
+ # ==========================================================
11
+ [project]
12
+ name = "sg-mcp-server"
13
+ version = "0.1.0"
14
+ description = "Read-only MCP server for Autodesk Flow Production Tracking"
15
+ keywords = [ "flow-production-tracking", "mcp", "server", "shotgrid", "shotgun" ]
16
+ license = "MIT"
17
+ license-files = [ "LICENSE" ]
18
+ requires-python = ">=3.11"
19
+ classifiers = [
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
25
+ "Programming Language :: Python :: 3.15",
26
+ "Typing :: Typed",
27
+ ]
28
+ dynamic = [ "readme" ]
29
+ dependencies = [
30
+ "anyio>=4.9",
31
+ "jsonschema>=4.20",
32
+ "mcp>=2,<3",
33
+ "tzdata",
34
+ ]
35
+ optional-dependencies.official = [
36
+ "shotgun-api3>=3.10.2",
37
+ ]
38
+ urls.Documentation = "https://github.com/dactylo/sg-mcp-server/tree/main/docs"
39
+ urls.Homepage = "https://github.com/dactylo/sg-mcp-server"
40
+ urls.Issues = "https://github.com/dactylo/sg-mcp-server/issues"
41
+ urls.Repository = "https://github.com/dactylo/sg-mcp-server"
42
+ scripts.sg-mcp-server = "sg_mcp_server:main"
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "mdformat",
47
+ "mdformat-config",
48
+ "mdformat-frontmatter",
49
+ "mdformat-gfm",
50
+ "mdformat-pyproject",
51
+ "mdformat-ruff",
52
+ "mdformat-shfmt",
53
+ "pyproject-fmt",
54
+ "pyright",
55
+ "ruff",
56
+ { include-group = "test" },
57
+ ]
58
+ test = [
59
+ "pytest",
60
+ "pytest-xdist>=3.2",
61
+ ]
62
+ ci-build = [
63
+ "maturin>=1.10,<2",
64
+ ]
65
+
66
+ [tool.hatch]
67
+ metadata.hooks.fancy-pypi-readme.content-type = "text/markdown"
68
+ metadata.hooks.fancy-pypi-readme.fragments = [ { path = "README.md" } ]
69
+ build.targets.wheel.packages = [ "src/sg_mcp_server" ]
70
+ build.targets.sdist.include = [ "/README.md", "/src" ]
71
+
72
+ # Keep checkout links relative; package links target this release.
73
+ [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
74
+ pattern = '(!\[[^\]\n]*\]\()(?![A-Za-z][A-Za-z0-9+.-]*:|[/#])(?:\./)?([^\s)]+)(\))'
75
+ replacement = '\1https://raw.githubusercontent.com/dactylo/sg-mcp-server/v$HFPR_VERSION/\2\3'
76
+
77
+ [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
78
+ pattern = '(?<!!)(\[[^\]\n]+\]\()(?![A-Za-z][A-Za-z0-9+.-]*:|[/#])(?:\./)?([^\s)]+)(\))'
79
+ replacement = '\1https://github.com/dactylo/sg-mcp-server/blob/v$HFPR_VERSION/\2\3'
80
+
81
+ [tool.uv]
82
+ # CI supplies the native Taplo CLI; its Python package lacks Linux/Windows ARM wheels.
83
+ exclude-dependencies = [
84
+ { package = { name = "mdformat-config", version = "0.2.1" }, dependencies = [ "taplo" ] },
85
+ ]
86
+
87
+ # ==========================================================
88
+ # Ruff Configuration
89
+ # ==========================================================
90
+ [tool.ruff]
91
+ target-version = "py311"
92
+ line-length = 99
93
+ format.quote-style = "single"
94
+ format.exclude = [ "*.md" ]
95
+ lint.select = [ "ALL" ]
96
+ lint.ignore = [
97
+ "COM812", # Conflicts with the Ruff formatter
98
+ "CPY001", # Copyright notices are not required
99
+ "EM101", # Exception must not use string literal
100
+ "EM102", # Exception must not use f-string literal
101
+ "FBT001", # Boolean positional arg in function definition
102
+ "FBT002", # Boolean default value in function definition
103
+ "Q000", # Conflicts with the Ruff formatter
104
+ "Q003", # Conflicts with the Ruff formatter
105
+ "T201", # print() found
106
+ "TRY003", # Avoid specifying long messages outside exception class
107
+ ]
108
+ # Exact-file exceptions for same-file private collaboration, intentional output, and tests.
109
+ lint.per-file-ignores."experiments/arms/_arm_b.py" = [ "SLF001" ]
110
+ lint.per-file-ignores."experiments/arms/_arm_d.py" = [ "SLF001" ]
111
+ lint.per-file-ignores."experiments/arms/_arm_e.py" = [ "SLF001" ]
112
+ lint.per-file-ignores."experiments/bakeoff/dataset/seed.py" = [ "T201" ]
113
+ lint.per-file-ignores."experiments/bakeoff/driver.py" = [ "T201" ]
114
+ lint.per-file-ignores."experiments/bakeoff/fixtures/augment_schema.py" = [ "T201" ]
115
+ lint.per-file-ignores."experiments/bakeoff/harness/_questions.py" = [ "SLF001" ]
116
+ lint.per-file-ignores."experiments/bakeoff/harness/_schema_tools.py" = [ "SLF001" ]
117
+ lint.per-file-ignores."experiments/bakeoff/harness/runner.py" = [ "SLF001", "T201" ]
118
+ lint.per-file-ignores."experiments/model_benchmark/_artifacts.py" = [ "SLF001" ]
119
+ lint.per-file-ignores."experiments/model_benchmark/_budget.py" = [ "SLF001" ]
120
+ lint.per-file-ignores."experiments/model_benchmark/_claude.py" = [ "SLF001" ]
121
+ lint.per-file-ignores."experiments/model_benchmark/_cli.py" = [ "T201" ]
122
+ lint.per-file-ignores."experiments/model_benchmark/_codex.py" = [ "SLF001" ]
123
+ lint.per-file-ignores."experiments/model_benchmark/_interface_aggregation.py" = [ "SLF001" ]
124
+ lint.per-file-ignores."experiments/model_benchmark/_interface_gate.py" = [ "SLF001" ]
125
+ lint.per-file-ignores."experiments/model_benchmark/_interface_replay.py" = [ "SLF001" ]
126
+ lint.per-file-ignores."experiments/model_benchmark/_live.py" = [ "SLF001" ]
127
+ lint.per-file-ignores."experiments/model_benchmark/_realism.py" = [ "SLF001" ]
128
+ lint.per-file-ignores."experiments/model_benchmark/_report.py" = [ "SLF001" ]
129
+ lint.per-file-ignores."experiments/model_benchmark/_runner.py" = [ "SLF001" ]
130
+ lint.per-file-ignores."experiments/model_benchmark/_subprocess.py" = [ "SLF001" ]
131
+ lint.per-file-ignores."experiments/tests/**/*.py" = [
132
+ "D", # No docstrings required in tests
133
+ "PLR2004", # Allow magic values in tests
134
+ "S101", # Allow asserts in tests
135
+ "S603", # Allow subprocess calls in tests
136
+ "SLF001", # Tests intentionally inspect and patch private state
137
+ ]
138
+ # Fake-host CLI responses intentionally use stdout.
139
+ lint.per-file-ignores."experiments/tests/model_benchmark/fake_claude.py" = [ "T201" ]
140
+ lint.per-file-ignores."experiments/tests/model_benchmark/fake_codex.py" = [ "T201" ]
141
+ lint.per-file-ignores."scripts/diagnose_live_latency.py" = [ "T201" ]
142
+ lint.per-file-ignores."scripts/smoke_test_live.py" = [ "SLF001", "T201" ]
143
+ lint.per-file-ignores."src/sg_mcp_server/_audit.py" = [ "T201" ]
144
+ lint.per-file-ignores."src/sg_mcp_server/_diagnostics.py" = [ "T201" ]
145
+ lint.per-file-ignores."src/sg_mcp_server/_engine/_validation.py" = [ "SLF001" ]
146
+ lint.per-file-ignores."src/sg_mcp_server/_rendering.py" = [ "SLF001" ]
147
+ lint.per-file-ignores."tests/**/*.py" = [
148
+ "D", # No docstrings required in tests
149
+ "PLR2004", # Allow magic values in tests
150
+ "S101", # Allow asserts in tests
151
+ "S603", # Allow subprocess calls in tests
152
+ "S607", # Allow partial executable paths in tests
153
+ "SLF001", # Tests intentionally inspect and patch private state
154
+ ]
155
+ lint.pydocstyle.convention = "google"
156
+
157
+ [tool.pyproject-fmt]
158
+ max_supported_python = "3.15"
159
+
160
+ # ==========================================================
161
+ # Pyright Configuration
162
+ # ==========================================================
163
+ [tool.pyright]
164
+ pythonVersion = "3.11" # Keep in sync with tool.ruff.target-version
165
+ typeCheckingMode = "strict"
166
+ extraPaths = [ ".", "src" ]
167
+ executionEnvironments = [
168
+ { root = "tests/scripts", reportPrivateUsage = "none" },
169
+ { root = "tests", reportPrivateUsage = "none" },
170
+ { root = "experiments/tests", reportPrivateUsage = "none" },
171
+ { root = "." },
172
+ ]
173
+
174
+ # ==========================================================
175
+ # Pytest Configuration
176
+ # ==========================================================
177
+ [tool.pytest]
178
+ ini_options.testpaths = [ "tests" ]
179
+ ini_options.pythonpath = [ "src", "tests" ]
180
+ ini_options.addopts = [ "-q", "--strict-markers", "--tb=short" ]
181
+ ini_options.markers = [ "slow: marks tests as slow (deselect with '-m \"not slow\"')" ]
182
+ ini_options.faulthandler_timeout = 300
183
+
184
+ # ==========================================================
185
+ # Mdformat Configuration (Requires mdformat-pyproject)
186
+ # ==========================================================
187
+ [tool.mdformat]
188
+ wrap = 99 # Keep in sync with tool.ruff.line-length
189
+ number = true
@@ -0,0 +1,19 @@
1
+ """Provide the read-only MCP server for Flow Production Tracking.
2
+
3
+ Run `sg-mcp-server`, run `python -m sg_mcp_server`, or call `main()` to serve
4
+ the solo-mode tool surface over stdio in the foreground. `main()` parses
5
+ `sys.argv` unless given an argument list, accepts no arguments other than
6
+ `--help` and `--version`, and returns the process exit status. `--help` and
7
+ invalid arguments end in `SystemExit` from argument parsing; `--version`
8
+ returns 0 after printing the version.
9
+
10
+ Set `SG_MCP_SITE_URL`, `SG_MCP_SCRIPT_NAME`, and `SG_MCP_API_KEY` for the site
11
+ connection. Optional `SG_MCP_TIMEZONE`, `SG_MCP_AUDIT_PATH`,
12
+ `SG_MCP_DEFAULT_LIMIT`, `SG_MCP_HARD_LIMIT`, `SG_MCP_SCHEMA_TTL_SECONDS`,
13
+ `SG_MCP_TIMEOUT_SECONDS`, and `SG_MCP_DIAGNOSTICS_PATH` settings control
14
+ rendering, logging, query limits, the SG request timeout, and schema caching.
15
+ """
16
+
17
+ from sg_mcp_server._cli import main
18
+
19
+ __all__ = ['main']
@@ -0,0 +1,13 @@
1
+ """Serve the read-only solo-mode MCP tools over stdio.
2
+
3
+ Run `python -m sg_mcp_server` with `SG_MCP_SITE_URL`, `SG_MCP_SCRIPT_NAME`, and
4
+ `SG_MCP_API_KEY` set. The command uses the same optional environment settings
5
+ as `sg-mcp-server` and runs the server in the foreground.
6
+ """
7
+
8
+ import sys
9
+
10
+ from sg_mcp_server._cli import main
11
+
12
+ if __name__ == '__main__':
13
+ sys.exit(main())