经 AI Skill Hub 精选评估,开源MCP代理 获评「强烈推荐」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.0 分,适合有一定技术背景的用户使用。
开源MCP代理 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
开源MCP代理 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/KochC/opencode-llm-proxy
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"--mcp--": {
"command": "npx",
"args": ["-y", "opencode-llm-proxy"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 开源MCP代理 执行以下任务... Claude: [自动调用 开源MCP代理 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"__mcp__": {
"command": "npx",
"args": ["-y", "opencode-llm-proxy"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
One local endpoint. Every model you have access to. Any API format. Parallel tool calling included.
opencode-llm-proxy is an OpenCode plugin that starts a local HTTP server on http://127.0.0.1:4010. It translates between the API format your tool speaks and whichever LLM provider OpenCode has configured — so you never reconfigure the same models twice.
Your tool (OpenAI / Anthropic / Gemini SDK, coding agent, etc.)
│
▼ http://127.0.0.1:4010
opencode-llm-proxy
│
▼ OpenCode SDK
GitHub Copilot · Anthropic · Gemini · Ollama · OpenRouter · Bedrock · …
Supported API formats — all with streaming and tool/function calling:
| Format | Endpoint |
|---|---|
| OpenAI Chat Completions | POST /v1/chat/completions |
| OpenAI Responses API | POST /v1/responses |
| Anthropic Messages API | POST /v1/messages |
| Google Gemini | POST /v1beta/models/:model:generateContent |
✨ Tool calling works with all four formats — including parallel tool calls. Point a coding agent (Claude Code, Cursor, Continue, Cline, your own agent loop, ...) at the proxy and its tools/tool_choice calls are translated through to whatever model OpenCode has configured, with a real tool_calls / tool_use / functionCall response handed back — one call or several in a single turn. See Tool calling.
---
npm install opencode-llm-proxy
Add to opencode.json:
{
"plugin": ["opencode-llm-proxy"]
}
Start OpenCode — the proxy starts automatically:
opencode
This package is an OpenCode plugin, not a standalone server. It intentionally has no npm start command; load it through OpenCode as shown above.
Send a request:
curl http://127.0.0.1:4010/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "github-copilot/claude-sonnet-4.6",
"messages": [{"role": "user", "content": "Hello!"}]
}'
---
| Variable | Default | Description |
|---|---|---|
OPENCODE_LLM_PROXY_HOST | 127.0.0.1 | Bind address. 0.0.0.0 to expose on LAN or Docker. |
OPENCODE_LLM_PROXY_PORT | 4010 | TCP port. |
OPENCODE_LLM_PROXY_TOKEN | _(unset)_ | Single accepted bearer token. A token is required when binding beyond loopback. |
OPENCODE_LLM_PROXY_TOKENS | [] | JSON array of additional accepted bearer-token strings. |
OPENCODE_LLM_PROXY_CORS_ORIGINS | [] | JSON array of allowed browser origins. Browser cross-origin requests are denied by default; use "*" explicitly to allow all. |
OPENCODE_LLM_PROXY_CORS_ORIGIN | _(unset)_ | Legacy single origin appended to the CORS allowlist. |
OPENCODE_LLM_PROXY_ALLOW_PRIVATE_NETWORK | false | Set to true to allow browser Private Network Access preflights. |
OPENCODE_LLM_PROXY_REQUEST_TIMEOUT_MS | 120000 | Total request timeout, from 1 to 3,600,000 ms. |
OPENCODE_LLM_PROXY_MAX_REQUEST_BYTES | 1048576 | Maximum JSON request body and embedded data-URL size, up to 100 MiB. |
OPENCODE_LLM_PROXY_MAX_CONCURRENT_REQUESTS | 8 | Maximum active POST requests. |
OPENCODE_LLM_PROXY_MAX_QUEUED_REQUESTS | 32 | Maximum POST requests waiting for capacity; excess requests receive 503. |
OPENCODE_LLM_PROXY_TOOL_BRIDGE_POOL_SIZE | 8 | Max concurrent in-flight requests using [tool calling](#tool-calling). |
OPENCODE_LLM_PROXY_TOOL_BRIDGE_ACQUIRE_TIMEOUT_MS | 10000 | Maximum wait for a tool-bridge slot, from 1 to 3,600,000 ms. |
OPENCODE_LLM_PROXY_TOOL_BRIDGE_MAX_QUEUE | 32 | Maximum tool-calling requests waiting for a bridge slot, from 0 to 10,000; excess requests receive 429. |
OPENCODE_LLM_PROXY_KEEP_SESSIONS | false | Set to true to retain temporary OpenCode sessions; otherwise they are deleted after use. |
OPENCODE_LLM_PROXY_MODEL_ALIASES | {} | JSON object mapping aliases to a model ID string or ordered array of fallback model IDs. |
OPENCODE_LLM_PROXY_METRICS_ENABLED | false | Set to true to expose the authenticated Prometheus endpoint at GET /metrics. |
OPENCODE_LLM_PROXY_REMOTE_MEDIA_ENABLED | false | Set to true to fetch remote media URLs and convert them to embedded data URLs. Leave disabled unless required. |
OPENCODE_LLM_PROXY_REMOTE_MEDIA_ALLOWED_SCHEMES | ["https"] | JSON array of allowed remote URL schemes (https and, if explicitly enabled, http). HTTPS-only is strongly recommended. |
OPENCODE_LLM_PROXY_REMOTE_MEDIA_MAX_BYTES | value of OPENCODE_LLM_PROXY_MAX_REQUEST_BYTES (1048576 by default) | Maximum downloaded bytes per remote media item, up to 100 MiB. |
OPENCODE_LLM_PROXY_REMOTE_MEDIA_MAX_ITEMS | 4 | Maximum remote media downloads in one request, from 0 to 10,000. |
OPENCODE_LLM_PROXY_MAX_MEDIA_ITEMS | 64 | Maximum total embedded and remote media items in one request. |
OPENCODE_LLM_PROXY_REMOTE_MEDIA_MAX_REDIRECTS | 3 | Maximum redirects per remote media download, from 0 to 100. |
OPENCODE_LLM_PROXY_REMOTE_MEDIA_TIMEOUT_MS | 10000 | Total remote-media preparation timeout, including DNS and all items, from 1 to 3,600,000 ms. |
Use x-opencode-variant to select an OpenCode model variant for a request. The proxy accepts multimodal image, document, and file inputs in each API's native content shape, using embedded data URLs and validating model capabilities. Remote URLs are rejected unless the SSRF-safe remote-media fetcher is explicitly enabled; fetched content is converted to a data URL before it reaches OpenCode. Structured JSON output is supported through OpenAI response_format.json_schema, Responses API text.format.schema, and Gemini generationConfig.responseSchema.
Generation temperature, top-p (top_p/topP), and top-k (topK) values are validated and applied through the plugin's chat.params hook. Maximum-token fields (max_tokens, max_completion_tokens, max_output_tokens, and Gemini maxOutputTokens) are accepted where clients require them, but the current OpenCode SDK cannot enforce them. OpenAI and Anthropic requests reject unsupported controls (stop, seed, frequency_penalty, presence_penalty, logprobs, and n) with 400 instead of silently ignoring them.
OPENCODE_LLM_PROXY_HOST=0.0.0.0 \
OPENCODE_LLM_PROXY_TOKEN=my-secret \
opencode
---
| Client | Endpoint type | Streaming | Tool calling | Notes |
|---|---|---|---|---|
| OpenAI SDK (JS/TS) | Chat Completions / Responses | yes | yes | Set baseURL: ".../v1" |
| OpenAI SDK (Python) | Chat Completions / Responses | yes | yes | Set base_url=".../v1" |
| Anthropic SDK (JS/TS) | Messages | yes | yes | Set baseURL to the proxy root (no /v1) |
| Anthropic SDK (Python) | Messages | yes | yes | Set base_url to the proxy root (no /v1) |
| Google Generative AI (JS) | Gemini /v1beta | yes | yes | Set baseUrl to the proxy root |
| LangChain | OpenAI / Anthropic wrappers | yes | yes | .bind_tools() supported. See [recipe](docs/recipes/langchain.md) |
| n8n | OpenAI / Anthropic | yes | yes | Native Chat Model + AI Agent nodes. See [recipe](docs/recipes/n8n.md) |
| Open WebUI | OpenAI-compatible | yes | partial | Depends on Open WebUI feature support. See [recipe](docs/recipes/open-webui.md) |
| Continue | OpenAI-compatible | yes | not primary | Editor chat/edit. See [recipe](docs/recipes/continue.md) |
| Zed | OpenAI-compatible | yes | not primary | Editor chat/edit. See [recipe](docs/recipes/zed.md) |
See also: Security · Comparisons · All recipes
---
import OpenAI from "openai"
const client = new OpenAI({
baseURL: "http://127.0.0.1:4010/v1",
apiKey: "unused",
})
const response = await client.chat.completions.create({
model: "github-copilot/claude-sonnet-4.6",
messages: [{ role: "user", content: "Explain recursion." }],
})
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:4010/v1", api_key="unused")
response = client.chat.completions.create(
model="ollama/qwen2.5-coder",
messages=[{"role": "user", "content": "Write a Python function to reverse a string."}],
)
print(response.choices[0].message.content)
import anthropic
client = anthropic.Anthropic(
base_url="http://127.0.0.1:4010",
api_key="unused",
)
message = client.messages.create(
model="anthropic/claude-3-5-sonnet",
max_tokens=1024,
messages=[{"role": "user", "content": "What is the Pythagorean theorem?"}],
)
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk"
const client = new Anthropic({
baseURL: "http://127.0.0.1:4010",
apiKey: "unused",
})
const message = await client.messages.create({
model: "anthropic/claude-opus-4",
max_tokens: 1024,
messages: [{ role: "user", content: "Explain async/await." }],
})
import { GoogleGenerativeAI } from "@google/generative-ai"
const genAI = new GoogleGenerativeAI("unused", {
baseUrl: "http://127.0.0.1:4010",
})
const model = genAI.getGenerativeModel({ model: "google/gemini-2.0-flash" })
const result = await model.generateContent("What is machine learning?")
console.log(result.response.text())
npm install opencode-llm-proxy
Add to your global ~/.config/opencode/opencode.json (works everywhere) or a project-level opencode.json:
{
"plugin": ["opencode-llm-proxy"]
}
In ~/.continue/config.json:
{
"models": [
{
"title": "Claude via OpenCode",
"provider": "openai",
"model": "anthropic/claude-3-5-sonnet",
"apiBase": "http://127.0.0.1:4010/v1",
"apiKey": "unused"
}
]
}
opencode-llm-proxy 是一个专为 OpenCode 环境设计的轻量级 LLM 代理工具。它能够作为一个中间层,帮助开发者更灵活地调用各种大语言模型,实现请求的转发与统一管理,是构建智能化开发工作流的重要组件。
您可以通过 npm 包管理器快速安装此工具。只需在您的项目目录或全局环境中运行 `npm install opencode-llm-proxy` 即可完成安装,确保您的开发环境已配置好 Node.js 运行环境。
安装完成后,请在 `opencode.json` 配置文件中添加 "plugin": ["opencode-llm-proxy"]。启动 OpenCode 后,代理服务会自动运行。您可以使用 curl 命令向 `http://127.0.0.1:4010/v1/chat/completions` 发送请求,通过指定不同的 model 参数(如 Claude 系列)来实现模型调用。
可以通过环境变量对代理进行精细化配置。您可以设置 `OPENCODE_LLM_PROXY_HOST` 来绑定地址(若需在 Docker 或局域网中使用,请设为 `0.0.0.0`),使用 `OPENCODE_LLM_PROXY_PORT` 指定 TCP 端口,并通过 `OPENCODE_LLM_PROXY_TOKEN` 配置 Bearer token 以实现身份验证,同时支持 `OPENCODE_LLM_PROXY_CORS_ORIGIN` 进行跨域控制。
opencode-llm-proxy 完全兼容 OpenAI API 标准。开发者可以无缝使用 OpenAI SDK (JS/TS 或 Python) 进行集成。只需将 `baseURL` 修改为代理服务的地址(如 `http://127.0.0.1:4010/v1`),并将 `apiKey` 设为任意值,即可通过标准化的接口调用各类模型,极大降低了迁移成本。
推荐使用 npm plugin 模式进行集成。您可以将配置写入全局配置文件 `~/.config/opencode/opencode.json` 以实现全局生效,也可以仅在特定项目的 `opencode.json` 中进行配置。这种插件化的工作流确保了代理服务能随 OpenCode 自动启动,实现开箱即用的开发体验。
开源MCP工具,支持多模型调用,开发便捷
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:开源MCP代理 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | opencode-llm-proxy |
| 原始描述 | 开源MCP工具:Local AI gateway for OpenCode with tool/function calling — use any model via Ope。⭐33 · JavaScript |
| Topics | mcpai-gatewayjavascript |
| GitHub | https://github.com/KochC/opencode-llm-proxy |
| License | MIT |
| 语言 | JavaScript |
收录时间:2026-07-05 · 更新时间:2026-07-11 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端