Skip to main content
Glama
devashishkumar

OpenRouter LangChain MCP Server

OpenRouter LangChain MCP Server

A small command-line chatbot that lets an OpenRouter model query MongoDB through a Model Context Protocol (MCP) server.

The project has two processes:

  • server.js exposes MongoDB query tools over MCP stdio transport.

  • client.js connects to the server, binds its tools to a LangChain OpenRouter model, and provides an interactive chat prompt.

Requirements

Related MCP server: mcp-mongo

Setup

  1. Install dependencies:

    npm install
  2. Create a .env file in the project root:

    OPENROUTER_API_KEY=your_openrouter_api_key
    MONGODB_URI=mongodb://localhost:27017

    MONGODB_URI is optional and defaults to mongodb://localhost:27017.

  3. Start the interactive client:

    npm start

The client starts server.js automatically over stdio, so the MCP server does not need to be started separately.

First run

The server uses the chatbot_db database. If both the users and orders collections are missing, it creates them and inserts sample records. Existing collections are left unchanged.

The sample data includes:

  • users: user IDs, names, email addresses, and statuses

  • orders: order IDs, user IDs, products, and amounts

Available MCP tools

get_collections

Lists the collections in the configured MongoDB database.

query_collection

Runs a MongoDB find query. It accepts:

  • collection (required): collection name, such as users or orders

  • filter (optional): MongoDB filter object

  • limit (optional): maximum number of documents to return; defaults to 10

Examples of questions to ask the chatbot:

Which users are active?
Show orders over $100.
What products did user 1 order?
List the available collections.

Type exit to close the client.

Configuration

The client currently uses the OpenRouter model identifier:

nvidia/nemotron-3-ultra-550b-a55b:free

To use another OpenRouter-supported model, change the model value in client.js.

Project structure

.
├── client.js   # Interactive LangChain client
├── server.js   # MCP server and MongoDB tools
├── package.json
└── README.md

Notes

  • Keep .env out of version control because it contains your API key.

  • The MCP server logs connection and seeding messages to stderr so they do not interfere with the stdio protocol.

  • The npm start script runs client.js, which starts the MCP server automatically over stdio.

Chatbot

Chatbot Chatbot

Users Collection

Chatbot

Orders Collection

Chatbot

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases. Query collections, inspect schemas, and manage data seamlessly through natural language.
    47
    175
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to query and introspect MongoDB databases through find, aggregate, and schema discovery operations. Supports read-only default mode with optional write capabilities and works with any MCP-compatible client via stdio or HTTP transports.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables CRUD operations on MongoDB databases and collections, including listing databases and collections, via MCP tools.
    28
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with MongoDB databases through natural language, supporting document CRUD, aggregation, collection listing, and statistics.
    78,836
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/devashishkumar/openrouter-langchain-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server