npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@graphai/mcp_agent

v0.0.4

Published

Model Context Protocol

Readme

@graphai/mcp_agent for GraphAI

Model Context Protocol

Install

yarn add @graphai/mcp_agent

Configuring each service via mcpConfig

Each service is defined as a pair of command and args. This pattern can be extended to other applications as well.

export const mcpConfig = {
  filesystem: {
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-filesystem", path],
  },
  filesystem2: {
    command: __dirname + "/../../../node_modules/@modelcontextprotocol/server-filesystem/dist/index.js",
    args: [path],
  },
};

Initializing MCP and connecting to the server

MCP must be started before running GraphAI. Since the startup time may vary, it’s recommended to include a waiting period to ensure the server is ready. If GraphAI is run before MCP finishes initializing, the list of tools might be returned as empty.

The function that initializes MCP returns mcpClients. Since mcpClients is required when calling MCP, it is passed as a config to the GraphAI instance. It is also needed when closing the connection to the MCP server.

  const mcpClients = await mcpInit(mcpConfig);
  await setTimeout(2000);

Pass the client to the GraphAI instance.

When creating a GraphAI instance, mcpClients is passed via the config. Since MCP is divided into multiple agents, mcpClients is provided globally (although it's also possible to pass it individually).

  const graphai = new GraphAI(graphData, agents, { config: { global: { mcpClients } } });

Disconnecting from the MCP server

Be sure to explicitly disconnect from the MCP server when your batch job or server (e.g., Express) shuts down.

  await setTimeout(500);
  mcpClose(mcpClients);

Usage

import { GraphAI } from "graphai";
import { mcpResourceAgent, mcpResourcesAgent, mcpToolsCallAgent, mcpToolsListAgent } from "@graphai/mcp_agent";

const agents = { mcpResourceAgent, mcpResourcesAgent, mcpToolsCallAgent, mcpToolsListAgent };

const graph = new GraphAI(graph_data, agents);
const result = await graph.run();

Agents description

  • mcpResourceAgent - Model Context Protocol Resource Agent
  • mcpResourcesAgent - Model Context Protocol Resources Agent
  • mcpToolsCallAgent - Model Context Protocol Tools/Call Agent
  • mcpToolsListAgent - Model Context Protocol Tools/List Agent

Input/Output/Params Schema & samples

Input/Params example

  • mcpResourcesAgent
{
  "inputs": {},
  "params": {}
}
  • mcpToolsCallAgent
{
  "inputs": {
    "tools": {
      "name": "filesystem--list_directory",
      "arguments": {
        "path": "/home/runner/work/graphai-agents/graphai-agents/protocol/mcp-agent/lib/../tests/sample"
      }
    }
  },
  "params": {}
}
{
  "inputs": {
    "tools": {
      "name": "filesystem--list_directory",
      "arguments": {
        "path": "/home/runner/work/graphai-agents/graphai-agents/protocol/mcp-agent/lib/../tests/sample"
      }
    }
  },
  "params": {
    "mcpClientsKey": "key"
  }
}
  • mcpToolsListAgent
{
  "inputs": {},
  "params": {
    "services": [
      "filesystem"
    ]
  }
}

Related Agent Packages