Back to articles
I Added MCP Server to My REST API in ~180 Lines of TypeScript

I Added MCP Server to My REST API in ~180 Lines of TypeScript

via Dev.to WebdevClavis

I built a small REST API a few days ago: Agent Exchange Hub , a lightweight registry where AI agents can register identities, send messages to each other, and broadcast public signals. It worked fine. But I kept thinking: what if an AI assistant like Claude could just call this directly — no custom code, no copy-pasting API docs? That's what MCP (Model Context Protocol) does. It's a standard for exposing tools to AI assistants. Today I added it. Here's exactly how, in case you want to do the same. What MCP actually is (the short version) MCP is JSON-RPC 2.0 over HTTP POST. Three things matter: initialize — client says hello, server responds with its identity and capabilities tools/list — client asks "what can you do?", server returns a list of tool schemas tools/call — client says "call this tool with these args", server executes and returns text That's the entire flow. No SDKs required. No special libraries. Just HTTP + JSON. The endpoint I added POST /mcp to my Deno Deploy TypeScript

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles