jPOS MCP Server

io.github.mohisyed由 GitHub 帳號 mohisyed 發布v0.1.1更新於 Oct 24, 2026

MCP server for jPOS and ISO 8583. Deterministic payment protocol tools for AI agents.

概覽

AI 產生的概覽

本機 MCP 伺服器,為 AI 助理提供確定性的 jPOS 與 ISO 8583 參考工具:欄位規格、MTI 解碼、packager XML 產生、部署描述元驗證、訊息驗證與文件檢索。

可以做什麼
查詢 ISO 8583 欄位規格,並將 MTI 解碼為版本、類別、功能與來源及預期回應
適用情境
適合在使用 jPOS 或 ISO 8583 處理支付訊息時使用,讓助理引用經過核實的欄位與 packager 資訊,而不是猜測類別名稱或翻閱程式設計指南。
執行需求
本機需 Python 3.11+ 和 uv 套件管理員;可透過 uvx 或複製儲存庫執行。選用的 search_jpos 工具需要先下載 jPOS 程式設計指南 PDF 並執行擷取腳本建立知識庫,該過程會下載嵌入模型。無需憑證或 API 金鑰。
安裝前請注意
它是參考與驗證工具,不處理真實交易:真實卡號、磁軌資料、CVV、PIN 區塊和真實金鑰絕不能傳入,且它會用 Luhn 檢查拒絕真實卡號。輸入在本機處理;選用的擷取步驟會從網路下載文件與模型。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 jPOS MCP Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

jPOS MCP Server

mcp-name: io.github.mohisyed/jpos-mcp-server

The first open-source MCP server for jPOS and ISO 8583.

[License: MIT] [Python 3.11+] [Tests] [Coverage]

[Demo]

Claude validating a real ISO 8583 financial transaction request using deterministic tools. No guessing — every answer comes from verified data.

An MCP server that gives AI agents (Claude, Cursor, VS Code Copilot) deterministic, verified access to ISO 8583 field specs, MTI decoding, jPOS packager XML generation, deploy descriptor validation, message building, and jPOS documentation search.

No more guessing packager class names. No more scrolling a 300-page PDF. Call a tool, get the right answer.


Table of Contents


Quickstart

Prerequisites: Python 3.11+ and uv package manager.

bash
# 1. Clone and installgit clone https://github.com/mohisyed/JPOS-MCP.gitcd JPOS-MCPuv sync
# 2. (Optional) Set up the knowledge base for semantic searchmkdir -p knowledge/sourcescurl -o knowledge/sources/proguide.pdf https://jpos.org/doc/proguide-draft.pdfuv run python knowledge/ingest.py
# 3. Add to Claude Desktop (see Claude Desktop Setup below)

All 6 tools work immediately after step 1. Step 2 enables the search_jpos RAG tool with real documentation.


Tools

ToolNamespaceWhat It DoesExample Input
lookup_fieldisoReturn full ISO 8583 field spec (name, format, jPOS class, max length)field_number: 35
decode_mtiisoDecode MTI into version, class, function, origin + expected responsemti: "0200"
generate_packagerjposGenerate complete GenericPackager XML from plain English"Visa auth fields 2,3,4,7,11,35,41,42 BCD"
validate_descriptorjposLint a Q2 deploy descriptor (channel, QMUX, TM rules)xml_content: "<qmux>..."
build_messagemsgValidate ISO 8583 field dict (mandatory fields, lengths, PAN safety){"0":"0200", "2":"4111..."}
search_jposdocsSemantic search over jPOS Programmer's Guide (RAG)"How to configure QMUX"

Why deterministic tools instead of LLM inference?

