Repository avatar
AI Tools
v0.0.1-alpha.7
active

novaposhta

io.github.shopanaio/novaposhta

MCP Server for Nova Poshta API integration with AI assistants

Documentation

@shopana/carrier-api

Modern type-safe API clients for shipping carriers

License TypeScript Monorepo

Features β€’ Packages β€’ Quick Start β€’ Documentation β€’ Contributing


πŸš€ Overview

A production-ready monorepo containing enterprise-grade TypeScript API clients for shipping carriers. Built with modern architecture patterns, each client features plugin-based design, full type safety, and transport-agnostic implementation.

🎯 Why Carrier API?

  • ✨ Type-Safe: Complete TypeScript coverage with strict typing
  • πŸ”Œ Plugin Architecture: Use only what you need, tree-shake the rest
  • 🌐 Universal: Works in Node.js, browsers, and edge runtimes
  • 🎨 Transport-Agnostic: Bring your own HTTP client
  • πŸ€– AI-Ready: MCP server for Claude and other AI assistants
  • πŸ“¦ Zero Config: Sensible defaults, works out of the box

πŸ“¦ Packages

Carrier API Clients

@shopana/novaposhta-api-client

npm version Bundle Size

Nova Poshta API client with plugin architecture and complete type safety.

Features:

  • πŸ”§ Plugin-based services (Address, Reference, Tracking, Waybill, Counterparty, ContactPerson)
  • πŸ“› Namespaced API: client.address.*, client.reference.*, client.tracking.*, client.waybill.*
  • 🎯 Full TypeScript support with strict typing
  • πŸ”„ Transport-agnostic design
  • 🌳 Tree-shakeable - only bundle what you use
  • πŸ“– Comprehensive documentation with examples
npm i @shopana/novaposhta-api-client @shopana/novaposhta-transport-fetch

πŸ“š Documentation


AI Integration

@shopana/novaposhta-mcp-server

npm version MCP MCP Badge

Model Context Protocol (MCP) server for integrating Nova Poshta with AI assistants like Claude.

Features:

  • πŸ€– Full MCP 1.22+ support
  • πŸ“ Comprehensive tracking and address search
  • πŸ“ Waybill creation and management
  • πŸ“š Reference data access
  • πŸ”„ Dual transport (stdio + HTTP)
  • 🏒 Production-ready with enterprise-grade error handling
npx @shopana/novaposhta-mcp-server

πŸ“š Documentation


Transport Implementations

@shopana/novaposhta-transport-fetch

npm version

Fetch-based HTTP transport for Nova Poshta API client.

Features:

  • 🌐 Cross-platform (Node.js, browsers, edge runtimes)
  • βš™οΈ Configurable headers and fetch implementation
  • 🚫 AbortSignal support for request cancellation
  • πŸ“¦ Minimal dependencies
  • ⚑ Lightweight and fast
npm i @shopana/novaposhta-transport-fetch

πŸ“š Documentation


πŸš€ Quick Start

Nova Poshta API Client

import { createClient, AddressService, ReferenceService, TrackingService } from '@shopana/novaposhta-api-client';
import { createFetchHttpTransport } from '@shopana/novaposhta-transport-fetch';

// Create client with plugins
const client = createClient({
  transport: createFetchHttpTransport(),
  baseUrl: 'https://api.novaposhta.ua/v2.0/json/',
  apiKey: process.env.NOVA_POSHTA_API_KEY,
})
  .use(new AddressService())
  .use(new ReferenceService())
  .use(new TrackingService());

// Use the namespaced API
const cities = await client.address.searchCities({ FindByString: 'ΠšΠΈΡ—Π²', Limit: 10 });
const cargoTypes = await client.reference.getCargoTypes();
const tracking = await client.tracking.trackDocument({ Documents: ['20450123456789'] });

console.log('Found cities:', cities.data.length);
console.log('Package status:', tracking.data[0].Status);

MCP Server for AI Assistants

Add to your .mcp.json or Claude Desktop config:

{
  "mcpServers": {
    "novaposhta": {
      "command": "npx",
      "args": ["-y", "-p", "@shopana/novaposhta-mcp-server", "novaposhta-mcp"],
      "env": {
        "NOVA_POSHTA_API_KEY": "your_api_key_here"
      }
    }
  }
}

Then ask Claude:

  • "Track Nova Poshta package 20450123456789"
  • "Find warehouses in Kyiv with POS terminals"
  • "Calculate shipping cost from Kyiv to Lviv for 5kg parcel"

πŸ—οΈ Architecture

