BroadRouter

Use MCP servers with OpenAI-compatible models (any provider)

By the BroadNet Inference team · 4 min read · Published · Updated

MCP is model-independent. The MCP client in your app lists each server's tools, passes them to the model as ordinary function-calling tools, and runs tools/call when the model asks. Any OpenAI-compatible model with reliable tool calling can use MCP servers. Configure them in Cline, Continue, opencode or n8n, or bridge them in about 40 lines of Python.

The Model Context Protocol (MCP) gives agents a standard way to reach tools: GitHub, databases, file systems, browsers. Many MCP tutorials assume Claude or GPT. You don’t need either. This post explains why MCP works with any OpenAI-compatible model that supports tool calling, how to set it up in the clients developers actually use, and how to bridge MCP to an open model in your own code.

Why does MCP work with any model?

MCP sits between your application and tool servers, not between your application and the model. MCP’s architecture docs describe three roles:

  • Host: the AI application, such as an editor extension or your script.
  • Client: one connection the host keeps to each MCP server.
  • Server: a program that exposes tools, resources and prompts, locally over stdio or remotely over Streamable HTTP.

The docs are explicit: MCP “does not dictate how AI applications use LLMs or manage the provided context.” The host lists each server’s tools with tools/list, merges them into one registry the model can see, and when the model asks for a tool, the host sends tools/call to the right server.

On an OpenAI-compatible API, “the model can see” means the tools go into the ordinary tools array. An MCP tool already has a name, a description and an inputSchema, which maps one-to-one onto a function definition. The model never knows MCP is involved. All it needs is reliable tool calling.

Which model should you use for MCP?

Model on BroadNet Tool calling listed Context MCP fit
GLM 5.3 Yes 1,048,576 Good default for many servers
Qwen3.8 27B Yes 262,144 Good, plus image input
DeepSeek V4.1 Flash Not listed 1,048,576 Test first; image input
Gemma 4 VL 26B Not listed 32,768 Not recommended

For the two tool-capable models side by side, see GLM 5.3 vs Qwen3.8 27B. Context matters more than people expect. Every MCP tool schema rides on every call. opencode’s docs say “MCP tools consume model context, so add only the servers you need.” The agent token budget post shows how to measure it.

How do you set up MCP in common clients?

Client Where MCP servers go Transports Note
Cline MCP Servers panel, mcpServers JSON stdio, Streamable HTTP, legacy SSE Remote type "streamableHttp"
Continue mcpServers in config.yaml or .continue/mcpServers/ stdio, sse, streamable-http Agent mode only
opencode mcp.servers in opencode.jsonc local, remote Use {env:NAME} for secrets
n8n MCP Client Tool node on an AI Agent Remote server endpoint (its docs describe an SSE endpoint) Pick All, Selected or All Except tools
OpenAI Agents SDK mcp_servers=[...] on the Agent stdio, Streamable HTTP, SSE Not HostedMCPTool

Then point the client’s model at your provider: the Cline, Continue and opencode guides cover the model side for BroadNet. In Continue, remember the tool_use capability, or Agent mode won’t be available.

A Continue example, from its docs:

mcpServers:
  - name: SQLite MCP
    type: stdio
    command: npx
    args: ["-y", "mcp-sqlite", "/path/to/your/database.db"]

How do you bridge MCP to an open model in Python?

If you’re building your own agent, the bridge is short. This uses the MCP Python SDK’s Client (version 2.0 or later; pip install "mcp>=2"), which launches a stdio server when given StdioServerParameters, and the OpenAI SDK pointed at BroadNet:

import asyncio, json, os
from mcp import Client, StdioServerParameters
from mcp.types import TextContent
from openai import OpenAI

llm = OpenAI(base_url="https://inference.broadnet.ai/v1", api_key=os.environ["BROADNET_API_KEY"])
server = StdioServerParameters(command="npx",
    args=["-y", "@modelcontextprotocol/server-filesystem", "."])

