Lesson 5: Tools with MCP

Hi, I’m watching Quickstart: LangChain Essentials - Python, specifically Lesson 5: Tools with MCP, and I think there might be an issue around 1:00.

We then establish our client with a time server. He uses standard IO for transport and connects to this open MCP time server.

I think there’s some misunderstanding here. It sounds like we are connecting to a remote MCP server, but in our case, we launch MCP server by npx, which runs Node.js packages without installing them globally, and run it locally . The LangChain client then connects to the MCP server running on our PC or server. Am I correct?

1 Like

hi @mcavdar

Yes, you are right. MCP server can be connected locally or remotely. In the course, when you run the time server via npx and use stdio, you are connecting to a locally launched MCP server process, not a remote one.

Docs to ground this

Examples:

new MultiServerMCPClient({
  mcpServers: {
    filesystem: {
      transport: "stdio",
      command: "npx",
      args: ["-y", "@modelcontextprotocol/server-filesystem", "./"],
    },
  },
  const model = new ChatOpenAI({
    model: "o4-mini",
    useResponsesApi: true,
  }).bindTools([
    {
      type: "mcp",
      server_label: "deepwiki",
      server_url: "https://mcp.deepwiki.com/mcp",
      require_approval: {
        always: {
          tool_names: ["read_wiki_structure"],
        },
      },
    },
  ]);
from langchain_anthropic import ChatAnthropic

            mcp_servers = [
                {
                    "type": "url",
                    "url": "https://mcp.deepwiki.com/mcp",
                    "name": "deepwiki",
                    "tool_configuration": {  # optional configuration
                        "enabled": True,
                        "allowed_tools": ["ask_question"],
                    },
                    "authorization_token": "PLACEHOLDER",  # optional authorization
                }
            ]

            model = ChatAnthropic(
                model="claude-sonnet-4-20250514",
                betas=["mcp-client-2025-04-04"],
                mcp_servers=mcp_servers,
            )
2 Likes