Get Started
Configure AI-agent
Claude Desktop
Open Claude Desktop config file claude_desktop_config.json (can be accessed via Claude Desktop UI in Settings->Developer->Edit Config).
In the config "mcpServers" section - add JSON entry describing your MCP server which was run with MCPBus:
{ "mcpServers": { "My MCP server": { "command": "/usr/local/bin/npx", "args": [ "mcp-remote", "http://localhost:8080/mcp", "--transport", "http-first", "--debug" ] } } }Restart Claude Desktop.
OpenAI
Example of how to connect your AI-agent (with OpenAI Agents SDK) to your MCP-server which was run with MCPBus:
import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
async def main():
server_params = {"url": "http://localhost:8080/mcp"}
async with MCPServerStreamableHttp(
name="MyLocalServer", params=server_params) as mcp_server:
agent = Agent(
name="LocalMcpAgent",
instructions="You are a helpful weather expert.",
mcp_servers=[mcp_server]
)
result = await Runner.run(
agent, input="Can you check weather using my local tool?")
print(result.text)
if __name__ == "__main__":
asyncio.run(main())
LangChain
First, install the adapters library along with LangGraph and your preferred LLM provider (e.g., OpenAI):
pip install langchain-mcp-adapters langgraph langchain-openai
Use this code example to connect to locally running MCPBus server:
import asyncio
from langchain_openai import ChatOpenAI
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
async def main():
client = MultiServerMCPClient(
{
"my_local_service": {
"transport": "http",
"url": "http://localhost:8080/mcp"
}
}
)
tools = await client.get_tools()
model = ChatOpenAI(model="gpt-4o")
agent = create_react_agent(model, tools)
response = await agent.ainvoke(
{
"messages": [
{
"role": "user",
"content": "Fetch data using my local server tools"
}
]
}
)
print(response["messages"][-1].content)
if __name__ == "__main__":
asyncio.run(main())