@coldbirds/mcp-server 1.0.1 → 1.0.2
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/dist/tools.js +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.__internals=void 0,exports.registerTools=registerTools;const types_js_1=require("@modelcontextprotocol/sdk/types.js"),json_schema_to_zod_1=require("./json-schema-to-zod"),PLACEHOLDER_RE=/\{(\w+)\}/g;function pathParams(t){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.__internals=void 0,exports.registerTools=registerTools;const types_js_1=require("@modelcontextprotocol/sdk/types.js"),json_schema_to_zod_1=require("./json-schema-to-zod"),PLACEHOLDER_RE=/\{(\w+)\}/g;function pathParams(t){const e=[];for(const o of t.matchAll(PLACEHOLDER_RE)){const n=o[1];n&&e.push(n)}return e}function stringifyPathValue(t,e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);throw new Error(`Path parameter '${t}' must be a string, number, or boolean (got ${typeof e})`)}function interpolate(t,e){return t.replace(PLACEHOLDER_RE,(o,n)=>{const r=e[n];if(r==null)throw new Error(`Missing required path parameter '${n}'`);return encodeURIComponent(stringifyPathValue(n,r))})}function remainingArgs(t,e){const o={};for(const[n,r]of Object.entries(t))e.includes(n)||(o[n]=r);return o}function asQuery(t){return t}async function dispatch(t,e,o){const{method:n,path:r}=e._http,s=pathParams(r),c=interpolate(r,o),u=remainingArgs(o,s),i=Object.keys(u).length>0;switch(n){case"GET":return t.get(c,i?u:void 0);case"POST":return t.post(c,i?u:void 0);case"PATCH":return t.patch(c,i?u:void 0);case"DELETE":return await t.delete(c)??{ok:!0}}}function ok(t){return{content:[{type:"text",text:JSON.stringify(t,null,2)}]}}function fail(t){return{content:[{type:"text",text:t}],isError:!0}}function isRecord(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function toStructured(t,e){if(!t.outputSchema||!isRecord(e))return;const o=t.outputSchema.properties;if(isRecord(o)&&"data"in o){const{success:r,...s}=e;return s}return"data"in e&&isRecord(e.data)?e.data:e}function buildHandler(t,e){return async o=>{try{const n=await dispatch(t,e,o),r=toStructured(e,n),s=ok(r??n);return r!==void 0?{...s,structuredContent:r}:s}catch(n){const r=n instanceof Error?n.message:String(n);return fail(`Tool '${e.name}' failed: ${r}`)}}}function buildInputSchema(t){const e=(0,json_schema_to_zod_1.jsonSchemaToZod)(t.inputSchema);if(e._def?.typeName!=="ZodObject")throw new Error(`Tool '${t.name}' inputSchema must be a JSON-Schema object at the root`);return e}function registerTools(t,e,o){for(const n of o.tools){const r={description:n.description,inputSchema:buildInputSchema(n)};n.title&&(r.title=n.title),t.registerTool(n.name,r,buildHandler(e,n))}t.server.setRequestHandler(types_js_1.ListToolsRequestSchema,()=>({tools:o.tools.map(n=>{const{_http:r,...s}=n;return s})}))}exports.__internals={dispatch,pathParams,interpolate,remainingArgs,toStructured};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coldbirds/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "MCP server for ColdBirds Sequence — control campaigns, contacts, and mailboxes from AI assistants like Claude Desktop, Cursor, and Windsurf.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coldbirds",
|