@nick3/copilot-api 1.10.4 → 1.10.7
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.
- package/README.md +53 -6
- package/README.zh-CN.md +52 -5
- package/dist/main.js +4 -2
- package/dist/main.js.map +1 -1
- package/dist/mcp-9Hgepkc5.js +37 -0
- package/dist/mcp-9Hgepkc5.js.map +1 -0
- package/dist/{proxy-BwmADhKh.js → proxy-YVh74m0I.js} +1 -1
- package/dist/{proxy-BwmADhKh.js.map → proxy-YVh74m0I.js.map} +1 -1
- package/dist/{server-DxQsi1x2.js → server-DmDAepfa.js} +240 -36
- package/dist/server-DmDAepfa.js.map +1 -0
- package/dist/{start-8QHzPrcg.js → start-D37Bi12h.js} +3 -3
- package/dist/{start-8QHzPrcg.js.map → start-D37Bi12h.js.map} +1 -1
- package/dist/tool-search-BrN7M0Dd.js +110 -0
- package/dist/tool-search-BrN7M0Dd.js.map +1 -0
- package/package.json +3 -6
- package/dist/server-DxQsi1x2.js.map +0 -1
package/README.md
CHANGED
|
@@ -730,6 +730,47 @@ You can find more options here: [Claude Code settings](https://docs.anthropic.co
|
|
|
730
730
|
|
|
731
731
|
You can also read more about IDE integration here: [Add Claude Code to your IDE](https://docs.anthropic.com/en/docs/claude-code/ide-integrations)
|
|
732
732
|
|
|
733
|
+
## GPT Tool Search
|
|
734
|
+
|
|
735
|
+
For GPT Responses models such as `gpt-5.4+`, this proxy can expose Responses `tool_search` through a small MCP bridge. The same bridge can be used by Claude Code and opencode, as long as the client loads MCP servers and sends Anthropic Messages traffic through this proxy.
|
|
736
|
+
|
|
737
|
+
Do not set Claude Code's native `ENABLE_TOOL_SEARCH` for GPT models. That flag enables Claude Code's own client-side tool search mode, and it may stop forwarding deferred tool definitions. This proxy needs the full tool definitions so it can keep the small always-loaded tool set eager and translate every other tool into Responses deferred namespaces.
|
|
738
|
+
|
|
739
|
+
If you install `tool-search@copilot-api-marketplace`, Claude Code receives this MCP bridge automatically and you can skip the manual Claude Code MCP setup below.
|
|
740
|
+
|
|
741
|
+
Add the tool search bridge to the MCP config used by Claude Code:
|
|
742
|
+
|
|
743
|
+
```json
|
|
744
|
+
{
|
|
745
|
+
"mcpServers": {
|
|
746
|
+
"tool_search": {
|
|
747
|
+
"type": "stdio",
|
|
748
|
+
"command": "npx",
|
|
749
|
+
"args": ["-y", "@nick3/copilot-api@latest", "mcp"]
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
Add the tool search bridge to the MCP config used by opencode:
|
|
756
|
+
|
|
757
|
+
```json
|
|
758
|
+
{
|
|
759
|
+
"mcp": {
|
|
760
|
+
"tool_search": {
|
|
761
|
+
"type": "local",
|
|
762
|
+
"command": ["npx", "-y", "@nick3/copilot-api@latest", "mcp"]
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
For local development, use `bun` as the command and `["run", "./src/main.ts", "mcp"]` as the args.
|
|
769
|
+
|
|
770
|
+
Internally, the proxy now configures OpenAI Responses `tool_search` in client-executed mode. Deferred tools are still exposed as searchable namespaces, but the model is explicitly asked to return the exact deferred tool names it wants to load next.
|
|
771
|
+
|
|
772
|
+
The bridge uses direct tool selection, not query search. Its tool input is `names`, a comma-separated list of exact deferred tool names, for example `TaskList,TaskGet,mcp__fetch__fetch`.
|
|
773
|
+
|
|
733
774
|
## Using with OpenCode
|
|
734
775
|
|
|
735
776
|
OpenCode already has a direct GitHub Copilot provider. Use this section when you want OpenCode to point at this proxy through `@ai-sdk/anthropic` and reuse the agent behaviors described earlier in this README.
|
|
@@ -891,10 +932,13 @@ Plugin integrations are available for Claude Code and opencode.
|
|
|
891
932
|
|
|
892
933
|
#### Claude Code plugin integration (marketplace-based)
|
|
893
934
|
|
|
894
|
-
The Claude Code integration is packaged as
|
|
935
|
+
The Claude Code integration is packaged as two plugins:
|
|
936
|
+
|
|
937
|
+
- `agent-inject` injects `__SUBAGENT_MARKER__...` on `SubagentStart`, so this proxy can infer `x-initiator: agent`.
|
|
938
|
+
- `tool-search` registers the `tool_search` MCP bridge used for GPT Responses deferred tool loading.
|
|
895
939
|
|
|
896
940
|
- Marketplace catalog in this repository: `.claude-plugin/marketplace.json`
|
|
897
|
-
- Plugin
|
|
941
|
+
- Plugin sources in this repository: `claude-plugin/agent-inject`, `claude-plugin/tool-search`
|
|
898
942
|
|
|
899
943
|
Add the marketplace remotely:
|
|
900
944
|
|
|
@@ -902,19 +946,22 @@ Add the marketplace remotely:
|
|
|
902
946
|
/plugin marketplace add https://github.com/nick3/copilot-api.git#all
|
|
903
947
|
```
|
|
904
948
|
|
|
905
|
-
Install the
|
|
949
|
+
Install the plugins from the marketplace:
|
|
906
950
|
|
|
907
951
|
```sh
|
|
908
|
-
/plugin install
|
|
952
|
+
/plugin install agent-inject@copilot-api-marketplace
|
|
953
|
+
/plugin install tool-search@copilot-api-marketplace
|
|
909
954
|
```
|
|
910
955
|
|
|
911
|
-
After installation,
|
|
956
|
+
After installation, `agent-inject` injects `__SUBAGENT_MARKER__...` on `SubagentStart`, and this proxy uses it to infer `x-initiator: agent`.
|
|
912
957
|
|
|
913
|
-
The plugin also registers a `UserPromptSubmit` hook that returns `{"continue": true}`, and it can inject `SessionStart` reminder rules through environment variables:
|
|
958
|
+
The `agent-inject` plugin also registers a `UserPromptSubmit` hook that returns `{"continue": true}`, and it can inject `SessionStart` reminder rules through environment variables:
|
|
914
959
|
|
|
915
960
|
- `CLAUDE_PLUGIN_ENABLE_QUESTION_RULES=1` enables the two reminders about using the `question` tool automatically for Claude Code. Alternatively, you can add the same reminders manually in `CLAUDE.md`; see [CLAUDE.md or AGENTS.md Recommended Content](#claudemd-or-agentsmd-recommended-content).
|
|
916
961
|
- `CLAUDE_PLUGIN_ENABLE_NO_BACKGROUND_AGENTS_RULE=1` enables the `run_in_background: true` avoidance reminder for agent hooks.
|
|
917
962
|
|
|
963
|
+
The `tool-search` plugin bundles the same MCP bridge described in [GPT Tool Search](#gpt-tool-search), so Claude Code users do not need to add the `tool_search` server manually when they install that plugin.
|
|
964
|
+
|
|
918
965
|
#### Opencode plugin
|
|
919
966
|
|
|
920
967
|
The subagent marker producer is packaged as an opencode plugin located at `.opencode/plugins/subagent-marker.js`.
|
package/README.zh-CN.md
CHANGED
|
@@ -742,6 +742,47 @@ npx @nick3/copilot-api@latest start --claude-code
|
|
|
742
742
|
|
|
743
743
|
也可以参考 IDE 集成说明:[Add Claude Code to your IDE](https://docs.anthropic.com/en/docs/claude-code/ide-integrations)
|
|
744
744
|
|
|
745
|
+
## GPT Tool Search
|
|
746
|
+
|
|
747
|
+
对于 `gpt-5.4+` 这类 GPT Responses 模型,本代理可以通过一个很小的 MCP bridge 暴露 Responses `tool_search`。Claude Code 和 opencode 都可以使用同一个 bridge,前提是客户端会加载 MCP server,并且 Anthropic Messages 流量会经过本代理。
|
|
748
|
+
|
|
749
|
+
GPT 模型不要设置 Claude Code 原生的 `ENABLE_TOOL_SEARCH`。这个开关启用的是 Claude Code 自己的客户端 tool search 模式,可能导致 deferred 工具定义不再转发给代理。本代理需要完整的工具定义,这样才能只保留那一小组常驻加载工具,其余工具统一转换为 Responses deferred namespace。
|
|
750
|
+
|
|
751
|
+
如果你安装了 `tool-search@copilot-api-marketplace`,Claude Code 会自动带上这个 MCP bridge,可以跳过下面这段 Claude Code MCP 手动配置。
|
|
752
|
+
|
|
753
|
+
请把 tool search bridge 加到 Claude Code 使用的 MCP 配置中:
|
|
754
|
+
|
|
755
|
+
```json
|
|
756
|
+
{
|
|
757
|
+
"mcpServers": {
|
|
758
|
+
"tool_search": {
|
|
759
|
+
"type": "stdio",
|
|
760
|
+
"command": "npx",
|
|
761
|
+
"args": ["-y", "@nick3/copilot-api@latest", "mcp"]
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
请把 tool search bridge 加到 opencode 使用的 MCP 配置中:
|
|
768
|
+
|
|
769
|
+
```json
|
|
770
|
+
{
|
|
771
|
+
"mcp": {
|
|
772
|
+
"tool_search": {
|
|
773
|
+
"type": "local",
|
|
774
|
+
"command": ["npx", "-y", "@nick3/copilot-api@latest", "mcp"]
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
本地开发时可以将命令换成 `bun`,参数换成 `["run", "./src/main.ts", "mcp"]`。
|
|
781
|
+
|
|
782
|
+
代理内部现在会把 OpenAI Responses `tool_search` 配置成 client-executed 模式。deferred tools 仍然会作为可搜索 namespace 暴露给模型,但会明确要求模型直接返回下一步要加载的精确工具名列表。
|
|
783
|
+
|
|
784
|
+
该 bridge 使用直接工具选择,不做 query 搜索。工具入参是 `names`,值为逗号分隔的精确 deferred 工具名,例如 `TaskList,TaskGet,mcp__fetch__fetch`。
|
|
785
|
+
|
|
745
786
|
## 与 OpenCode 一起使用
|
|
746
787
|
|
|
747
788
|
OpenCode 已经内置了 GitHub Copilot provider。本节适用于你希望让 OpenCode 通过 `@ai-sdk/anthropic` 指向这个代理,并复用本 README 前面提到的 agent 行为时。
|
|
@@ -905,10 +946,13 @@ UI 会把 token 保存在 `sessionStorage` 中,并通过 `x-admin-token` 请
|
|
|
905
946
|
|
|
906
947
|
#### Claude Code 插件集成(基于 marketplace)
|
|
907
948
|
|
|
908
|
-
Claude Code
|
|
949
|
+
Claude Code 集成现在拆分为两个插件:
|
|
950
|
+
|
|
951
|
+
- `agent-inject` 会在 `SubagentStart` 时注入 `__SUBAGENT_MARKER__...`,以便本代理推导 `x-initiator: agent`。
|
|
952
|
+
- `tool-search` 会注册用于 GPT Responses deferred tool loading 的 `tool_search` MCP bridge。
|
|
909
953
|
|
|
910
954
|
- 本仓库中的 marketplace catalog:`.claude-plugin/marketplace.json`
|
|
911
|
-
- 本仓库中的插件源码:`claude-plugin`
|
|
955
|
+
- 本仓库中的插件源码:`claude-plugin/agent-inject`、`claude-plugin/tool-search`
|
|
912
956
|
|
|
913
957
|
远程添加 marketplace:
|
|
914
958
|
|
|
@@ -919,16 +963,19 @@ Claude Code 集成被打包为名为 `claude-plugin` 的插件。
|
|
|
919
963
|
从 marketplace 安装插件:
|
|
920
964
|
|
|
921
965
|
```sh
|
|
922
|
-
/plugin install
|
|
966
|
+
/plugin install agent-inject@copilot-api-marketplace
|
|
967
|
+
/plugin install tool-search@copilot-api-marketplace
|
|
923
968
|
```
|
|
924
969
|
|
|
925
|
-
|
|
970
|
+
安装后,`agent-inject` 会在 `SubagentStart` 时注入 `__SUBAGENT_MARKER__...`,该代理会利用它推导 `x-initiator: agent`。
|
|
926
971
|
|
|
927
|
-
|
|
972
|
+
`agent-inject` 还会注册一个 `UserPromptSubmit` hook,并返回 `{"continue": true}`;同时它也可以通过环境变量注入 `SessionStart` reminder 规则:
|
|
928
973
|
|
|
929
974
|
- `CLAUDE_PLUGIN_ENABLE_QUESTION_RULES=1` 会自动为 Claude Code 启用两条关于使用 `question` 工具的提醒。你也可以把同样的提醒手动写进 `CLAUDE.md`;见 [CLAUDE.md 或 AGENTS.md 推荐内容](#claudemd-or-agentsmd-recommended-content)。
|
|
930
975
|
- `CLAUDE_PLUGIN_ENABLE_NO_BACKGROUND_AGENTS_RULE=1` 会启用关于避免在 agent hooks 中使用 `run_in_background: true` 的提醒。
|
|
931
976
|
|
|
977
|
+
`tool-search` 插件内置了 [GPT Tool Search](#gpt-tool-search) 一节描述的同一个 MCP bridge,因此安装该插件后,Claude Code 用户无需再手动配置 `tool_search` server。
|
|
978
|
+
|
|
932
979
|
#### Opencode 插件
|
|
933
980
|
|
|
934
981
|
subagent marker 生成器被打包为一个 opencode 插件,位于 `.opencode/plugins/subagent-marker.js`。
|
package/dist/main.js
CHANGED
|
@@ -22,7 +22,8 @@ if (typeof args["enterprise-url"] === "string") process.env.COPILOT_API_ENTERPRI
|
|
|
22
22
|
const { auth } = await import("./auth-B0y-2njL.js");
|
|
23
23
|
const { checkUsage } = await import("./check-usage-DdevqHE5.js");
|
|
24
24
|
const { debug } = await import("./debug-BMo6ltbp.js");
|
|
25
|
-
const {
|
|
25
|
+
const { mcp } = await import("./mcp-9Hgepkc5.js");
|
|
26
|
+
const { start } = await import("./start-D37Bi12h.js");
|
|
26
27
|
await runMain(defineCommand({
|
|
27
28
|
meta: {
|
|
28
29
|
name: "copilot-api",
|
|
@@ -32,7 +33,8 @@ await runMain(defineCommand({
|
|
|
32
33
|
auth,
|
|
33
34
|
start,
|
|
34
35
|
"check-usage": checkUsage,
|
|
35
|
-
debug
|
|
36
|
+
debug,
|
|
37
|
+
mcp
|
|
36
38
|
},
|
|
37
39
|
args: cliArgs
|
|
38
40
|
}));
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { defineCommand, runMain, parseArgs } from \"citty\"\n\nconst cliArgs = {\n \"api-home\": {\n type: \"string\",\n description: \"Path to the API home directory.\",\n },\n \"oauth-app\": {\n type: \"string\",\n description: \"OAuth app identifier.\",\n },\n \"enterprise-url\": {\n type: \"string\",\n description: \"Enterprise URL for GitHub.\",\n },\n} as const\n\nconst args = parseArgs(process.argv, cliArgs)\n\n// Set environment variables before loading other modules\nif (typeof args[\"api-home\"] === \"string\") {\n process.env.COPILOT_API_HOME = args[\"api-home\"]\n}\nif (typeof args[\"oauth-app\"] === \"string\") {\n process.env.COPILOT_API_OAUTH_APP = args[\"oauth-app\"]\n}\nif (typeof args[\"enterprise-url\"] === \"string\") {\n process.env.COPILOT_API_ENTERPRISE_URL = args[\"enterprise-url\"]\n}\n\n// Dynamically import other modules to ensure environment variables are set\nconst { auth } = await import(\"./auth\")\nconst { checkUsage } = await import(\"./check-usage\")\nconst { debug } = await import(\"./debug\")\nconst { start } = await import(\"./start\")\n\nconst main = defineCommand({\n meta: {\n name: \"copilot-api\",\n description:\n \"A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools.\",\n },\n subCommands: { auth, start, \"check-usage\": checkUsage, debug },\n args: cliArgs,\n})\n\nawait runMain(main)\n"],"mappings":";;;AAIA,MAAM,UAAU;CACd,YAAY;EACV,MAAM;EACN,aAAa;EACd;CACD,aAAa;EACX,MAAM;EACN,aAAa;EACd;CACD,kBAAkB;EAChB,MAAM;EACN,aAAa;EACd;CACF;AAED,MAAM,OAAO,UAAU,QAAQ,MAAM,QAAQ;AAG7C,IAAI,OAAO,KAAK,gBAAgB,UAC9B,QAAQ,IAAI,mBAAmB,KAAK;AAEtC,IAAI,OAAO,KAAK,iBAAiB,UAC/B,QAAQ,IAAI,wBAAwB,KAAK;AAE3C,IAAI,OAAO,KAAK,sBAAsB,UACpC,QAAQ,IAAI,6BAA6B,KAAK;AAIhD,MAAM,EAAE,SAAS,MAAM,OAAO;AAC9B,MAAM,EAAE,eAAe,MAAM,OAAO;AACpC,MAAM,EAAE,UAAU,MAAM,OAAO;AAC/B,MAAM,EAAE,UAAU,MAAM,OAAO;AAY/B,MAAM,QAVO,cAAc;CACzB,MAAM;EACJ,MAAM;EACN,aACE;EACH;CACD,aAAa;EAAE;EAAM;EAAO,eAAe;EAAY;EAAO;
|
|
1
|
+
{"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { defineCommand, runMain, parseArgs } from \"citty\"\n\nconst cliArgs = {\n \"api-home\": {\n type: \"string\",\n description: \"Path to the API home directory.\",\n },\n \"oauth-app\": {\n type: \"string\",\n description: \"OAuth app identifier.\",\n },\n \"enterprise-url\": {\n type: \"string\",\n description: \"Enterprise URL for GitHub.\",\n },\n} as const\n\nconst args = parseArgs(process.argv, cliArgs)\n\n// Set environment variables before loading other modules\nif (typeof args[\"api-home\"] === \"string\") {\n process.env.COPILOT_API_HOME = args[\"api-home\"]\n}\nif (typeof args[\"oauth-app\"] === \"string\") {\n process.env.COPILOT_API_OAUTH_APP = args[\"oauth-app\"]\n}\nif (typeof args[\"enterprise-url\"] === \"string\") {\n process.env.COPILOT_API_ENTERPRISE_URL = args[\"enterprise-url\"]\n}\n\n// Dynamically import other modules to ensure environment variables are set\nconst { auth } = await import(\"./auth\")\nconst { checkUsage } = await import(\"./check-usage\")\nconst { debug } = await import(\"./debug\")\nconst { mcp } = await import(\"./mcp\")\nconst { start } = await import(\"./start\")\n\nconst main = defineCommand({\n meta: {\n name: \"copilot-api\",\n description:\n \"A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools.\",\n },\n subCommands: { auth, start, \"check-usage\": checkUsage, debug, mcp },\n args: cliArgs,\n})\n\nawait runMain(main)\n"],"mappings":";;;AAIA,MAAM,UAAU;CACd,YAAY;EACV,MAAM;EACN,aAAa;EACd;CACD,aAAa;EACX,MAAM;EACN,aAAa;EACd;CACD,kBAAkB;EAChB,MAAM;EACN,aAAa;EACd;CACF;AAED,MAAM,OAAO,UAAU,QAAQ,MAAM,QAAQ;AAG7C,IAAI,OAAO,KAAK,gBAAgB,UAC9B,QAAQ,IAAI,mBAAmB,KAAK;AAEtC,IAAI,OAAO,KAAK,iBAAiB,UAC/B,QAAQ,IAAI,wBAAwB,KAAK;AAE3C,IAAI,OAAO,KAAK,sBAAsB,UACpC,QAAQ,IAAI,6BAA6B,KAAK;AAIhD,MAAM,EAAE,SAAS,MAAM,OAAO;AAC9B,MAAM,EAAE,eAAe,MAAM,OAAO;AACpC,MAAM,EAAE,UAAU,MAAM,OAAO;AAC/B,MAAM,EAAE,QAAQ,MAAM,OAAO;AAC7B,MAAM,EAAE,UAAU,MAAM,OAAO;AAY/B,MAAM,QAVO,cAAc;CACzB,MAAM;EACJ,MAAM;EACN,aACE;EACH;CACD,aAAa;EAAE;EAAM;EAAO,eAAe;EAAY;EAAO;EAAK;CACnE,MAAM;CACP,CAEiB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { n as createMcpToolSearchSentinel } from "./tool-search-BrN7M0Dd.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
//#region src/mcp.ts
|
|
7
|
+
const SERVER_NAME = "tool_search";
|
|
8
|
+
const SERVER_VERSION = "1.0.0";
|
|
9
|
+
const runMcpServer = async () => {
|
|
10
|
+
const server = new McpServer({
|
|
11
|
+
name: SERVER_NAME,
|
|
12
|
+
version: SERVER_VERSION
|
|
13
|
+
});
|
|
14
|
+
server.registerTool("search", {
|
|
15
|
+
title: "Tool Search Bridge",
|
|
16
|
+
description: "Load deferred tools by exact name through the Copilot API tool_search bridge.",
|
|
17
|
+
inputSchema: { names: z.string().describe("Comma-separated exact deferred tool names to load, for example \"TaskList,TaskGet,mcp__fetch__fetch\".") },
|
|
18
|
+
_meta: { "anthropic/alwaysLoad": true }
|
|
19
|
+
}, ({ names }) => ({ content: [{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: createMcpToolSearchSentinel(names)
|
|
22
|
+
}] }));
|
|
23
|
+
await server.connect(new StdioServerTransport());
|
|
24
|
+
};
|
|
25
|
+
const mcp = defineCommand({
|
|
26
|
+
meta: {
|
|
27
|
+
name: "mcp",
|
|
28
|
+
description: "Start the Copilot API MCP tool_search bridge over stdio"
|
|
29
|
+
},
|
|
30
|
+
run() {
|
|
31
|
+
return runMcpServer();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { mcp };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=mcp-9Hgepkc5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-9Hgepkc5.js","names":[],"sources":["../src/mcp.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\"\nimport { defineCommand } from \"citty\"\nimport { z } from \"zod\"\n\nimport { createMcpToolSearchSentinel } from \"./lib/tool-search\"\n\nconst SERVER_NAME = \"tool_search\"\nconst SERVER_VERSION = \"1.0.0\"\n\nexport const runMcpServer = async (): Promise<void> => {\n const server = new McpServer({\n name: SERVER_NAME,\n version: SERVER_VERSION,\n })\n\n server.registerTool(\n \"search\",\n {\n title: \"Tool Search Bridge\",\n description:\n \"Load deferred tools by exact name through the Copilot API tool_search bridge.\",\n inputSchema: {\n names: z\n .string()\n .describe(\n 'Comma-separated exact deferred tool names to load, for example \"TaskList,TaskGet,mcp__fetch__fetch\".',\n ),\n },\n _meta: {\n \"anthropic/alwaysLoad\": true,\n },\n },\n ({ names }) => ({\n content: [\n {\n type: \"text\",\n text: createMcpToolSearchSentinel(names),\n },\n ],\n }),\n )\n\n await server.connect(new StdioServerTransport())\n}\n\nexport const mcp = defineCommand({\n meta: {\n name: \"mcp\",\n description: \"Start the Copilot API MCP tool_search bridge over stdio\",\n },\n run() {\n return runMcpServer()\n },\n})\n"],"mappings":";;;;;;AASA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAEvB,MAAa,eAAe,YAA2B;CACrD,MAAM,SAAS,IAAI,UAAU;EAC3B,MAAM;EACN,SAAS;EACV,CAAC;CAEF,OAAO,aACL,UACA;EACE,OAAO;EACP,aACE;EACF,aAAa,EACX,OAAO,EACJ,QAAQ,CACR,SACC,yGACD,EACJ;EACD,OAAO,EACL,wBAAwB,MACzB;EACF,GACA,EAAE,aAAa,EACd,SAAS,CACP;EACE,MAAM;EACN,MAAM,4BAA4B,MAAM;EACzC,CACF,EACF,EACF;CAED,MAAM,OAAO,QAAQ,IAAI,sBAAsB,CAAC;;AAGlD,MAAa,MAAM,cAAc;CAC/B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,OAAO,cAAc;;CAExB,CAAC"}
|
|
@@ -3313,4 +3313,4 @@ function initProxyFromEnv() {
|
|
|
3313
3313
|
//#endregion
|
|
3314
3314
|
export { getModelRefreshIntervalMs as A, isResponsesApiWebSocketEnabled as B, getAnthropicApiKey as C, getLogLevel as D, getExtraPromptForModel as E, isForceAgentEnabled as F, resolveModelAlias as H, isMessageStartInputTokensFallbackEnabled as I, isMessagesApiEnabled as L, getReasoningEffortForModel as M, getSmallModel as N, getModelAliases as O, isAccountAffinityEnabled as P, isResponsesApiContextManagementModel as R, getAliasTargetSet as S, getConfig as T, shouldCompactUseSmallModel as U, mergeConfigWithDefaults as V, toLocalDateString as _, stopQuotaRefreshScheduler as a, isDevModeEnabled as b, applySharedSessionAffinityRetention as c, getClientIpInfo as d, getRequestHistoryStore as f, normalizeMessagesUsage as g, normalizeEmbeddingsUsage as h, startQuotaRefreshSchedulerFromConfig as i, getProviderConfig as j, getModelAliasesInfo as k, extractResponsesUsageFromResult as l, normalizeChatCompletionsUsage as m, initProxyFromEnv as n, updateQuotaRefreshSchedulerFromConfig as o, getStatsStore as p, registerQuotaRefreshSchedulerShutdownCleanup as r, accountsManager as s, getProxyEnvDispatcher as t, extractResponsesUsageFromStreamEvent as u, copilotFetch as v, getClaudeTokenMultiplier as w, PROVIDER_TYPE_ANTHROPIC as x, flushPendingCapture as y, isResponsesApiWebSearchEnabled as z };
|
|
3315
3315
|
|
|
3316
|
-
//# sourceMappingURL=proxy-
|
|
3316
|
+
//# sourceMappingURL=proxy-YVh74m0I.js.map
|