NC

NCP MCP Server for Instant Tool Discovery

Enable instant tool discovery with the MCP server, letting AI articulate needs, reduce token costs up to 87%, and deliver fast, energy-savvy on-demand tools.

Quick Install
npm install -g @portel/ncp

Overview

The NCP MCP Server implements the Model Context Protocol (MCP) to provide instant tool discovery for AI systems. Instead of embedding large tool manifests into prompts or agent contexts, the server lets a model express its needs in natural language and returns concise, structured tool descriptors. This reduces prompt token usage and enables models to find and use the most relevant tooling on demand.

This approach is useful for multi-tool agents, data pipelines, and interactive AI applications where tool lists change frequently or are too large to include directly in model context. By serving lightweight tool metadata and on-demand tool resolution, the MCP server can cut prompt/token costs (reported reductions up to 87% in representative workloads), speed up discovery, and limit unnecessary energy consumption from repeatedly transferring large manifests.

Features

  • Lightweight MCP-compatible server for tool discovery and retrieval
  • Natural-language-driven discovery: ask for capabilities or inputs, get matching tool descriptors
  • Compact tool descriptors that keep model context small
  • Tool registration and versioning API for dynamic ecosystems
  • Caching and on-demand resolution to reduce repeated token transfer
  • Simple HTTP/JSON API (register, list, discover, fetch)
  • Metadata fields for inputs, endpoints, cost/energy estimates, and categories
  • Integration-ready for multi-agent systems and LLM-driven planners

Installation / Configuration

Start by cloning the repository and running the server locally. Two common options are running via Docker or from source.

Clone repository:

git clone https://github.com/portel-dev/ncp
cd ncp

Run with Docker (recommended):

# Build and run with Docker Compose if provided
docker-compose up --build -d
# or run an image (if provided)
docker run -p 8080:8080 porteldev/ncp:latest

Run from source (example using Node.js, replace with the repo’s language/runtime if different):

# install dependencies and start
npm install
npm run build
npm start

Configuration is typically supplied through environment variables or a config file. Example environment variables:

MCP_PORT=8080
MCP_HOST=0.0.0.0
TOOLS_DIR=./tools
CACHE_TTL_SECONDS=300
LOG_LEVEL=info

If the repository includes a configuration file (e.g., config.yaml), adapt these values there.

Available Resources

The MCP server exposes a small set of REST endpoints useful to agents and orchestration code. Example endpoints:

  • GET /health — basic health check
  • GET /tools — list registered tools (paginated)
  • POST /tools — register a new tool (metadata JSON)
  • GET /tools/{id} — fetch the full descriptor for a tool
  • POST /discover — discover tools by natural language or structured query

Tool descriptor schema (typical fields):

{
  "id": "csv-joiner:v1",
  "name": "CSV Joiner",
  "description": "Join two CSV datasets on a key column",
  "inputs": {
    "left_csv": "file",
    "right_csv": "file",
    "join_key": "string"
  },
  "endpoint": "https://tools.example.com/csv/join",
  "method": "POST",
  "cost_estimate": { "tokens": 12, "compute_ms": 120 },
  "energy_estimate": { "joules": 0.05 },
  "tags": ["data", "join", "csv"],
  "version": "v1"
}

Use Cases

  • LLM-driven data analytics: A planner model requests “tool to join two CSVs by a key” and receives a compact descriptor instead of a full manifest, then calls the listed endpoint to perform the operation.
  • Multi-agent orchestration: Agents discover and select specialized tools at runtime without re-sending full capability lists to the model.
  • Cost- and energy-aware selection: Agents filter tools by cost_estimate or energy_estimate to choose greener or cheaper options.
  • Rapid prototyping and plugin ecosystems: Developers register new tools on the server; models can immediately discover them without redeployment.

Concrete examples

  1. Discovering a tool with curl:
curl -sS -X POST http://localhost:8080/discover \
  -H "Content-Type: application/json" \
  -d '{"query":"join two CSV files on a common key and return as CSV"}'
  1. Register a new tool:
curl -X POST http://localhost:8080/tools \
  -H "Content-Type: application/json" \
  -d @csv-joiner.json
  1. Fetch descriptor from an agent (Python):
import requests
r = requests.post("http://localhost:8080/discover", json={"query":"CSV join"})
print(r.json())

Token Savings Example

The benefit of using MCP is a smaller, focused token footprint. Example comparison:

ApproachTypical payload sent to modelRelative token cost
Full manifest in prompt5,000 tokens100%
MCP descriptor reference650 tokens~13%
Reduction observedup to 87%

Actual savings depend on manifest size and how many tools are needed in context. MCP shines when tool catalogs are large or frequently changing.

Tips for Developers

  • Keep tool descriptors minimal: include only fields a model needs to decide whether to call the tool.
  • Use tags and concise descriptions to improve discovery relevance.
  • Provide cost_estimate and energy_estimate when available to enable informed selection.
  • Cache discovered descriptors on the agent side when appropriate to avoid repeated discovery calls.

This MCP server model provides a practical, API-driven way to let language models discover and use tools on demand while keeping token usage and overall resource consumption low.