loaditout.ai
SkillsPacksTrendingLeaderboardAPI DocsBlogSubmitRequestsCompareAgentsXPrivacyDisclaimer
{}loaditout.ai
Skills & MCPPacksBlog

graft

MCP Tool

schrepa/graft

Build agent-ready APIs without splitting your server model. Define tools once, expose them as both HTTP endpoints and MCP tools.

Install

$ npx loaditout add schrepa/graft

Platform-specific configuration:

.claude/settings.json
{
  "mcpServers": {
    "graft": {
      "command": "npx",
      "args": [
        "-y",
        "graft"
      ]
    }
  }
}

Add the config above to .claude/settings.json under the mcpServers key.

About

Graft 🌱

Build agent-ready APIs without splitting your server model.

Define tools once, then expose them as both HTTP endpoints and MCP tools from the same server. Graft also generates discovery docs, OpenAPI, and an interactive API reference automatically.

import { createApp, z } from '@schrepa/graft'

const app = createApp({ name: 'my-docs-api' })

app.tool('search_docs', {
  description: 'Search documentation by keyword',
  params: z.object({
    q: z.string().describe('Search query'),
    limit: z.coerce.number().optional().describe('Max results'),
  }),
  handler: ({ q, limit }) => {
    return searchIndex(q, { limit: limit ?? 10 })
  },
})

export default app

That one definition gives you:

  • `POST /mcp` — MCP endpoint (Streamable HTTP). Agents connect here.
  • `GET /search-docs?q=deploy` — HTTP endpoint. Any client calls the same tool as REST.
  • `/.well-known/agent.json` — Agent discovery. Tools, resources, capabilities.
  • `/.well-known/mcp.json` — MCP server card. Protocol version and transport URL.
  • `/openapi.json` — Auto-generated OpenAPI 3.1 spec.
  • `/docs` — Interactive API reference (Scalar).
  • `/health` — Health check with tool/resource counts and uptime.

Both transports share a single pipeline:

Agent (MCP)  → POST /mcp           → auth → validate → middleware → handler
Browser      → GET /search-docs?q= → auth → validate → middleware → handler

One handler. Two protocols. Same auth, same validation, same middleware.

Get started
New app
npx @schrepa/create-graft-app my-app
cd my-app
npm install
npm run dev

Open the studio to browse and test your tools: npm run studio

Wrap an existing API

If you have an OpenAPI spec:

npx @schrepa/graft serve --openapi ./openapi.yaml --target http://localhost:8000

Or create a graft.proxy.yaml to hand-pick the endpoints you want to expose:

target: ht

Tags

agentsai-agentsapi-frameworkmcpmcp-servermodel-context-protocolopenapitoolstypescript

Reviews

Loading reviews...

Quality Signals

1
Stars
0
Installs
Last updated24 days ago
Security: AREADME

Safety

Risk Levelmedium
Data Access
read
Network Accessnone

Details

Sourcegithub-crawl
Last commit3/24/2026
View on GitHub→

Embed Badge

[![Loaditout](https://loaditout.ai/api/badge/schrepa/graft)](https://loaditout.ai/skills/schrepa/graft)