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

@iflow-mcp/jackscodevault-mpesa-daraja-mcp

v1.0.1

Published

MCP Server for Safaricom Daraja API Documentation

Readme

Mpesa Daraja MCP Server

A Model Context Protocol (MCP) server that provides access to Safaricom's Daraja API documentation. This server allows AI assistants to query and retrieve comprehensive documentation for all Daraja APIs.

Features

  • Search APIs: Find specific Daraja APIs by name or description
  • Get Documentation: Retrieve complete documentation for any API
  • List APIs: View all available Daraja APIs
  • API Summaries: Get quick overviews of API functionality

Available Tools

search_daraja_apis

Search through available Daraja API documentation.

  • Parameters: query (optional) - Search term to filter APIs
  • Returns: List of matching APIs with descriptions

get_daraja_api_doc

Get the full documentation for a specific Daraja API.

  • Parameters: api_name (required) - Name of the API
  • Returns: Complete API documentation in markdown format

list_daraja_apis

List all available Daraja APIs.

  • Parameters: None
  • Returns: Complete list of available APIs

get_api_summary

Get a summary of a specific API including key endpoints.

  • Parameters: api_name (required) - Name of the API
  • Returns: Brief summary with key information

Available APIs

The server provides documentation for 22 Daraja APIs including:

  • Core APIs: Authorization, MpesaExpressSimulate (STK Push), CustomerToBusiness, BusinessToCustomer
  • Transaction APIs: TransactionStatus, AccountBalance, Reversal
  • Business APIs: BusinessPayBill, BusinessBuyGoods, B2BExpressCheckout
  • Advanced APIs: DynamicQRCode, BillManager, TaxRemittance
  • Specialized APIs: BusinessToPochi, MpesaRatiba, IotSimManagement, IMSI, Swap

Prerequisites

  1. Scraped Documentation: This server requires the Daraja documentation to be scraped first using the included scraper
  2. Node.js: Version 18 or higher
  3. Documentation Path: The server looks for daraja_docs_v3 directory with scraped data

Installation

# Install dependencies
pnpm install

# Build the project
pnpm run build

Usage

Development Mode

pnpm run dev

Production Mode

pnpm run build
pnpm start

MCP Configuration

Add this server to your MCP configuration:

{
  "mcpServers": {
    "daraja-docs": {
      "command": "node",
      "args": ["path/to/mpesa-daraja-mcp/dist/index.js"],
      "cwd": "path/to/mpesa-daraja-mcp"
    }
  }
}

Project Structure

mpesa-daraja-mcp/
├── src/
│   └── index.ts          # Main MCP server implementation
├── dist/                 # Compiled JavaScript (after build)
├── package.json          # Project dependencies and scripts
├── tsconfig.json         # TypeScript configuration
└── README.md            # This file

Data Requirements

The server expects the scraped Daraja documentation in this structure:

daraja_docs_v3/
├── data_index.json       # Index of all APIs
├── docs/                 # Markdown documentation files
│   ├── Authorization.md
│   ├── MpesaExpressSimulate.md
│   └── ...
└── images/              # Downloaded images
    └── ...

Error Handling

  • If documentation is not found, the server will provide helpful error messages
  • Invalid API names will return a list of available APIs
  • Missing files are handled gracefully with appropriate fallbacks

Development

To extend this server:

  1. Add new tools in the server.tool() sections
  2. Extend the DarajaDocumentationService class for new functionality
  3. Update the documentation and type definitions as needed

License

MIT License