|
639 | 639 | </span> |
640 | 640 | </a> |
641 | 641 |
|
| 642 | + <nav class="md-nav" aria-label="Quick install"> |
| 643 | + <ul class="md-nav__list"> |
| 644 | + |
| 645 | + <li class="md-nav__item"> |
| 646 | + <a href="#which-command-to-register-for-the-mcp-server" class="md-nav__link"> |
| 647 | + <span class="md-ellipsis"> |
| 648 | + <span class="md-typeset"> |
| 649 | + Which command to register for the MCP server |
| 650 | + </span> |
| 651 | + </span> |
| 652 | + </a> |
| 653 | + |
| 654 | +</li> |
| 655 | + |
| 656 | + </ul> |
| 657 | + </nav> |
| 658 | + |
642 | 659 | </li> |
643 | 660 |
|
644 | 661 | <li class="md-nav__item"> |
|
880 | 897 | </span> |
881 | 898 | </a> |
882 | 899 |
|
| 900 | + <nav class="md-nav" aria-label="Quick install"> |
| 901 | + <ul class="md-nav__list"> |
| 902 | + |
| 903 | + <li class="md-nav__item"> |
| 904 | + <a href="#which-command-to-register-for-the-mcp-server" class="md-nav__link"> |
| 905 | + <span class="md-ellipsis"> |
| 906 | + <span class="md-typeset"> |
| 907 | + Which command to register for the MCP server |
| 908 | + </span> |
| 909 | + </span> |
| 910 | + </a> |
| 911 | + |
| 912 | +</li> |
| 913 | + |
| 914 | + </ul> |
| 915 | + </nav> |
| 916 | + |
883 | 917 | </li> |
884 | 918 |
|
885 | 919 | <li class="md-nav__item"> |
@@ -1041,6 +1075,10 @@ <h1 id="mcp-server">MCP server<a class="headerlink" href="#mcp-server" title="Pe |
1041 | 1075 | introspect category schemas, read entities and every page slot, create/update |
1042 | 1076 | and delete entities, and read and write file pages as text. The transport is |
1043 | 1077 | stdio; SSE and HTTP are not supported.</p> |
| 1078 | +<p>A registered server runs the <code>osw-mcp</code> console script, and there are two ways to |
| 1079 | +reach it: let <code>uvx</code> fetch it for each server, or install <code>osw[mcp]</code> once and |
| 1080 | +register the command directly. See |
| 1081 | +<a href="#which-command-to-register-for-the-mcp-server">Which command to register for the MCP server</a>.</p> |
1044 | 1082 | <p><strong>No filesystem access:</strong> no MCP tool takes or returns a local path. File |
1045 | 1083 | content moves inline as text (<code>get_file_info</code>, <code>read_file_text</code>, |
1046 | 1084 | <code>write_file_text</code>), and everything path-based lives in the CLI instead |
@@ -1075,6 +1113,35 @@ <h2 id="quick-install">Quick install<a class="headerlink" href="#quick-install" |
1075 | 1113 | for every project, or <code>-s project</code> to write a shared <code>.mcp.json</code>.</li> |
1076 | 1114 | <li>List what is registered with <code>claude mcp list</code>.</li> |
1077 | 1115 | </ul> |
| 1116 | +<h3 id="which-command-to-register-for-the-mcp-server">Which command to register for the MCP server<a class="headerlink" href="#which-command-to-register-for-the-mcp-server" title="Permanent link">¶</a></h3> |
| 1117 | +<ul> |
| 1118 | +<li> |
| 1119 | +<p><strong>To pin the <code>osw</code> version per server, register the <code>uvx</code> command</strong>, as in the |
| 1120 | + example above and in every other example on this page. The package |
| 1121 | + specification is part of the entry, so one server can name a version or a |
| 1122 | + checkout that the others do not use. <code>uvx</code> needs no install of its own. The |
| 1123 | + cost is that changing the version means editing every entry that should |
| 1124 | + change. Note that <code>uvx</code> reuses an installed <code>osw</code> tool whenever that |
| 1125 | + installation satisfies the specification, so an unpinned <code>osw[mcp]</code> runs the |
| 1126 | + installed version if there is one. Write an explicit version, for example |
| 1127 | + <code>osw[mcp]==2.6.2</code>, when a server must be independent of it.</p> |
| 1128 | +</li> |
| 1129 | +<li> |
| 1130 | +<p><strong>To let all servers share one <code>osw</code> version, register the installed |
| 1131 | + <code>osw-mcp</code> command.</strong> Install <code>osw[mcp]</code> as a uv tool (<a href="../#setup">Setup</a>), |
| 1132 | + then register that command in place of the whole <code>uvx --from ...</code> invocation:</p> |
| 1133 | +<div class="highlight"><pre><span></span><code>claude<span class="w"> </span>mcp<span class="w"> </span>add<span class="w"> </span>osw-dev<span class="w"> </span><span class="se">\</span> |
| 1134 | +<span class="w"> </span>-e<span class="w"> </span><span class="nv">OSW_DOMAIN</span><span class="o">=</span>wiki-dev.open-semantic-lab.org<span class="w"> </span><span class="se">\</span> |
| 1135 | +<span class="w"> </span>-e<span class="w"> </span><span class="nv">OSW_CRED_FILEPATH</span><span class="o">=</span>/abs/path/to/accounts.pwd.yaml<span class="w"> </span><span class="se">\</span> |
| 1136 | +<span class="w"> </span>--<span class="w"> </span>osw-mcp |
| 1137 | +</code></pre></div> |
| 1138 | +<p>In JSON that entry is <code>"command": "osw-mcp"</code> with an empty <code>args</code> array. |
| 1139 | +<code>uv tool upgrade osw</code> then changes the version for every server at once. The |
| 1140 | +cost is that <code>osw-mcp</code> has to be on the PATH of the client, and that no |
| 1141 | +server can keep an older version.</p> |
| 1142 | +</li> |
| 1143 | +</ul> |
| 1144 | +<p>Everything else about an entry, <code>env</code> included, is the same either way.</p> |
1078 | 1145 | <h2 id="registering-a-server">Registering a server<a class="headerlink" href="#registering-a-server" title="Permanent link">¶</a></h2> |
1079 | 1146 | <p>A server entry can carry its settings in two ways:</p> |
1080 | 1147 | <ul> |
@@ -1178,20 +1245,45 @@ <h2 id="design-notes">Design notes<a class="headerlink" href="#design-notes" tit |
1178 | 1245 | needs, so only users who actually run the server pay for it.</li> |
1179 | 1246 | </ul> |
1180 | 1247 | <h2 id="notes-for-developers">Notes for developers<a class="headerlink" href="#notes-for-developers" title="Permanent link">¶</a></h2> |
1181 | | -<p>To try an unreleased branch against a real client, point <code>uvx</code> at the checkout |
1182 | | -instead of at PyPI. Everything else about the registration stays the same:</p> |
| 1248 | +<p>To try an unreleased branch against a real client, run it from the checkout. The |
| 1249 | +same two options apply as above.</p> |
| 1250 | +<p>Point <code>uvx</code> at the checkout instead of at PyPI. Everything else about the |
| 1251 | +registration stays the same:</p> |
1183 | 1252 | <div class="highlight"><pre><span></span><code>uvx<span class="w"> </span>--reinstall<span class="w"> </span>--from<span class="w"> </span><span class="s2">"/abs/path/to/osw-python[mcp]"</span><span class="w"> </span>osw-mcp |
1184 | 1253 | </code></pre></div> |
1185 | | -<p><code>--reinstall</code> is what picks up your latest edits, since <code>uvx</code> caches the wheel |
1186 | | -it builds. In a JSON <code>args</code> array, a Windows path needs forward slashes or |
| 1254 | +<p><code>--reinstall</code> is what makes <code>uvx</code> use your latest edits, since it caches the |
| 1255 | +wheel it builds. In a JSON <code>args</code> array, a Windows path needs forward slashes or |
1187 | 1256 | doubled backslashes.</p> |
1188 | | -<p>Prefer that over an editable install for the server. <code>create_or_update_entity</code> |
1189 | | -and <code>export_entity_jsonld</code> call <code>fetch_schema</code>, which regenerates |
1190 | | -<code>src/osw/model/entity.py</code> inside the installed package: <code>uvx</code> builds a |
1191 | | -non-editable wheel, so the write lands in the uv cache, while under |
1192 | | -<code>pip install -e</code> or <code>uv sync</code> it lands in your working tree. The read tools |
| 1257 | +<p>Or install the checkout as an editable uv tool. The server then registers as |
| 1258 | +plain <code>osw-mcp</code>, no client config contains the checkout path, and edits take |
| 1259 | +effect at the next server start without a reinstall:</p> |
| 1260 | +<div class="highlight"><pre><span></span><code><span class="nb">cd</span><span class="w"> </span>/path/to/osw-python |
| 1261 | +uv<span class="w"> </span>tool<span class="w"> </span>install<span class="w"> </span>--reinstall<span class="w"> </span>--editable<span class="w"> </span><span class="s2">".[mcp]"</span> |
| 1262 | +</code></pre></div> |
| 1263 | +<p><code>osw</code> and <code>osw-mcp</code> then import from <code>src/</code> in that checkout. Four consequences:</p> |
| 1264 | +<ul> |
| 1265 | +<li>Both commands follow the checked-out branch, so switching branches changes |
| 1266 | + what a registered server runs.</li> |
| 1267 | +<li>Run the install command again after a change to <code>pyproject.toml</code>. uv |
| 1268 | + re-resolves from the checkout and installs the difference.</li> |
| 1269 | +<li>Returning to a released version needs <code>--reinstall</code>. Without it uv finds the |
| 1270 | + requirement satisfied, keeps the editable environment and rewrites only the |
| 1271 | + tool receipt, so receipt and environment disagree.</li> |
| 1272 | +<li>On Windows, an install that has to replace the tool environment fails with |
| 1273 | + <code>os error 5</code> while an <code>osw-mcp</code> server from it is running, because the running |
| 1274 | + process locks the tool's <code>Scripts</code> directory. Stop the MCP clients first.</li> |
| 1275 | +</ul> |
| 1276 | +<p>One difference decides between <code>uvx</code> and the editable install. |
| 1277 | +<code>create_or_update_entity</code> and |
| 1278 | +<code>export_entity_jsonld</code> call <code>fetch_schema</code>, which regenerates |
| 1279 | +<code>src/osw/model/entity.py</code> inside the installed package. <code>uvx</code> builds a |
| 1280 | +non-editable wheel, so the regenerated file is written into the uv cache. Under |
| 1281 | +an editable install, as under <code>pip install -e</code> or <code>uv sync</code>, it is written into |
| 1282 | +your working tree, where git tracks it. Note that <code>export_entity_jsonld</code> is |
| 1283 | +declared read-only and still triggers this. The remaining read tools |
1193 | 1284 | (<code>get_entity</code>, <code>get_slot</code>, <code>get_category_schema</code>, ...) read raw page slots and |
1194 | | -never trigger it.</p> |
| 1285 | +never trigger it. So choose <code>uvx</code> whenever a client may call either of those two |
| 1286 | +operations, and the editable install otherwise.</p> |
1195 | 1287 |
|
1196 | 1288 |
|
1197 | 1289 |
|
|
0 commit comments