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

mf-tool

v1.0.4

Published

Easily fetch Indian Mutual Fund data like NAV, scheme info, and historical records through a simple Node.js API client

Readme

Indian MF Tool

npm version License: MIT

A lightweight Node.js and TypeScript utility for fetching Indian Mutual Fund data from mfapi.in, including scheme details, NAVs, and historical data.

Features

  • Fetch complete list of Indian Mutual Fund schemes
  • Search for specific Mutual Fund schemes by name
  • Get latest NAV for any Mutual Fund scheme
  • Retrieve historical NAV data
  • Automatic local caching for improved performance

Installation

npm install mf-tool

Quick Start

import { MfTool } from 'mf-tool';

// Initialize the tool
const mfTool = new MfTool();

// Example: Search for a mutual fund scheme
async function findScheme() {
  const schemes = await mfTool.findSchemaCodeReference('SBI Blue Chip');
  console.log(schemes);
}

// Example: Get NAV details for a specific scheme
async function getNavDetails() {
  const navDetails = await mfTool.getFundNavDetails('123456');
  console.log(navDetails);
}

API Reference

new MfTool()

Creates a new instance of the MF Tool.

updateSchemaCodes(forcePull?: boolean): Promise<void>

Updates the local cache of mutual fund scheme codes.

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | forcePull | boolean | false | When true, ignores local cache and fetches fresh data from API |

findSchemaCodeReference(userInput: string): Promise<SchemaCodeReference[]>

Searches for mutual fund schemes that match the input string.

| Parameter | Type | Description | |-----------|------|-------------| | userInput | string | Search term for mutual fund scheme names |

Returns: Array of matching SchemaCodeReference objects

getAllSchemaCodeReference(): Promise<SchemaCodeReference[]>

Retrieves all available mutual fund schemes.

Returns: Array of all SchemaCodeReference objects

getFundNavDetails(schemaCode: string, needHistoric?: boolean): Promise<NavDetails>

Fetches NAV details for a specific mutual fund scheme.

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | schemaCode | string | | The unique code of the mutual fund scheme | | needHistoric | boolean | false | When true, includes historical NAV data |

Returns: NavDetails object containing the NAV information

Example Usage

Finding a Mutual Fund Scheme

import { MfTool } from 'indian-mf-tool';

async function searchFund() {
  const mfTool = new MfTool();
  
  // Search for HDFC funds
  const hdcpFunds = await mfTool.findSchemaCodeReference('HDFC');
  
  // Print the first 5 results
  console.log(hdcpFunds.slice(0, 5));
}

searchFund();

Getting NAV Details

import { MfTool } from 'indian-mf-tool';

async function getNavInfo() {
  const mfTool = new MfTool();
  
  // First find the scheme code
  const schemes = await mfTool.findSchemaCodeReference('Axis Bluechip Fund');
  
  if (schemes.length > 0) {
    // Get NAV details for the first matching scheme
    const navDetails = await mfTool.getFundNavDetails(schemes[0].schemaCode);
    console.log(`Latest NAV: ${navDetails.data.nav}`);
    console.log(`Date: ${navDetails.data.date}`);
  }
}

getNavInfo();

Working with Historical Data

import { MfTool } from 'indian-mf-tool';

async function getHistoricalNav() {
  const mfTool = new MfTool();
  
  // Get scheme with historical data
  const schemeCode = '119551'; // Example scheme code
  const navDetails = await mfTool.getFundNavDetails(schemeCode, true);
  
  // Access historical data
  const historicalData = navDetails.data.navHistory;

  console.log(historicalData);
}

getHistoricalNav();

Data Types

SchemaCodeReference

interface SchemaCodeReference {
  schemaCode: string;
  schemeName: string;
}

Error Handling

import { MfTool } from 'indian-mf-tool';

async function handleErrors() {
  const mfTool = new MfTool();
  
  try {
    // Using an invalid scheme code
    const navDetails = await mfTool.getFundNavDetails('invalid-code');
    console.log(navDetails);
  } catch (error) {
    console.error('Error fetching NAV details:', error.message);
  }
}

handleErrors();

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on our GitHub repository.

License

MIT License - see the LICENSE file for details.

Acknowledgements