Inputs and secrets
Return a string or a JSON-compatible value. TryMCP sends the result to the client as text.
HTTP
sdk.http() accepts method, url, headers, and body. The default method is GET. URLs must use HTTPS. Private network targets are blocked.
API_KEY as a secret.
HTTP errors do not throw by themselves. Check
ok or status. Call json() only when the body is JSON.
Database
Usesdk.db() to open a connection. The examples use PostgreSQL (pg) and MySQL (mysql2). The database must be reachable from TryMCP. Private network targets are blocked.
DB_ secrets above and a required string input named userId.
Use
db.query() for inserts, updates, and deletes. Keep SQL and table names in your code. Pass input values through bindings.
PostgreSQL query results are returned as rows directly. Do not read a .rows property. Use RETURNING when a PostgreSQL write needs to return data.
Lodash
Usesdk.lodash to filter, group, and sort data. template() is disabled.
items.