nanocode-cli 0.5.12__tar.gz → 0.6.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nanocode-cli
3
- Version: 0.5.12
3
+ Version: 0.6.2
4
4
  Summary: A small terminal coding agent written in Python
5
5
  Author-email: hit9 <hit9@icloud.com>
6
6
  License-Expression: BSD-3-Clause
@@ -24,6 +24,7 @@ License-File: LICENSE
24
24
  Requires-Dist: anthropic>=0.64.0
25
25
  Requires-Dist: code-symbol-index>=0.3.0
26
26
  Requires-Dist: json-repair
27
+ Requires-Dist: fastmcp<4,>=3
27
28
  Requires-Dist: openai>=2.37.0
28
29
  Requires-Dist: prompt-toolkit>=3.0
29
30
  Requires-Dist: rich>=13.0
@@ -54,6 +55,7 @@ nanocode is pre-1.0 software. Commands, configuration, and tool behavior may cha
54
55
  - **Recoverable context**: Tool output stays bounded in the prompt, while raw `tr.N` results remain recallable.
55
56
  - **Cache-aware context**: Stable sections stay early and noisy working state stays late to improve prompt-cache reuse.
56
57
  - **Focused working memory**: `Note` separates goal, plan, and known facts from noisy execution logs.
58
+ - **MCP integration**: Connect to remote (HTTP) or local (stdio) Model Context Protocol servers and call their tools.
57
59
  - **Terminal-first workflow**: Model selection, history search, confirmations, live command output, appended input, and status all stay in one CLI.
58
60
 
59
61
  ## Install
@@ -101,6 +103,7 @@ During a running turn, the `+>` prompt accepts follow-up input for the next mode
101
103
  - `/debug [on|off]`: toggle model I/O debug traces.
102
104
  - `/compact`: compact context now.
103
105
  - `/index [force]`: sync or rebuild the code symbol index.
106
+ - `/mcp [tools|login|logout|refresh] ...`: manage MCP servers and tools.
104
107
  - `/provider [NAME]`: show or set provider.
105
108
  - `/model [MODEL]`: show or set model.
106
109
  - `/reason`: choose reasoning effort.
@@ -118,6 +121,7 @@ Interactive selectors support `j`/`k`, arrows, `/` search, Enter, and Esc. Input
118
121
  - Shell: `Bash`, `Git`.
119
122
  - Tool results: `Recall`.
120
123
  - Working notes: `Note`.
124
+ - MCP: `MCP` calls tools on configured MCP servers.
121
125
 
122
126
  `Read`, `Search`, and `InspectCode` return line anchors where useful. `Edit` uses current `line:hash` anchors to reject stale edits.
123
127
 
@@ -140,6 +144,42 @@ Main fields:
140
144
 
141
145
  `api = "auto"` chooses between Chat Completions and Anthropic Messages using provider/model profiles. `prompt_cache_key = "auto"` derives a stable key from provider, model, workspace, and tool schema names.
142
146
 
