Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

mock langchain MCP interface

Ishaan Jaff3fccf5fbef78
diff --git a/tests/pass_through_tests/test_mcp_routes.py b/tests/pass_through_tests/test_mcp_routes.py
new file mode 100644
index 00000000000..69ae1b85227
--- /dev/null
+++ b/tests/pass_through_tests/test_mcp_routes.py
@@ -0,0 +1,31 @@
+# Create server parameters for stdio connection
+import asyncio
+import os
+
+from langchain_mcp_adapters.tools import load_mcp_tools
+from langchain_openai import ChatOpenAI
+from langgraph.prebuilt import create_react_agent
+from mcp import ClientSession
+from mcp.client.sse import sse_client
+
+
+async def main():
+ model = ChatOpenAI(model="gpt-4o", api_key="sk-12")
+
+ async with sse_client(url="http://localhost:8000/mcp/") as (read, write):
+ async with ClientSession(read, write) as session:
+ # Initialize the connection
+ await session.initialize()
+
+ # Get tools
+ tools = await load_mcp_tools(session)
+ print(tools)
+
+ # # Create and run the agent
+ # agent = create_react_agent(model, tools)
+ # agent_response = await agent.ainvoke({"messages": "what's (3 + 5) x 12?"})
+
+
+# Run the async function
+if __name__ == "__main__":
+ asyncio.run(main())