mcpField
S
Simple MCP Client with LangGraph Agent

Simple MCP Client with LangGraph Agent

Local
github.com/simozampaAI & Agents1Updated 78w ago

About Simple MCP Client with LangGraph Agent

A TypeScript and Express.js chat service that uses a LangGraph agent to work with tools from multiple MCP servers. It is intended for applications that need streamed conversational responses with MCP tool access.

Key features

  1. 01LangGraph conversation agent
  2. 02Connects to multiple MCP servers
  3. 03Uses MCP tools in chats
  4. 04Streams chat responses
  5. 05Express.js API in TypeScript

Use cases

  1. 01Build a chat API backed by an agent
  2. 02Use tools from several MCP servers in one conversation

MCP support

The service connects to MCP servers specified in a request and retrieves their available tools for the LangGraph agent.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Simple MCP Client with LangGraph Agent

A lightweight implementation of a multiserver MCP (Model Context Protocol) client using a LangGraph agent with Express.js and TypeScript.

Features

  • Express.js server with TypeScript
  • LangGraph agent for handling conversations
  • MCP client for tool integration
  • Streaming responses

Setup

  1. Clone the repository
  2. Install dependencies: npm install
  3. Create a .env file with the following variables:
    PORT=3000
    NODE_ENV=development
    CORS_ORIGIN=*
    ANTHROPIC_API_KEY=your_anthropic_api_key
    
  4. Build and start the server: npm run buildnpm start

API Endpoints

Initialize Chat
GET /api/chat/init
Generate Chat
POST /api/chat

Request body:

{
  "input": "Hello, how can you help me?",
  "characterId": "character_123",
  "llmConfig": {
    "model": "claude-3-opus-20240229",
    "verbose": true
  },
  "chatHistory": [],
  "mcpServers": [
    {
      "name": "weather-service",
      "version": "1.0",
      "url": "https://example-mcp-server.com",
      "key": "optional_api_key"
    }
  ]
}
Close Chat
GET /api/chat/close

MCP Integration

The server connects to MCP servers specified in the request and retrieves available tools that can be used by the LangGraph agent.

Development

Run the development server with auto-reload:

npm run dev

Example Usage

// Send a message and stream the response
const response = await fetch("/api/chat", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    input: "What's the weather in New York?",
    characterId: "agent1",
    chatHistory: [],
    mcpServers: [
      {
        name: "weather-service",
        version: "1.0",
        url: "https://my-mcp-server.com",
      },
    ],
  }),
});

// Read the streaming response
const reader = response.body.getReader();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const text = new TextDecoder().decode(value);
  const events = text.split("\n\n").filter(Boolean);
  for (const event of events) {
    const data = JSON.parse(event);
    console.log(data);
  }
}

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.