147
+ ## MCP
148
+
149
+ nanocode connects to [Model Context Protocol](https://modelcontextprotocol.io) servers and exposes their tools through the `MCP` tool. Configure each server under `[mcp.<name>]`. A server is either `url` (remote) or `command` (local), never both.
150
+
151
+ Remote server over streamable HTTP:
152
+
153
+ ```toml
154
+ [mcp.example]
155
+ url = "https://example.com/mcp"
156
+ bearer_token_env_var = "EXAMPLE_MCP_TOKEN" # optional; sends Authorization: Bearer
157
+ enabled = true
158
+
159
+ [mcp.oauth_example]
160
+ url = "https://example.com/mcp"
161
+ auth = "oauth" # browser login via /mcp login <server>
162
+ enabled = true
163
+ ```
164
+
165
+ Local server over stdio (launched as a subprocess):
166
+
167
+ ```toml
168
+ [mcp.filesystem]
169
+ command = "npx"
170
+ args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
171
+ env = { SOME_TOKEN = "value" } # optional; merged over the inherited environment
172
+ enabled = true
173
+ ```
174
+
175
+ The HTTP auth options (`auth`, `bearer_token_env_var`, `env_http_headers`) apply to `url` servers only. `env_http_headers` maps a header name to the environment variable holding its value.
176
+
177
+ Manage servers at runtime:
178
+
179
+ - `/mcp`: list configured servers and connection status.
180
+ - `/mcp tools [server]`: list discovered tools.
181
+ - `/mcp refresh [server]`: rediscover servers.
182
+ - `/mcp login <server>` / `/mcp logout <server>`: OAuth login and logout.
143
183
 
144
184
  ## Tested Providers
145
185
 
@@ -19,6 +19,7 @@ nanocode is pre-1.0 software. Commands, configuration, and tool behavior may cha
19
19
  - **Recoverable context**: Tool output stays bounded in the prompt, while raw `tr.N` results remain recallable.
20
20
  - **Cache-aware context**: Stable sections stay early and noisy working state stays late to improve prompt-cache reuse.
21
21
  - **Focused working memory**: `Note` separates goal, plan, and known facts from noisy execution logs.
22
+ - **MCP integration**: Connect to remote (HTTP) or local (stdio) Model Context Protocol servers and call their tools.
22
23
  - **Terminal-first workflow**: Model selection, history search, confirmations, live command output, appended input, and status all stay in one CLI.
23
24
 
24
25
  ## Install
@@ -66,6 +67,7 @@ During a running turn, the `+>` prompt accepts follow-up input for the next mode
66
67
  - `/debug [on|off]`: toggle model I/O debug traces.
67
68
  - `/compact`: compact context now.
68
69
  - `/index [force]`: sync or rebuild the code symbol index.
70
+ - `/mcp [tools|login|logout|refresh] ...`: manage MCP servers and tools.
69
71
  - `/provider [NAME]`: show or set provider.
70
72
  - `/model [MODEL]`: show or set model.
71
73
  - `/reason`: choose reasoning effort.
@@ -83,6 +85,7 @@ Interactive selectors support `j`/`k`, arrows, `/` search, Enter, and Esc. Input
83
85
  - Shell: `Bash`, `Git`.
84
86
  - Tool results: `Recall`.
85
87
  - Working notes: `Note`.
88
+ - MCP: `MCP` calls tools on configured MCP servers.
86
89
 
87
90
  `Read`, `Search`, and `InspectCode` return line anchors where useful. `Edit` uses current `line:hash` anchors to reject stale edits.
88
91
 
@@ -105,6 +108,42 @@ Main fields:
105
108
 
106
109
  `api = "auto"` chooses between Chat Completions and Anthropic Messages using provider/model profiles. `prompt_cache_key = "auto"` derives a stable key from provider, model, workspace, and tool schema names.
107
110
 
111
+ ## MCP
112
+
113
+ nanocode connects to [Model Context Protocol](https://modelcontextprotocol.io) servers and exposes their tools through the `MCP` tool. Configure each server under `[mcp.<name>]`. A server is either `url` (remote) or `command` (local), never both.
114
+
115
+ Remote server over streamable HTTP:
116
+
117
+ ```toml
118
+ [mcp.example]
119
+ url = "https://example.com/mcp"
120
+ bearer_token_env_var = "EXAMPLE_MCP_TOKEN" # optional; sends Authorization: Bearer
121
+ enabled = true
122
+
123
+ [mcp.oauth_example]
124
+ url = "https://example.com/mcp"
125
+ auth = "oauth" # browser login via /mcp login <server>
126
+ enabled = true
127
+ ```
128
+
129
+ Local server over stdio (launched as a subprocess):
130
+
131
+ ```toml
132
+ [mcp.filesystem]
133
+ command = "npx"
134
+ args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
135
+ env = { SOME_TOKEN = "value" } # optional; merged over the inherited environment
136
+ enabled = true
137
+ ```
138
+
139
+ The HTTP auth options (`auth`, `bearer_token_env_var`, `env_http_headers`) apply to `url` servers only. `env_http_headers` maps a header name to the environment variable holding its value.
140
+
141
+ Manage servers at runtime:
142
+
143
+ - `/mcp`: list configured servers and connection status.
144
+ - `/mcp tools [server]`: list discovered tools.
145
+ - `/mcp refresh [server]`: rediscover servers.
146
+ - `/mcp login <server>` / `/mcp logout <server>`: OAuth login and logout.
108
147
 
109
148
  ## Tested Providers
110
149
 
@@ -19,6 +19,7 @@ nanocode 仍是 1.0 前的软件。稳定版发布前,命令、配置和工具
19
19
  - **可恢复上下文**:prompt 中的工具输出保持有界,原始 `tr.N` 结果仍可按需召回。
20
20
  - **缓存友好上下文**:稳定内容靠前,嘈杂的工作状态靠后,提高 prompt cache 复用率。
21
21
  - **聚焦工作记忆**:`Note` 把 goal、plan、known facts 从嘈杂执行日志中拆出来。
22
+ - **MCP 集成**:连接远程(HTTP)或本地(stdio)的 Model Context Protocol 服务器并调用其工具。
22
23
  - **终端优先工作流**:模型选择、历史搜索、确认、实时命令输出、追加输入和状态展示都在一个 CLI 内完成。
23
24
 
24
25
  ## 安装
@@ -66,6 +67,7 @@ nanocode
66
67
  - `/debug [on|off]`:切换模型 I/O debug trace。
67
68
  - `/compact`:立即压缩上下文。
68
69
  - `/index [force]`:同步或重建代码符号索引。
70
+ - `/mcp [tools|login|logout|refresh] ...`:管理 MCP 服务器和工具。
69
71
  - `/provider [NAME]`:显示或设置 provider。
70
72
  - `/model [MODEL]`:显示或设置模型。
71
73
  - `/reason`:选择 reasoning effort。
@@ -83,6 +85,7 @@ nanocode
83
85
  - Shell:`Bash`, `Git`。
84
86
  - 工具结果:`Recall`。
85
87
  - 工作笔记:`Note`。
88
+ - MCP:`MCP` 调用已配置 MCP 服务器上的工具。
86
89
 
87
90
  `Read`、`Search` 和 `InspectCode` 会在合适时返回行锚点。`Edit` 使用当前 `line:hash` 锚点拒绝过期编辑。
88
91
 
@@ -105,6 +108,42 @@ nanocode --init-config
105
108
 
106
109
  `api = "auto"` 会根据 provider/model profile 在 Chat Completions 和 Anthropic Messages 之间选择。`prompt_cache_key = "auto"` 会根据 provider、model、workspace 和工具 schema 名称生成稳定 key。
107
110
 
111
+ ## MCP
112
+
113
+ nanocode 可连接 [Model Context Protocol](https://modelcontextprotocol.io) 服务器,并通过 `MCP` 工具暴露其工具。每个服务器配置在 `[mcp.<name>]` 下,且只能二选一:`url`(远程)或 `command`(本地)。
114
+
115
+ 通过 streamable HTTP 的远程服务器:
116
+
117
+ ```toml
118
+ [mcp.example]
119
+ url = "https://example.com/mcp"
120
+ bearer_token_env_var = "EXAMPLE_MCP_TOKEN" # 可选;发送 Authorization: Bearer
121
+ enabled = true
122
+
123
+ [mcp.oauth_example]
124
+ url = "https://example.com/mcp"
125
+ auth = "oauth" # 通过 /mcp login <server> 在浏览器登录
126
+ enabled = true
127
+ ```
128
+
129
+ 通过 stdio 的本地服务器(作为子进程启动):
130
+
131
+ ```toml
132
+ [mcp.filesystem]
133
+ command = "npx"
134
+ args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
135
+ env = { SOME_TOKEN = "value" } # 可选;会合并到继承的环境变量之上
136
+ enabled = true
137
+ ```
138
+
139
+ HTTP 鉴权选项(`auth`、`bearer_token_env_var`、`env_http_headers`)只对 `url` 服务器生效。`env_http_headers` 把 header 名映射到存放其值的环境变量。
140
+
141
+ 运行时管理服务器:
142
+
143
+ - `/mcp`:列出已配置服务器及连接状态。
144
+ - `/mcp tools [server]`:列出已发现的工具。
145
+ - `/mcp refresh [server]`:重新发现服务器。
146
+ - `/mcp login <server>` / `/mcp logout <server>`:OAuth 登录和登出。
108
147
 
109
148
  ## 已测试的 Provider
110
149