instamcp
v1.0.0
Published
MCP server that exposes tools from instamcp.js
Readme
instamcp
An instant MCP (Model Context Protocol) server for Node.js. Define tools in instamcp.js and they're immediately available via HTTP/HTTPS endpoints - no configuration needed. Uses Node.js built-in web server (no dependencies).
Quick Start
Using npx (recommended)
Run directly with npx, specifying the path to your tools file:
npx instamcp ./my-tools.jsOr use the default instamcp.js in the current directory:
npx instamcpHTTPS Support
To run with HTTPS, first generate SSL certificates:
npm run generate-certs
# or
node generate_certs.jsThen start the server with HTTPS:
npx instamcp --httpsOr specify custom certificate paths:
npx instamcp --https --key ./custom-key.pem --cert ./custom-cert.pemLocal Installation
npm install
npm startOr install globally:
npm install -g instamcp
instamcp ./my-tools.jsAPI Endpoints
Replace http:// with https:// if using HTTPS.
Initialize
Initialize the MCP server and get available tools:
curl -X POST http://localhost:3000/initialize \
-H "Content-Type: application/json"Update
Reload tools from instamcp.js without restarting:
curl -X POST http://localhost:3000/update \
-H "Content-Type: application/json"List tools
curl http://localhost:3000/toolsCall a tool
curl -X POST http://localhost:3000/tools/greet \
-H "Content-Type: application/json" \
-d '{"name": "World"}'For HTTPS with self-signed certificates, use -k flag:
curl -k -X POST https://localhost:3000/tools/greet \
-H "Content-Type: application/json" \
-d '{"name": "World"}'Defining Tools
Edit instamcp.js to add tools. Each tool should have:
name: Tool identifierdescription: What the tool doesinputSchema: JSON schema for input validationhandler: Async function that processes the input
Example Tool Definition
export default {
greet: {
name: "greet",
description: "Greets a person by name",
inputSchema: {
type: "object",
properties: {
name: { type: "string", description: "The name to greet" }
},
required: ["name"]
},
handler: async ({ name }) => {
return `Hello, ${name}!`;
}
},
add: {
name: "add",
description: "Adds two numbers",
inputSchema: {
type: "object",
properties: {
a: { type: "number", description: "First number" },
b: { type: "number", description: "Second number" },
c: { type: "number", description: "Optional third number" }
},
required: ["a", "b"] // 'c' is optional
},
handler: async ({ a, b, c = 0 }) => {
return a + b + c;
}
}
};Required vs Optional Properties
- Required properties: Include in the
requiredarray - Optional properties: Omit from the
requiredarray, use default values in the handler (e.g.,c = 0)
Reloading Tools
After editing instamcp.js, call /update to reload tools without restarting the server.