All carrier clients in this monorepo follow a consistent, battle-tested design pattern:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Your Application              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Plugin-based API Client            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Address  β”‚ β”‚Reference β”‚ β”‚Tracking β”‚ β”‚
β”‚  β”‚ Service  β”‚ β”‚ Service  β”‚ β”‚ Service β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Transport Layer (Injectable)       β”‚
β”‚         fetch / axios / custom          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Principles

  • πŸ”Œ Plugin-based: Connect only the services you need
  • 🎯 Type-safe: Complete TypeScript coverage with inference
  • 🎨 Transport-agnostic: Use fetch, axios, or custom HTTP client
  • 🌳 Tree-shakeable: Optimal bundle size - only what you use
  • πŸ“› Namespaced API: Clean, organized method calls
  • πŸ§ͺ Testable: Mock transport layer for unit tests

πŸ“š Documentation

Package Documentation

Additional Resources


πŸ› οΈ Development

Prerequisites

  • Node.js 18+ or 20+
  • Yarn 3+ (Yarn Workspaces)

Setup

# Clone the repository
git clone https://github.com/shopanaio/carrier-api.git
cd carrier-api

# Install dependencies
yarn install

# Build all packages
yarn build

Available Scripts

# Development
yarn dev                  # Watch mode for API client
yarn dev:mcp:stdio        # Run MCP server in stdio mode
yarn dev:mcp:http         # Run MCP server in HTTP mode

# Building
yarn build                # Build API client
yarn build:mcp            # Build MCP server

# Testing
yarn test                 # Run all tests
yarn test:watch           # Run tests in watch mode
yarn test:coverage        # Generate coverage report
yarn test:mcp             # Run MCP server tests

# Code Quality
yarn lint                 # Lint TypeScript files
yarn lint:fix             # Fix linting issues
yarn format               # Format code with Prettier
yarn format:check         # Check code formatting
yarn type-check           # Run TypeScript type checking

Project Structure

carrier-api/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ novaposhta-api-client/       # Core API client
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ core/                # Client core logic
β”‚   β”‚   β”‚   β”œβ”€β”€ services/            # Service plugins
β”‚   β”‚   β”‚   β”œβ”€β”€ types/               # TypeScript types
β”‚   β”‚   β”‚   └── index.ts
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   β”œβ”€β”€ novaposhta-mcp-server/       # MCP server for AI
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ cli/                 # CLI entry points
β”‚   β”‚   β”‚   β”œβ”€β”€ tools/               # MCP tools
β”‚   β”‚   β”‚   β”œβ”€β”€ server.ts            # Server implementation
β”‚   β”‚   β”‚   └── config.ts
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   └── novaposhta-transport-fetch/  # Fetch transport
β”‚       β”œβ”€β”€ src/
β”‚       └── package.json
β”‚
β”œβ”€β”€ e2e/                             # End-to-end tests
β”œβ”€β”€ postman/                         # Postman collections
β”œβ”€β”€ .mcp.json                        # MCP server config
└── package.json                     # Root package.json

🀝 Contributing

We welcome contributions from the community! Whether it's bug fixes, new features, documentation improvements, or examples - all contributions are appreciated.

How to Contribute

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes: Follow our coding standards
  4. Add tests: Ensure your changes are tested
  5. Run tests: yarn test - make sure everything passes
  6. Commit your changes: git commit -m 'feat: add amazing feature'
  7. Push to your fork: git push origin feature/amazing-feature
  8. Open a Pull Request

Development Guidelines

  • Write clean, readable TypeScript code
  • Follow the existing code style
  • Add tests for new functionality
  • Update documentation as needed
  • Use conventional commits (feat, fix, docs, chore, etc.)

Reporting Issues

Found a bug or have a feature request? Please open an issue with:

  • Clear description of the issue
  • Steps to reproduce (for bugs)
  • Expected vs actual behavior
  • Environment details (Node.js version, OS, etc.)

πŸ—ΊοΈ Roadmap

Planned Features

  • Additional carrier integrations
  • GraphQL API layer
  • React hooks package
  • CLI tool for common operations
  • Webhook handling utilities
  • Rate limiting and retry strategies
  • Caching layer with configurable adapters

Future Carriers

Eastern Europe:

  • Ukrposhta
  • Meest
  • Justin
  • Delivery

International:

  • DHL
  • FedEx
  • UPS
  • DPD

Want to help implement these? Contributions welcome!


πŸ“Š Status

PackageVersionBuildCoverageDownloads
@shopana/novaposhta-api-clientnpmBuildCoverageDownloads
@shopana/novaposhta-mcp-servernpmBuildCoverageDownloads
@shopana/novaposhta-transport-fetchnpmBuildCoverageDownloads

πŸ“„ License

Apache License 2.0 - see LICENSE for details.

This project is licensed under the Apache License 2.0, which means:

  • βœ… Commercial use allowed
  • βœ… Modification allowed
  • βœ… Distribution allowed
  • βœ… Patent use allowed
  • βœ… Private use allowed

πŸ’¬ Support & Community


πŸ™ Acknowledgments


Made with ❀️ by Shopana.io

GitHub stars GitHub forks GitHub watchers

⬆ Back to Top