nodus-mcp 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.
- nodus_mcp-0.1.0/LICENSE +21 -0
- nodus_mcp-0.1.0/PKG-INFO +189 -0
- nodus_mcp-0.1.0/README.md +142 -0
- nodus_mcp-0.1.0/pyproject.toml +45 -0
- nodus_mcp-0.1.0/setup.cfg +4 -0
- nodus_mcp-0.1.0/src/nodus_mcp/__init__.py +121 -0
- nodus_mcp-0.1.0/src/nodus_mcp/cli.py +188 -0
- nodus_mcp-0.1.0/src/nodus_mcp/client.py +632 -0
- nodus_mcp-0.1.0/src/nodus_mcp/codec.py +99 -0
- nodus_mcp-0.1.0/src/nodus_mcp/connection.py +106 -0
- nodus_mcp-0.1.0/src/nodus_mcp/http.py +126 -0
- nodus_mcp-0.1.0/src/nodus_mcp/nd/index.nd +4 -0
- nodus_mcp-0.1.0/src/nodus_mcp/nd.py +13 -0
- nodus_mcp-0.1.0/src/nodus_mcp/protocol/__init__.py +91 -0
- nodus_mcp-0.1.0/src/nodus_mcp/protocol/jsonrpc.py +66 -0
- nodus_mcp-0.1.0/src/nodus_mcp/protocol/messages.py +441 -0
- nodus_mcp-0.1.0/src/nodus_mcp/server.py +677 -0
- nodus_mcp-0.1.0/src/nodus_mcp/server_transport.py +203 -0
- nodus_mcp-0.1.0/src/nodus_mcp/stdio.py +339 -0
- nodus_mcp-0.1.0/src/nodus_mcp/transport.py +80 -0
- nodus_mcp-0.1.0/src/nodus_mcp.egg-info/PKG-INFO +189 -0
- nodus_mcp-0.1.0/src/nodus_mcp.egg-info/SOURCES.txt +42 -0
- nodus_mcp-0.1.0/src/nodus_mcp.egg-info/dependency_links.txt +1 -0
- nodus_mcp-0.1.0/src/nodus_mcp.egg-info/entry_points.txt +5 -0
- nodus_mcp-0.1.0/src/nodus_mcp.egg-info/requires.txt +2 -0
- nodus_mcp-0.1.0/src/nodus_mcp.egg-info/top_level.txt +1 -0
- nodus_mcp-0.1.0/tests/test_adapters.py +153 -0
- nodus_mcp-0.1.0/tests/test_install_roundtrip.py +108 -0
- nodus_mcp-0.1.0/tests/test_invariants.py +166 -0
- nodus_mcp-0.1.0/tests/test_naming.py +102 -0
- nodus_mcp-0.1.0/tests/test_phase_a.py +456 -0
- nodus_mcp-0.1.0/tests/test_phase_b.py +446 -0
- nodus_mcp-0.1.0/tests/test_phase_c.py +530 -0
- nodus_mcp-0.1.0/tests/test_phase_de.py +450 -0
- nodus_mcp-0.1.0/tests/test_phase_f.py +456 -0
- nodus_mcp-0.1.0/tests/test_phase_g.py +414 -0
- nodus_mcp-0.1.0/tests/test_phase_h.py +349 -0
- nodus_mcp-0.1.0/tests/test_phase_i.py +360 -0
- nodus_mcp-0.1.0/tests/test_phase_jk.py +435 -0
- nodus_mcp-0.1.0/tests/test_phase_l.py +443 -0
- nodus_mcp-0.1.0/tests/test_phase_m.py +541 -0
- nodus_mcp-0.1.0/tests/test_schema.py +129 -0
- nodus_mcp-0.1.0/tests/test_server.py +172 -0
- nodus_mcp-0.1.0/tests/test_tool.py +130 -0
nodus_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Masterplanner25
|
|
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.
|
nodus_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nodus-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP (Model Context Protocol) library for Nodus — bidirectional client + server
|
|
5
|
+
Author: Shawn Knight
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Masterplanner25
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Masterplanner25/nodus-mcp
|
|
29
|
+
Project-URL: Repository, https://github.com/Masterplanner25/nodus-mcp
|
|
30
|
+
Project-URL: Changelog, https://github.com/Masterplanner25/nodus-mcp/blob/main/CHANGELOG.md
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
39
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
40
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
41
|
+
Requires-Python: >=3.10
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: nodus-lang<5.0.0,>=4.0.0
|
|
45
|
+
Requires-Dist: httpx>=0.24.0
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# nodus-mcp
|
|
49
|
+
|
|
50
|
+
Model Context Protocol (MCP) library for [Nodus](https://github.com/Masterplanner25/Nodus)
|
|
51
|
+
— bidirectional client and server, implementing the 2026-07-28 RC specification.
|
|
52
|
+
|
|
53
|
+
**Status: v0.1.0 prepared, not yet published.** Waiting for the coordinated launch
|
|
54
|
+
with nodus-lang 4.0.0 and nodus-a2a v0.1.0. Two of three artifacts are ready.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Authentication warning
|
|
59
|
+
|
|
60
|
+
**v0.1 does not support OAuth 2.0.** Only bearer-token authentication is implemented.
|
|
61
|
+
Servers that require OAuth 2.0 / OIDC authentication (including many production MCP
|
|
62
|
+
deployments) cannot be used with nodus-mcp v0.1. OAuth support is planned for v0.2.
|
|
63
|
+
|
|
64
|
+
To connect to a server with a bearer token:
|
|
65
|
+
```python
|
|
66
|
+
from nodus_mcp import HttpTransport, McpClient
|
|
67
|
+
|
|
68
|
+
client = McpClient()
|
|
69
|
+
transport = HttpTransport("https://server/mcp", bearer_token="sk-...")
|
|
70
|
+
conn = client.connect(transport, alias="srv")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Once nodus-lang 4.0.0 is on PyPI:
|
|
79
|
+
pip install nodus-mcp
|
|
80
|
+
|
|
81
|
+
# Development install (both repos checked out):
|
|
82
|
+
pip install -e . --no-deps
|
|
83
|
+
# Set PYTHONPATH to nodus-lang source:
|
|
84
|
+
# PYTHONPATH="path/to/nodus-lang/src" python ...
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Quick start
|
|
90
|
+
|
|
91
|
+
### Run an MCP server
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Spawned-child stdio mode (parent process connects to our stdin/stdout)
|
|
95
|
+
nodus-mcp serve --stdio
|
|
96
|
+
|
|
97
|
+
# HTTP mode
|
|
98
|
+
nodus-mcp serve --http --port 8080 --bearer-token my-api-key
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
To expose tools, use the Python API before serving:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from nodus_mcp import McpServer, HttpServerTransport
|
|
105
|
+
|
|
106
|
+
server = McpServer()
|
|
107
|
+
server.set_resource_list_handler(lambda: [
|
|
108
|
+
{"uri": "file:///data", "name": "Data Directory"}
|
|
109
|
+
])
|
|
110
|
+
|
|
111
|
+
transport = HttpServerTransport("localhost", 8080)
|
|
112
|
+
transport.serve(server.dispatch)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Connect to a server
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
nodus-mcp connect http://localhost:8080 --bearer-token my-api-key
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Interactive REPL:
|
|
122
|
+
```
|
|
123
|
+
Connected. Server: my-server 1.0. Tools: 3. Type 'help' for commands.
|
|
124
|
+
mcp> list
|
|
125
|
+
my.tool — Does something useful
|
|
126
|
+
mcp> call my.tool {"x": 42}
|
|
127
|
+
{"content": [{"type": "text", "text": "done"}]}
|
|
128
|
+
mcp> quit
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Use from a Nodus script
|
|
132
|
+
|
|
133
|
+
```nodus
|
|
134
|
+
import "nodus-mcp"
|
|
135
|
+
|
|
136
|
+
// Discover and call tools (requires McpClient.connect() in host Python code)
|
|
137
|
+
let result = tool.invoke("mcp.srv.my_tool", {x: 42})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Entry-point contract
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
# nodus-mcp registers itself in the nodus.nd entry-point group:
|
|
146
|
+
# nodus-mcp = "nodus_mcp.nd:get_nd_root"
|
|
147
|
+
#
|
|
148
|
+
# After pip install nodus-mcp, any Nodus script can:
|
|
149
|
+
# import "nodus-mcp"
|
|
150
|
+
# and get the adapter module without additional configuration.
|
|
151
|
+
# See docs/guide/library-entry-points.md in nodus-lang for the contract.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Deprecated features (Roots + Sampling)
|
|
157
|
+
|
|
158
|
+
nodus-mcp v0.1 includes Roots and Sampling despite their deprecation in the
|
|
159
|
+
2026-07-28 RC, because existing MCP servers in the ecosystem use them (real
|
|
160
|
+
interop need) and the RC's 12-month deprecation window extends to at least
|
|
161
|
+
2027-07-28.
|
|
162
|
+
|
|
163
|
+
**Do not remove Roots or Sampling before:**
|
|
164
|
+
1. The protocol has actually removed them, AND
|
|
165
|
+
2. nodus-mcp has shipped a replacement
|
|
166
|
+
|
|
167
|
+
The removal gate is 2027-07-28 at the earliest. See `docs/governance/TECH_DEBT.md`
|
|
168
|
+
(TD-001, TD-002) and `docs/design/05-deprecated-features.md §C1`.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Known limitations
|
|
173
|
+
|
|
174
|
+
| Limitation | Details |
|
|
175
|
+
|---|---|
|
|
176
|
+
| No OAuth support | Bearer token only; see auth warning above |
|
|
177
|
+
| `resources/subscribe` not implemented | Server-push deferred to v0.2 |
|
|
178
|
+
| Server-initiated requests (HTTP) | `roots/list`, `sampling/createMessage`, `elicitation/create` are stdio-only; HTTP has no push channel (TD-007) |
|
|
179
|
+
| Partial JSON Schema validation | `_validate_args` checks required fields and primitive types; `enum`, `pattern`, `minLength` etc. are not enforced server-side (TD-008) |
|
|
180
|
+
| Resource handler `KeyError` convention | Resource read handlers must raise `KeyError(uri)` for unknown URIs (TD-009) |
|
|
181
|
+
| `requestState` is on the wire | Server-issued elicitation state travels to the client; never checkpoint secrets (TD-010) |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Spec target
|
|
186
|
+
|
|
187
|
+
[2026-07-28 RC](https://spec.modelcontextprotocol.io/) — stateless (no session
|
|
188
|
+
initialization handshake, no `Mcp-Session-Id`). Capabilities travel in `_meta`
|
|
189
|
+
per-request. `server/discover` replaces capability exchange.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# nodus-mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) library for [Nodus](https://github.com/Masterplanner25/Nodus)
|
|
4
|
+
— bidirectional client and server, implementing the 2026-07-28 RC specification.
|
|
5
|
+
|
|
6
|
+
**Status: v0.1.0 prepared, not yet published.** Waiting for the coordinated launch
|
|
7
|
+
with nodus-lang 4.0.0 and nodus-a2a v0.1.0. Two of three artifacts are ready.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Authentication warning
|
|
12
|
+
|
|
13
|
+
**v0.1 does not support OAuth 2.0.** Only bearer-token authentication is implemented.
|
|
14
|
+
Servers that require OAuth 2.0 / OIDC authentication (including many production MCP
|
|
15
|
+
deployments) cannot be used with nodus-mcp v0.1. OAuth support is planned for v0.2.
|
|
16
|
+
|
|
17
|
+
To connect to a server with a bearer token:
|
|
18
|
+
```python
|
|
19
|
+
from nodus_mcp import HttpTransport, McpClient
|
|
20
|
+
|
|
21
|
+
client = McpClient()
|
|
22
|
+
transport = HttpTransport("https://server/mcp", bearer_token="sk-...")
|
|
23
|
+
conn = client.connect(transport, alias="srv")
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Once nodus-lang 4.0.0 is on PyPI:
|
|
32
|
+
pip install nodus-mcp
|
|
33
|
+
|
|
34
|
+
# Development install (both repos checked out):
|
|
35
|
+
pip install -e . --no-deps
|
|
36
|
+
# Set PYTHONPATH to nodus-lang source:
|
|
37
|
+
# PYTHONPATH="path/to/nodus-lang/src" python ...
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
### Run an MCP server
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Spawned-child stdio mode (parent process connects to our stdin/stdout)
|
|
48
|
+
nodus-mcp serve --stdio
|
|
49
|
+
|
|
50
|
+
# HTTP mode
|
|
51
|
+
nodus-mcp serve --http --port 8080 --bearer-token my-api-key
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
To expose tools, use the Python API before serving:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from nodus_mcp import McpServer, HttpServerTransport
|
|
58
|
+
|
|
59
|
+
server = McpServer()
|
|
60
|
+
server.set_resource_list_handler(lambda: [
|
|
61
|
+
{"uri": "file:///data", "name": "Data Directory"}
|
|
62
|
+
])
|
|
63
|
+
|
|
64
|
+
transport = HttpServerTransport("localhost", 8080)
|
|
65
|
+
transport.serve(server.dispatch)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Connect to a server
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
nodus-mcp connect http://localhost:8080 --bearer-token my-api-key
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Interactive REPL:
|
|
75
|
+
```
|
|
76
|
+
Connected. Server: my-server 1.0. Tools: 3. Type 'help' for commands.
|
|
77
|
+
mcp> list
|
|
78
|
+
my.tool — Does something useful
|
|
79
|
+
mcp> call my.tool {"x": 42}
|
|
80
|
+
{"content": [{"type": "text", "text": "done"}]}
|
|
81
|
+
mcp> quit
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Use from a Nodus script
|
|
85
|
+
|
|
86
|
+
```nodus
|
|
87
|
+
import "nodus-mcp"
|
|
88
|
+
|
|
89
|
+
// Discover and call tools (requires McpClient.connect() in host Python code)
|
|
90
|
+
let result = tool.invoke("mcp.srv.my_tool", {x: 42})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Entry-point contract
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
# nodus-mcp registers itself in the nodus.nd entry-point group:
|
|
99
|
+
# nodus-mcp = "nodus_mcp.nd:get_nd_root"
|
|
100
|
+
#
|
|
101
|
+
# After pip install nodus-mcp, any Nodus script can:
|
|
102
|
+
# import "nodus-mcp"
|
|
103
|
+
# and get the adapter module without additional configuration.
|
|
104
|
+
# See docs/guide/library-entry-points.md in nodus-lang for the contract.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Deprecated features (Roots + Sampling)
|
|
110
|
+
|
|
111
|
+
nodus-mcp v0.1 includes Roots and Sampling despite their deprecation in the
|
|
112
|
+
2026-07-28 RC, because existing MCP servers in the ecosystem use them (real
|
|
113
|
+
interop need) and the RC's 12-month deprecation window extends to at least
|
|
114
|
+
2027-07-28.
|
|
115
|
+
|
|
116
|
+
**Do not remove Roots or Sampling before:**
|
|
117
|
+
1. The protocol has actually removed them, AND
|
|
118
|
+
2. nodus-mcp has shipped a replacement
|
|
119
|
+
|
|
120
|
+
The removal gate is 2027-07-28 at the earliest. See `docs/governance/TECH_DEBT.md`
|
|
121
|
+
(TD-001, TD-002) and `docs/design/05-deprecated-features.md §C1`.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Known limitations
|
|
126
|
+
|
|
127
|
+
| Limitation | Details |
|
|
128
|
+
|---|---|
|
|
129
|
+
| No OAuth support | Bearer token only; see auth warning above |
|
|
130
|
+
| `resources/subscribe` not implemented | Server-push deferred to v0.2 |
|
|
131
|
+
| Server-initiated requests (HTTP) | `roots/list`, `sampling/createMessage`, `elicitation/create` are stdio-only; HTTP has no push channel (TD-007) |
|
|
132
|
+
| Partial JSON Schema validation | `_validate_args` checks required fields and primitive types; `enum`, `pattern`, `minLength` etc. are not enforced server-side (TD-008) |
|
|
133
|
+
| Resource handler `KeyError` convention | Resource read handlers must raise `KeyError(uri)` for unknown URIs (TD-009) |
|
|
134
|
+
| `requestState` is on the wire | Server-issued elicitation state travels to the client; never checkpoint secrets (TD-010) |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Spec target
|
|
139
|
+
|
|
140
|
+
[2026-07-28 RC](https://spec.modelcontextprotocol.io/) — stateless (no session
|
|
141
|
+
initialization handshake, no `Mcp-Session-Id`). Capabilities travel in `_meta`
|
|
142
|
+
per-request. `server/discover` replaces capability exchange.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nodus-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP (Model Context Protocol) library for Nodus — bidirectional client + server"
|
|
9
|
+
authors = [{ name = "Shawn Knight" }]
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
23
|
+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"nodus-lang>=4.0.0,<5.0.0",
|
|
27
|
+
"httpx>=0.24.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
nodus-mcp = "nodus_mcp.cli:main"
|
|
32
|
+
|
|
33
|
+
[project.entry-points."nodus.nd"]
|
|
34
|
+
nodus-mcp = "nodus_mcp.nd:get_nd_root"
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/Masterplanner25/nodus-mcp"
|
|
38
|
+
Repository = "https://github.com/Masterplanner25/nodus-mcp"
|
|
39
|
+
Changelog = "https://github.com/Masterplanner25/nodus-mcp/blob/main/CHANGELOG.md"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
nodus_mcp = ["nd/*.nd"]
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""nodus-mcp — MCP (Model Context Protocol) library for Nodus.
|
|
2
|
+
|
|
3
|
+
Phase A foundation exports: wire types, codec, transport ABCs, connection handle.
|
|
4
|
+
"""
|
|
5
|
+
__version__ = "0.1.0"
|
|
6
|
+
|
|
7
|
+
from .protocol import (
|
|
8
|
+
# JSON-RPC error codes (doc 1 D-table — reference constants, not literals)
|
|
9
|
+
METHOD_NOT_FOUND,
|
|
10
|
+
INVALID_PARAMS,
|
|
11
|
+
INTERNAL_ERROR,
|
|
12
|
+
# JSON-RPC types
|
|
13
|
+
JsonRpcRequest,
|
|
14
|
+
JsonRpcNotification,
|
|
15
|
+
JsonRpcError,
|
|
16
|
+
JsonRpcResponse,
|
|
17
|
+
next_request_id,
|
|
18
|
+
# MCP method names
|
|
19
|
+
METHOD_TOOLS_CALL,
|
|
20
|
+
METHOD_TOOLS_LIST,
|
|
21
|
+
METHOD_SERVER_DISCOVER,
|
|
22
|
+
METHOD_ROOTS_LIST,
|
|
23
|
+
METHOD_SAMPLING_CREATE_MESSAGE,
|
|
24
|
+
# Error category enum (closed set)
|
|
25
|
+
ToolErrorCategory,
|
|
26
|
+
# Wire message types
|
|
27
|
+
RequestMeta,
|
|
28
|
+
ToolDefinition,
|
|
29
|
+
ToolContent,
|
|
30
|
+
ToolCallResult,
|
|
31
|
+
InputRequiredResult,
|
|
32
|
+
SamplingRequiredResult,
|
|
33
|
+
RootsRequiredResult,
|
|
34
|
+
# Server-side re-call sentinels (doc 4 C2, doc 5 A2/B2)
|
|
35
|
+
ElicitationRequest,
|
|
36
|
+
SamplingRequest,
|
|
37
|
+
RootsRequest,
|
|
38
|
+
# Phase D — resource types
|
|
39
|
+
METHOD_RESOURCES_LIST,
|
|
40
|
+
METHOD_RESOURCES_READ,
|
|
41
|
+
ResourceDescriptor,
|
|
42
|
+
ResourceContent,
|
|
43
|
+
# Phase E — prompt types
|
|
44
|
+
METHOD_PROMPTS_LIST,
|
|
45
|
+
METHOD_PROMPTS_GET,
|
|
46
|
+
PromptArgument,
|
|
47
|
+
PromptDescriptor,
|
|
48
|
+
PromptMessageContent,
|
|
49
|
+
PromptMessage,
|
|
50
|
+
)
|
|
51
|
+
from .codec import McpCodec
|
|
52
|
+
from .transport import McpTransport, McpServerTransport, TransportError
|
|
53
|
+
from .connection import McpConnection, ActiveElicitationRegistry, TEARDOWN_SENTINEL
|
|
54
|
+
from .stdio import StdioTransport
|
|
55
|
+
from .http import HttpTransport
|
|
56
|
+
from .client import McpClient
|
|
57
|
+
from .server import McpServer
|
|
58
|
+
from .server_transport import StdioServerTransport, HttpServerTransport
|
|
59
|
+
|
|
60
|
+
__all__ = [
|
|
61
|
+
"__version__",
|
|
62
|
+
# JSON-RPC
|
|
63
|
+
"METHOD_NOT_FOUND",
|
|
64
|
+
"INVALID_PARAMS",
|
|
65
|
+
"INTERNAL_ERROR",
|
|
66
|
+
"JsonRpcRequest",
|
|
67
|
+
"JsonRpcNotification",
|
|
68
|
+
"JsonRpcError",
|
|
69
|
+
"JsonRpcResponse",
|
|
70
|
+
"next_request_id",
|
|
71
|
+
# MCP methods
|
|
72
|
+
"METHOD_TOOLS_CALL",
|
|
73
|
+
"METHOD_TOOLS_LIST",
|
|
74
|
+
"METHOD_SERVER_DISCOVER",
|
|
75
|
+
"METHOD_ROOTS_LIST",
|
|
76
|
+
"METHOD_SAMPLING_CREATE_MESSAGE",
|
|
77
|
+
# Error categories
|
|
78
|
+
"ToolErrorCategory",
|
|
79
|
+
# Wire types
|
|
80
|
+
"RequestMeta",
|
|
81
|
+
"ToolDefinition",
|
|
82
|
+
"ToolContent",
|
|
83
|
+
"ToolCallResult",
|
|
84
|
+
"InputRequiredResult",
|
|
85
|
+
"SamplingRequiredResult",
|
|
86
|
+
"RootsRequiredResult",
|
|
87
|
+
# Sentinels
|
|
88
|
+
"ElicitationRequest",
|
|
89
|
+
"SamplingRequest",
|
|
90
|
+
"RootsRequest",
|
|
91
|
+
# Codec + transport
|
|
92
|
+
"McpCodec",
|
|
93
|
+
"McpTransport",
|
|
94
|
+
"McpServerTransport",
|
|
95
|
+
"TransportError",
|
|
96
|
+
# Connection
|
|
97
|
+
"McpConnection",
|
|
98
|
+
"ActiveElicitationRegistry",
|
|
99
|
+
"TEARDOWN_SENTINEL",
|
|
100
|
+
# Transports
|
|
101
|
+
"StdioTransport",
|
|
102
|
+
"HttpTransport",
|
|
103
|
+
# Client + Server
|
|
104
|
+
"McpClient",
|
|
105
|
+
"McpServer",
|
|
106
|
+
# Server transports (Phase M)
|
|
107
|
+
"StdioServerTransport",
|
|
108
|
+
"HttpServerTransport",
|
|
109
|
+
# Resources (Phase D)
|
|
110
|
+
"METHOD_RESOURCES_LIST",
|
|
111
|
+
"METHOD_RESOURCES_READ",
|
|
112
|
+
"ResourceDescriptor",
|
|
113
|
+
"ResourceContent",
|
|
114
|
+
# Prompts (Phase E)
|
|
115
|
+
"METHOD_PROMPTS_LIST",
|
|
116
|
+
"METHOD_PROMPTS_GET",
|
|
117
|
+
"PromptArgument",
|
|
118
|
+
"PromptDescriptor",
|
|
119
|
+
"PromptMessageContent",
|
|
120
|
+
"PromptMessage",
|
|
121
|
+
]
|