Skip to content

[FEATURE] MPT: MCP server to run MPT scripts against a James test bench - #3385

Draft
chibenwa wants to merge 4 commits into
apache:masterfrom
chibenwa:mcp-mpt
Draft

chibenwa wants to merge 4 commits into
apache:masterfrom
chibenwa:mcp-mpt

Conversation

@chibenwa

Copy link
Copy Markdown
Contributor

New module mpt/mcp (james-mcp-mpt): a Model Context Protocol server (stdio and streamable HTTP transports) letting an agent validate and run MPT scripts against a configured set of targets (SMTPS 465, IMAPS 993, POP3S 995, ManageSieve over TLS by default). Packaged as a docker image with Jib (apache/james-mcp-mpt).

MPT syntax extensions:

  • runtime ${variables}, regex-quoted in expected server lines
  • named groups of matched server lines are captured as variables
  • UNTIL: skip server lines until one matches
  • SET: / SET-BASE64: define variables (SASL PLAIN helper)
  • STARTTLS: upgrade the session to TLS
  • accurate line numbers in parse errors, regex validated at parse time, failures collected when continuing after failure
New module mpt/mcp (james-mcp-mpt): a Model Context Protocol server (stdio
and streamable HTTP transports) letting an agent validate and run MPT
scripts against a configured set of targets (SMTPS 465, IMAPS 993,
POP3S 995, ManageSieve over TLS by default). Packaged as a docker image
with Jib (apache/james-mcp-mpt).

MPT syntax extensions:
 - runtime ${variables}, regex-quoted in expected server lines
 - named groups of matched server lines are captured as variables
 - UNTIL: skip server lines until one matches
 - SET: / SET-BASE64: define variables (SASL PLAIN helper)
 - STARTTLS: upgrade the session to TLS
 - accurate line numbers in parse errors, regex validated at parse
   time, failures collected when continuing after failure
@chibenwa chibenwa self-assigned this Nov 14, 2026
MPT syntax:
 - IGNORE: skip unexpected lines (e.g. untagged IMAP responses), the
   expected line always wins
 - literals with computed UTF-8 size: C: ... {} / {+} followed by L: /
   L-: lines, the synchronizing continuation is awaited automatically
 - POLL <timeout> <interval> { C: EXPECT: END: } to wait for asynchronous
   deliveries
 - failures report the session and the last command actually sent
   (substituted) with its script line

MCP server:
 - a non passing run always carries a reason, with the server lines left
   unread and the sessions closed by the server
 - MPT_MCP_ARCHIVE_DIR + run_script label: script, transcript and report
   stored server side for every run
 - plain text STARTTLS capable default targets: smtp 25, submission 587,
   imap 143, pop3 110
 - create_account / delete_account through WebAdmin (JWT or Password
   header) for isolated accounts; only accounts created by the server can
   be deleted
@chibenwa
chibenwa marked this pull request as draft November 15, 2026 20:45

@quantranhong1999 quantranhong1999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read it.

I am curious to see a simple demo applying this MPT MCP.

@chibenwa

Copy link
Copy Markdown
Contributor Author

I am curious to see a simple demo applying this MPT MCP.

~100 conformity issues diagnosed - it is terribly effective...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants