Langchain

Provides an integrated Langchain-based MCP interface with Ollama LLM and tool execution via MCP servers.
  • typescript

0

GitHub Stars

typescript

Language

7 months ago

First Indexed

3 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs

You can run a TypeScript-based MCP server that lets a chat interface interact with an LLM (via Ollama) and execute MCP tools through a remote MCP server. This setup makes it possible to query tools and receive structured actions and results within a single conversation.

How to use

You will connect to a running MCP server from your client to start conversations with the integrated LLM. Your client can prompt the model to call available MCP tools and perform actions, receive results, and continue the dialogue. Use this flow to ask questions, request tool executions, and obtain responses that incorporate tool results in real time. The system is designed to allow only one tool call at a time, ensuring you get clear, predictable results.

How to install

Prerequisites you need before you begin:

  • Node.js v14 or higher
  • npm
  • Ollama server running locally
  • MCP server running locally

Then follow these concrete steps to set up and run the MCP-enabled environment:

git clone https://github.com/shashwat001/mcptools-langchain-integration.git
cd mcptools-langchain-integration
npm install

# Start services in separate terminals
# 1) Ollama server should be running locally
# 2) MCP server should be running locally
# 3) Run the application
node src/index.js

Configuration and security

Configure the LLM and MCP integration to ensure smooth operation. The Ollama client is set up to connect to a local Ollama instance, and the MCP server is accessed over SSE for real-time responses. Review tool permissions and expected impacts before enabling tool calls in your environment.

export const ollamaConfig = {
  baseUrl: "http://localhost:11434",
  model: "llama3.1:8b-instruct-q6_K",
  temperature: 0.1,
  maxRetries: 2
};

export const mcpConfig = {
  serverUrl: 'http://localhost:7000/sse',
  clientInfo: {
    name: 'ollama-client',
    version: '1.0.0'
  }
};

System prompts govern how the tool interactions are handled. This default prompts the system to access tools and to decide when to call them.

export const systemPromptForTools = "In this environment you have access to a set of tools you can use to answer the user's question.\n Don't ask user to execute the functions and decide yourself whether to call the tool or not.\nNever call more than one tool at a time."
Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational