@forwardimpact/libmcp
Advanced tools
+13
-7
| { | ||
| "name": "@forwardimpact/libmcp", | ||
| "version": "0.1.5", | ||
| "version": "0.1.6", | ||
| "description": "Config-driven gRPC-to-MCP tool registration — agents see protobuf services as MCP tools.", | ||
@@ -11,2 +11,10 @@ "keywords": [ | ||
| ], | ||
| "homepage": "https://www.forwardimpact.team", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/forwardimpact/monorepo.git", | ||
| "directory": "libraries/libmcp" | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "author": "D. Olsson <hi@senzilla.io>", | ||
| "forwardimpact": { | ||
@@ -18,4 +26,2 @@ "capability": "agent-infrastructure", | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "author": "D. Olsson <hi@senzilla.io>", | ||
| "type": "module", | ||
@@ -29,6 +35,2 @@ "main": "./src/index.js", | ||
| ], | ||
| "engines": { | ||
| "bun": ">=1.2.0", | ||
| "node": ">=18.0.0" | ||
| }, | ||
| "scripts": { | ||
@@ -44,2 +46,6 @@ "test": "bun test test/*.test.js" | ||
| }, | ||
| "engines": { | ||
| "bun": ">=1.2.0", | ||
| "node": ">=18.0.0" | ||
| }, | ||
| "publishConfig": { | ||
@@ -46,0 +52,0 @@ "access": "public" |
+21
-9
@@ -6,2 +6,22 @@ import * as types from "@forwardimpact/libtype"; | ||
| /** | ||
| * Normalizes raw MCP tool params against field metadata. | ||
| * Repeated fields become arrays; scalar fields default to empty string. | ||
| * @param {object} params - Raw params from MCP tool call | ||
| * @param {object} fields - Field metadata from codegen | ||
| * @returns {object} Normalized params | ||
| */ | ||
| function normalizeParams(params, fields) { | ||
| const normalized = {}; | ||
| for (const [k, v] of Object.entries(params)) { | ||
| const field = fields[k]; | ||
| if (field?.repeated) { | ||
| normalized[k] = Array.isArray(v) ? v : v ? [v] : []; | ||
| } else { | ||
| normalized[k] = v || ""; | ||
| } | ||
| } | ||
| return normalized; | ||
| } | ||
| /** | ||
| * Register MCP tools from config endpoints using codegen metadata. | ||
@@ -53,11 +73,3 @@ * | ||
| server.tool(toolName, endpoint.description, schema, async (params) => { | ||
| const normalized = {}; | ||
| for (const [k, v] of Object.entries(params)) { | ||
| const field = methodMeta.fields[k]; | ||
| if (field?.repeated) { | ||
| normalized[k] = Array.isArray(v) ? v : v ? [v] : []; | ||
| } else { | ||
| normalized[k] = v || ""; | ||
| } | ||
| } | ||
| const normalized = normalizeParams(params, methodMeta.fields); | ||
| const req = RequestClass.fromObject(normalized); | ||
@@ -64,0 +76,0 @@ const result = await client[methodName](req); |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
17518
3.37%136
8.8%1
-50%0
-100%