LLMs can guess that field 35 uses IFA_LLVAR, but they sometimes hallucinate class names like IFA_LLTRACK2 (doesn't exist). Our tools read from data/iso_fields.json — a verified lookup table — so the answer is always correct. The AI decides which tool to call; our code provides the facts.


Architecture

┌─────────────────────────────────────────────────────────────────┐│                      AI AGENT CLIENTS                           ││  Claude Desktop  ·  Claude API  ·  Cursor  ·  VS Code Copilot  │└──────────────────────────┬──────────────────────────────────────┘                           │  MCP Protocol (JSON-RPC 2.0)              stdio (local) / Streamable HTTP (Docker)                           │┌──────────────────────────▼──────────────────────────────────────┐│           jpos-mcp-server  (Python / FastMCP v3.1.1)            ││                                                                  ││  main.py                                                         ││  ├── iso_server    [iso]   lookup_field, decode_mti              ││  ├── jpos_server   [jpos]  generate_packager, validate_descriptor││  ├── msg_server    [msg]   build_message                         ││  └── rag_server    [docs]  search_jpos                           ││                                                                  ││  ┌──────────────┐   ┌─────────────────────────────────────────┐  ││  │  DATA LAYER   │   │  KNOWLEDGE LAYER                        │  ││  │  iso_fields   │   │  ChromaDB + sentence-transformers       │  ││  │  mti_table    │   │  Chunked jPOS Programmer's Guide        │  ││  │  mandatory    │   │  + project docs (ISO 8583 deep dive)    │  ││  └──────────────┘   └─────────────────────────────────────────┘  ││  core/ — timeout guardrails, PAN detection, safe logging         │└──────────────────────────────────────────────────────────────────┘

Sub-server composition

The server is split into 4 domain-specific sub-servers mounted via FastMCP.mount(). Each sub-server is independently testable — a bug in the RAG pipeline doesn't prevent ISO field lookups from working. Adding a new domain is one file + one mount() call in main.py.

Timeout guardrails

Every tool is wrapped with @with_timeout() using asyncio.wait_for(). If a tool hangs (e.g., ChromaDB cold start), it returns a structured error dict instead of blocking the entire MCP server. Timeout tiers:

TierTimeoutTools
Fast2slookup_field, decode_mti
Medium5sbuild_message, validate_descriptor
Slow10sgenerate_packager
RAG15ssearch_jpos

Testing

Why we test

Payment systems have zero tolerance for wrong answers. A bad packager class name (IFA_LLVAR vs IFB_LLHEX) causes cryptic byte-level parsing errors that take hours to debug. Our tests verify that every tool returns correct, deterministic results across all input types.

Running tests

bash
# Install dev dependencies (pytest, ruff, black, coverage)uv sync --dev
# Run all 114 tests (unit + MCP integration + E2E workflows)uv run pytest tests/ -v
# Run a single test fileuv run pytest tests/test_iso.py -v
# Run a single test functionuv run pytest tests/test_iso.py::test_decode_mti_request -v
# Run with coverage report (target: 80%+, current: 91%)uv run pytest tests/ --cov=servers --cov=core --cov-report=term-missing
# Lint (must pass with zero errors)uv run ruff check .
# Formatuv run black .

Test structure (114 tests, 3 layers)

FileLayerWhat it covers
test_iso.pyunitlookup_field, decode_mti — valid/invalid fields, MTI categories
test_jpos_tools.pyunitgenerate_packager (BCD/ASCII), validate_descriptor (QMUX, channel-adaptor, txnmgr, malformed XML)
test_message.pyunitbuild_message — valid messages, missing fields, length violations, PAN rejection
test_rag.pyunitQuery expansion, mock collection responses, empty collection handling
test_timeout.pyunit@with_timeout — guardrail fires, fast passes, exceptions caught
test_validators.pyunitluhn_check, contains_likely_real_pan — Luhn edge cases, separators, test PAN whitelist
test_logging.pyunitPaymentSafeFormatter redaction, stderr handler config
test_mcp_integration.pyintegrationTool registration, JSON Schema generation, end-to-end MCP protocol calls
test_e2e.pyE2E workflowMulti-step workflows: Visa auth packager build, reversal debugging, deploy descriptor validation, security boundary, RAG via MCP, system health, error handling

Writing new tests

When adding a tool, cover three categories:

  1. Happy path — valid input returns expected output
  2. Invalid input — bad types, out-of-range values, malformed data return structured errors
  3. Edge cases — boundary values, empty inputs, PCI-sensitive data

All tools are async def, so use @pytest.mark.asyncio:

python
@pytest.mark.asyncioasync def test_my_new_tool():    result = await my_tool("valid input")    assert result["expected_key"] == "expected_value"

Knowledge Base (RAG)

The search_jpos tool uses two-stage hybrid retrieval over jPOS documentation: a bi-encoder (mpnet) for fast candidate retrieval, followed by a cross-encoder reranker for high-precision ordering.

How it works

  1. Ingestion — PDFs and markdown files are cleaned (boilerplate, TOC dot-leaders, page headers stripped) and split into 200-word chunks with 40-word overlap. Low-signal chunks are filtered out at ingest time.
  2. Embedding — Each chunk is encoded into a 768-dimensional vector using all-mpnet-base-v2 and stored in ChromaDB.
  3. Query expansion — Short or jargon-heavy queries (e.g. "STAN", "IFB_LLHEX") get domain context added before embedding so the model has enough signal to disambiguate.
  4. Stage 1 retrieval — Top 25 candidates fetched via cosine similarity.
  5. Stage 2 rerank — Cross-encoder (ms-marco-MiniLM-L-6-v2) scores each (query, chunk) pair by attending across both inputs. This is significantly more accurate than cosine alone.
  6. Display score — Combination of cross-encoder + cosine + rank-position bonus, returned as the top 5 chunks.

The cross-encoder loads lazily on first call (~1s). Falls back to keyword-overlap reranking if the model can't load (offline environments).

Setting up the knowledge base

bash
# Download the jPOS Programmer's Guide (5.3MB PDF)mkdir -p knowledge/sourcescurl -o knowledge/sources/proguide.pdf https://jpos.org/doc/proguide-draft.pdf
# Run ingestion (first run downloads ~80MB mpnet + ~80MB cross-encoder)uv run python knowledge/ingest.py

The ingest script processes:

  • PDFs from knowledge/sources/*.pdf — page-by-page chunking with cleanup
  • Markdown from docs/*.md — section-aware chunking (splits on ## headings)
  • Markdown from knowledge/sources/*.md — for any additional docs you add

Ingestion is idempotent — running it again skips existing chunks and only adds new ones.

Default knowledge base after a full ingest: ~786 chunks across the jPOS Programmer's Guide, ISO 8583-1:2003 spec, Wikipedia reference, jPOS tutorial pages, and project docs.

Adding your own documents

Drop any .pdf or .md files into knowledge/sources/ and re-run:

bash
uv run python knowledge/ingest.py

Good candidates:

  • ISO 8583 reference guides
  • Your organization's interchange spec documentation
  • jPOS tutorial pages (save as markdown)
  • GenericPackager XML examples with annotations

Search quality

Scores are calibrated for the cross-encoder + mpnet pipeline:

ScoreQualityMeaning
0.55+StrongDirect answer in the chunk
0.40–0.55GoodRelevant context, may need synthesis
0.25–0.40PartialTangentially related
<0.25(filtered)Below noise floor — not returned

Benchmark across 25 representative queries: 0.886 average score, 100% strong results.


Docker

Build and run

bash
# Build and start (HTTP transport)docker compose -f docker/docker-compose.yml up -d --build
# View logsdocker compose -f docker/docker-compose.yml logs -f
# Re-ingest docs after adding new sourcesdocker compose -f docker/docker-compose.yml exec jpos-mcp uv run python knowledge/ingest.py
# Check healthdocker compose -f docker/docker-compose.yml exec jpos-mcp curl -sf http://localhost:8000/health

Docker architecture

  • Base image: python:3.11-slim
  • Embedding model pre-downloaded at build time (avoids 30-60s cold start)
  • Non-root user (appuser:1001) for security
  • Persistent volume for ChromaDB data (survives container restarts)
  • Healthcheck every 30s on /health

Claude Desktop with Docker

json
{  "mcpServers": {    "jpos-expert": {      "url": "http://localhost:8000/mcp"    }  }}

Claude Desktop Setup

macOS

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{  "mcpServers": {    "jpos-expert": {      "command": "uv",      "args": ["run", "python", "main.py"],      "cwd": "/ABSOLUTE/PATH/TO/JPOS-MCP"    }  }}

Windows

Edit %APPDATA%\Claude\claude_desktop_config.json:

json
{  "mcpServers": {    "jpos-expert": {      "command": "uv",      "args": ["run", "python", "main.py"],      "cwd": "C:\\ABSOLUTE\\PATH\\TO\\JPOS-MCP"    }  }}

After saving, restart Claude Desktop. All tools appear in the hammer (tools) menu.

Verifying it works

Ask Claude: "What's the jPOS packager class for field 35?"

Claude should call lookup_field(35) and return the exact spec — IFA_LLVAR for ASCII, IFB_LLHEX for BCD — not a guess.


MCP Inspector

The MCP Inspector is a browser-based UI for testing tools interactively:

bash
uv run fastmcp dev inspector main.py:mcp

This opens a browser at http://localhost:6274 where you can:

  • See all registered tools and their JSON Schema
  • Call any tool with custom inputs
  • Inspect responses in real time
  • Debug tool errors without needing Claude Desktop

Security

This server is designed with PCI DSS awareness:

  • Real PANs are rejected — The Luhn algorithm detects real card numbers in any tool input. Only test PANs (4111111111111111, 5500005555555559, etc.) are accepted. This runs before any other processing.
  • Sensitive fields redacted from logs — PaymentSafeFormatter strips fields 2 (PAN), 35 (Track 2), 45 (Track 1), 52 (PIN), 55 (EMV), and 64 (MAC) from all log output.
  • stderr-only logging — stdout is reserved for the JSON-RPC stream (stdio transport). A single print() would corrupt the protocol.
  • Non-root Docker — Container runs as appuser:1001.
  • No credentials — The server stores no keys, tokens, or secrets.
  • Pinned dependencies — fastmcp==3.1.1 exact pin prevents supply chain surprises.
  • Hardcoded tool descriptions — Tool descriptions are in Python decorators, never loaded from external data (prevents injection).

What must never pass through this server

DataReason
Real PANsPCI DSS Requirement 3
Track 1/2/3 dataProhibited after authorization
CVV/CVV2/CVC2PCI DSS 3.2.1
Real cryptographic keysHSM-managed only
PIN blocksMust not traverse uncontrolled layers

Troubleshooting

ModuleNotFoundError: No module named 'fastmcp'

Dependencies aren't installed. Run:

bash
uv sync

search_jpos returns "Knowledge base not initialized"

ChromaDB hasn't been populated. Run:

bash
mkdir -p knowledge/sourcescurl -o knowledge/sources/proguide.pdf https://jpos.org/doc/proguide-draft.pdfuv run python knowledge/ingest.py

Claude Desktop doesn't show tools

  1. Check that cwd in claude_desktop_config.json is an absolute path
  2. Make sure uv is in your PATH (try running uv --version in terminal)
  3. Restart Claude Desktop completely (quit + reopen, not just close window)

Tests fail with import errors

Make sure you installed dev dependencies:

bash
uv sync --dev

print() broke the stdio transport

Any stdout output corrupts JSON-RPC. Find and remove print() statements. Use logging.getLogger(__name__).info() instead — it writes to stderr.

Timeout errors on search_jpos

First call after startup can take 5-10s (ChromaDB + embedding model cold start). The 15s timeout accommodates this. If it persists, check that knowledge/chroma_db/ exists and has data.


Roadmap

  • V1 — MVP — 6 tools, Claude Desktop, Docker, 114 tests (91% coverage), cross-encoder reranked RAG, GitHub Actions CI/security, issue templates, SECURITY.md
  • V2 — Enhanced — Java sidecar (live pack/unpack), custom interchange specs, jPOS log parser, OAuth 2.1, PyPI package, MCP registry submission
  • V3 — Platform — Hosted deployment, multi-spec (Visa/MC/Amex/Discover), horizontal scaling, transaction analytics

See docs/roadmap-and-architecture.md for full details.


Contributing

See CONTRIBUTING.md for setup instructions and guidelines.

License

MIT

來源:README.md,提交 f2321bf

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分