async def main(question):
    async with Client(server) as mcp:
        listed = await mcp.list_tools()
        tools = [{"type": "function", "function": {
                    "name": t.name, "description": t.description or "",
                    "parameters": t.input_schema}} for t in listed.tools]
        messages = [{"role": "user", "content": question}]
        for _ in range(8):
            r = llm.chat.completions.create(model="broadnet/glm-5.3",
                    messages=messages, tools=tools, max_tokens=4000)
            msg = r.choices[0].message
            messages.append(msg.model_dump(exclude_none=True))
            if not msg.tool_calls:
                return msg.content
            for call in msg.tool_calls:
                try:
                    res = await mcp.call_tool(call.function.name,
                                              json.loads(call.function.arguments or "{}"))
                    text = "\n".join(b.text for b in res.content if isinstance(b, TextContent))
                    out = f"Error: {text}" if res.is_error else text
                except Exception as e:
                    out = f"Error: {e}"
                messages.append({"role": "tool", "tool_call_id": call.id, "content": out})

print(asyncio.run(main("List the Markdown files here and summarize the README.")))

On mcp 1.x there is no Client class: open the server with stdio_client(...), wrap it in a ClientSession, call initialize(), and read the camelCase fields inputSchema and isError. Three details matter:

  1. Errors become tool results. The MCP SDK reports tool failures with is_error instead of raising. Pass them back so the model can adjust. Our tool calling guide covers validation and retries.
  2. Bound the loop. Eight steps here. MCP servers that return large results fill the context fast.
  3. Filter tools. Expose only the tools the task needs. The OpenAI Agents SDK offers tool_filter for this, and n8n has Selected and All Except.

Using the OpenAI Agents SDK instead? Its MCPServerStdio and MCPServerStreamableHttp classes run in your process. Combine them with a custom provider as in our Agents SDK guide. Its HostedMCPTool runs inside OpenAI’s Responses API and only works with OpenAI models.

What goes wrong with MCP on open models?

  • Too many tools. The model picks the wrong one or ignores tools. Keep the active set small. For your own tools, the JSON schema generator produces a clean, flat parameters schema.
  • Large tool results. A server that returns a whole database table can blow past the context window. Cap or paginate.
  • Empty or cut-off replies. GLM 5.3 and Qwen3.8 27B reason first, and reasoning counts toward max_tokens. Raise it.
  • Trust. MCP servers run code on your machine or call services with your credentials. Install servers you trust, and confirm actions that write or spend.

Where BroadNet Inference fits

BroadNet Inference supplies the model side: GLM 5.3 and Qwen3.8 27B with tool calling listed, through the standard chat-completions format every MCP client above can use, with zero data retention on prompts and outputs. It doesn’t run MCP servers or hosted tools for you; your client does that. Per-token prices for both models are on the pricing page, and keys are at inference.broadnet.ai.

Questions

Can I use MCP with a model that is not Claude or GPT?

Yes. MCP is a protocol between your app and tool servers. The app passes the tools to whatever model it uses through that model's tool-calling format. Any OpenAI-compatible model with working tool calls can use MCP tools.

Does the model need to support MCP?

No. The model only needs function calling. The MCP client in your app does the protocol work, listing tools and calling them.

Which coding agents support MCP with a custom OpenAI-compatible model?

Cline, Continue in Agent mode and opencode all let you configure MCP servers and a custom OpenAI-compatible model. Zoo Code, the continuation of Roo Code, also lists MCP support.

Why does adding MCP servers make my agent slower and more expensive?

Each server's tool definitions are added to the prompt on every model call. Ten servers with a dozen tools each can add thousands of input tokens per step. Enable only the servers a task needs, or filter tools.

Do hosted MCP tools work with other providers?

Not the OpenAI-hosted kind. The OpenAI Agents SDK docs say HostedMCPTool works with OpenAI models that support the Responses API's hosted MCP integration. Use the SDK's local MCP server classes with other providers.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity