@mcp-com-ai/plugin-sdk 1.0.1-beta.260912 → 1.0.1-beta.260914
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -46
- package/dist/index.js +11 -11
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
<!--
|
|
2
|
+
MCP.com.ai — Server Registry
|
|
3
|
+
Deploying & Registering MCP Servers
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<img src="https://img.shields.io/badge/MCP-Model%20Context%20Protocol-1193b0?style=for-the-badge" />
|
|
8
|
+
<img src="https://img.shields.io/badge/Server%20Registry-Deploy%20%26%20Discover-da7756?style=for-the-badge" />
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<h1 align="center">MCP Server Registry Integration</h1>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<b>Build Once. Deploy Everywhere. Discover Globally.</b><br/>
|
|
15
|
+
Self-host, deploy, and register MCP servers with confidence using HAPI CLI, Docker, or Cloudflare Workers.
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://mcp.com.ai"><b>Website</b></a>
|
|
20
|
+
·
|
|
21
|
+
<a href="https://docs.mcp.com.ai"><b>Docs</b></a>
|
|
22
|
+
·
|
|
23
|
+
<a href="https://registry.modelcontextprotocol.io/?q=ai.com.mcp"><b>MCP Registry</b></a>
|
|
24
|
+
·
|
|
25
|
+
<a href="https://run.mcp.com.ai"><b>Run MCP</b></a>
|
|
26
|
+
·
|
|
27
|
+
<a href="https://hapi.mcp.com.ai"><b>HAPI CLI</b></a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# HAPI plugin SDK 
|
|
33
|
+
|
|
34
|
+
`@mcp-com-ai/plugin-sdk` is the contract that lets HAPI plugins work with the
|
|
35
|
+
`hapi` command. It is for plugin authors, not for people simply serving an API
|
|
36
|
+
or workflow as MCP.
|
|
37
|
+
|
|
38
|
+
To run an OpenAPI API or Arazzo workflow, install the CLI and the appropriate
|
|
39
|
+
document plugin instead:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
bun add -g @mcp-com-ai/hapi @mcp-com-ai/plugin-openapi
|
|
43
|
+
hapi serve --specs ./openapi.yaml --mcp
|
|
41
44
|
```
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`HAPI_CLI_API_VERSION`. Any breaking change bumps the major.** The CLI
|
|
47
|
-
refuses to load plugins whose `compatibility.cliApiVersion` does not
|
|
48
|
-
match the CLI's advertised version.
|
|
46
|
+
The CLI and first-party plugins install this package automatically. Keep it on
|
|
47
|
+
the same version as the HAPI packages that depend on it. Plugin-development
|
|
48
|
+
material is intentionally kept out of this end-user package guide.
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
3
|
-
${
|
|
4
|
-
`),e.arguments?.length){
|
|
2
|
+
var I="1.0.1-beta.260914";var P=Number(I.split(".")[0]);function H(e){return e}function V(e){if(!e.name)throw Error("HAPI plugin missing required `name`");if(!e.version)throw Error(`HAPI plugin '${e.name}' missing required \`version\``);if(!e.compatibility?.cliApiVersion)throw Error(`HAPI plugin '${e.name}' must declare compatibility.cliApiVersion (current: '${P}')`);if(!Array.isArray(e.commands))throw Error(`HAPI plugin '${e.name}' must declare a commands[] array`);let n=new Set;for(let t of e.serveProviders??[]){if(!t.id||!t.kind||!t.rootField||!t.description)throw Error(`HAPI plugin '${e.name}' has an invalid serve provider declaration`);if(typeof t.serve!=="function")throw Error(`HAPI plugin '${e.name}' serve provider '${t.id}' must declare serve()`);if(n.has(t.id))throw Error(`HAPI plugin '${e.name}' declares duplicate serve provider '${t.id}'`);n.add(t.id)}return e}function N(e,n=[],t={}){let a=t.allowUnknown??!0,i=[],r=[],o={};for(let s of n)if(s.env&&process.env[s.env]!==void 0)o[s.name]=w(process.env[s.env],s);else if(s.default!==void 0)o[s.name]=s.default;let l=new Map,h=new Map;for(let s of n)if(l.set(s.name,s),s.alias)h.set(s.alias,s);let c=0;while(c<e.length){let s=e[c];if(s==="--"){r.push(...e.slice(c+1));break}if(s.startsWith("--")){let u=s.slice(2),p=u.indexOf("="),d=p>=0?u.slice(0,p):u,m=p>=0?u.slice(p+1):void 0,f=d.startsWith("no-"),g=f?d.slice(3):d,C=l.get(g)??l.get(R(g));if(!C){if(!a)throw Error(`Unknown option: --${d}`);if(m!==void 0)o[v(d)]=m,c++;else if(f)o[v(g)]=!1,c++;else{let x=e[c+1];if(x!==void 0&&!String(x).startsWith("-"))o[v(d)]=x,c+=2;else o[v(d)]=!0,c++}continue}if(C.type==="boolean"){o[C.name]=f?!1:m?A(m):!0,c++;continue}let b=m;if(b===void 0)b=e[c+1],c+=b!==void 0&&!String(b).startsWith("-")?2:1;else c++;if(C.type==="array"){let x=o[C.name]??[];o[C.name]=[...x,...String(b??"").split(",").map((O)=>O.trim()).filter(Boolean)]}else o[C.name]=w(b,C);continue}if(s.startsWith("-")&&s.length>1){let u=s.slice(1),p=u.indexOf("="),d=p>=0?u.slice(0,p):u,m=p>=0?u.slice(p+1):void 0,f=h.get(d);if(!f){if(!a)throw Error(`Unknown option: -${d}`);i.push(s),c++;continue}if(f.type==="boolean"){o[f.name]=m?A(m):!0,c++;continue}let g=m;if(g===void 0)g=e[c+1],c+=g!==void 0&&!String(g).startsWith("-")?2:1;else c++;o[f.name]=w(g,f);continue}i.push(s),c++}return{positionals:i,options:o,rest:r}}function w(e,n){if(e===void 0)return e;switch(n.type){case"number":{let t=Number(e);return Number.isFinite(t)?t:e}case"boolean":return A(e);case"array":return String(e).split(",").map((t)=>t.trim()).filter(Boolean);default:return String(e)}}function A(e){if(typeof e==="boolean")return e;let n=String(e).toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}function R(e){return e.replace(/-([a-z0-9])/g,(n,t)=>t.toUpperCase())}function v(e){return R(e)}function L(e,n,t=[]){let a=t.length?`${t.join(" ")} `:"",i=(r)=>n.stdout.write(r);if(i(`
|
|
3
|
+
${a}${e.name} \u2014 ${e.description}
|
|
4
|
+
`),e.arguments?.length){i(`
|
|
5
5
|
Arguments:
|
|
6
|
-
`);for(let
|
|
7
|
-
`)}}if(e.options?.length){
|
|
6
|
+
`);for(let r of e.arguments){let o=r.variadic?`${r.name}...`:r.name,l=r.required?`<${o}>`:`[${o}]`;i(` ${l.padEnd(24)} ${r.description}
|
|
7
|
+
`)}}if(e.options?.length){i(`
|
|
8
8
|
Options:
|
|
9
|
-
`);for(let
|
|
10
|
-
`)}}if(e.subcommands?.length){
|
|
9
|
+
`);for(let r of e.options){let o=r.alias?`-${r.alias}, --${r.name}`:` --${r.name}`,l=r.default!==void 0?`${r.description} (default: ${JSON.stringify(r.default)})`:r.description;i(` ${o.padEnd(28)} ${l}
|
|
10
|
+
`)}}if(e.subcommands?.length){i(`
|
|
11
11
|
Subcommands:
|
|
12
|
-
`);for(let
|
|
13
|
-
`)}}if(e.longHelp)
|
|
12
|
+
`);for(let r of e.subcommands){if(r.hidden)continue;i(` ${r.name.padEnd(14)} ${r.description}
|
|
13
|
+
`)}}if(e.longHelp)i(`
|
|
14
14
|
${e.longHelp}
|
|
15
|
-
`);
|
|
16
|
-
`)}var
|
|
15
|
+
`);i(`
|
|
16
|
+
`)}var _=Object.freeze({maxBytes:5242880,timeoutMs:1e4,maxRedirects:5});function j(e){if(e.protocol!=="http:"&&e.protocol!=="https:")throw Error(`Remote documents cannot resolve ${e.protocol} sources`)}function D(e){try{let n=e instanceof URL?new URL(e.href):new URL(e);if(n.username="",n.password="",n.search)n.search="?redacted";return n.href}catch{return String(e)}}var W=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z.-]+)?$/,k=/^(<=|>=|<|>|=)?(\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z.-]+)?)$/;function q(e,n){let t=y(e);if(!t||!E(n))return!1;if(n.startsWith("^")){let i=y(n.slice(1));return i!==void 0&&S(t,i)>=0&&S(t,M(i))<0}let a=n.trim().split(/\s+/).filter(Boolean);return a.length>0&&a.every((i)=>{let r=i.match(k);if(!r)return!1;let o=r[2];if(!o)return!1;let l=y(o);if(!l)return!1;let h=S(t,l);switch(r[1]??"="){case"=":return h===0;case">":return h>0;case">=":return h>=0;case"<":return h<0;case"<=":return h<=0;default:return!1}})}function E(e){if(e.startsWith("^"))return y(e.slice(1))!==void 0;let n=e.trim().split(/\s+/).filter(Boolean);return n.length>0&&n.every((t)=>{let i=t.match(k)?.[2];return i!==void 0&&y(i)!==void 0})}function y(e){let n=e.match(W);if(!n)return;return{major:Number(n[1]),minor:Number(n[2]),patch:Number(n[3]),prerelease:n[4]?.split(".")??[]}}function M(e){if(e.major>0)return{major:e.major+1,minor:0,patch:0,prerelease:["0"]};if(e.minor>0)return{major:0,minor:e.minor+1,patch:0,prerelease:["0"]};return{major:0,minor:0,patch:e.patch+1,prerelease:["0"]}}function S(e,n){for(let a of["major","minor","patch"])if(e[a]!==n[a])return e[a]<n[a]?-1:1;if(e.prerelease.length===0||n.prerelease.length===0){if(e.prerelease.length===n.prerelease.length)return 0;return e.prerelease.length===0?1:-1}let t=Math.max(e.prerelease.length,n.prerelease.length);for(let a=0;a<t;a++){let i=e.prerelease[a],r=n.prerelease[a];if(i===void 0)return-1;if(r===void 0)return 1;if(i===r)continue;let o=/^\d+$/.test(i),l=/^\d+$/.test(r);if(o&&l)return Number(i)<Number(r)?-1:1;if(o!==l)return o?-1:1;return i<r?-1:1}return 0}export{_ as DEFAULT_DOCUMENT_SOURCE_POLICY,P as HAPI_CLI_API_VERSION,j as assertRemoteDocumentUrl,H as defineCommand,V as definePlugin,E as isSupportedVersionRange,N as parseArgs,D as redactDocumentUrl,L as renderCommandHelp,q as satisfiesVersionRange};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-com-ai/plugin-sdk",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.260914",
|
|
4
4
|
"description": "The shared plugin contract for the HAPI CLI. Consumed by the core CLI, first-party plugins, and third-party extensions.",
|
|
5
5
|
"license": "LRL-CL",
|
|
6
6
|
"type": "module",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"typescript": "^5"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
31
|
-
},
|
|
32
|
-
"keywords": ["hapi", "hapi-plugin", "mcp", "cli"]
|
|
27
|
+
"bun": ">=1.3.0"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"keywords": ["hapi", "hapi-plugin", "mcp", "cli"]
|
|
33
33
|
}
|