Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Project structure · AI and ML

AI agent with an MCP server project structure

Opens with credits

For developers who want to give AI assistants safe access to their own data or API. A TypeScript MCP server built on the official SDK, organised by feature (tasks, projects) with each feature owning its tools, resources and prompts, served over stdio for local hosts and Streamable HTTP with OAuth for remote ones, plus a small agent and the evals that prove a model can use it.

Curated by Tauseef FayyazIntermediate172 files and foldersMCP TypeScript SDK v2 (2.3), MCP spec 2026-07-28, Node.js 24 LTSChecked October 2026
Explore the filesPick any file to see what it is, why it exists and when you add it.

How it grows

Each stage opens the explorer there

  1. 1Day 1What the scaffold and your first hour give you16 files and folders
  2. 2GrowingWhat a real app with features and tests adds+63 files and folders
  3. ProductionWhat running it for real users adds+43 files and foldersOpens with credits
  4. ExpertWhat a team needs to keep it healthy for years+50 files and foldersOpens with credits

How it is organised

  • Group by feature (src/features/tasks, src/features/projects). Each feature owns its tools, resources, prompts and schemas and exports one register function; server.ts only wires features together, so adding a capability never means editing a 500 line file.
  • One createServer factory, two thin entry points: stdio.ts for hosts that launch the server locally, http.ts for a remote endpoint. Tools never know which transport they run on.
  • Every input is a Zod schema. The SDK turns it into the JSON Schema the model sees and validates arguments before your handler runs. Validate again at the backend boundary: a valid shape is not a safe value.
  • Tools are an API for a model, not a person: clear names, descriptions that say when to use them, small outputs, and annotations that mark read-only and destructive tools. Their names, descriptions and schemas are a public contract, versioned like any API.
  • stdout belongs to the protocol on stdio. Log to stderr, always.
  • Remote servers verify OAuth bearer tokens in front of the MCP handler and act as the caller, never as an all-powerful service account. The server is a resource server; a real identity provider issues the tokens, and tokens are never passed through to the backend.
  • Least privilege by default: each tool needs a named scope, write and destructive tools sit in their own toolset, and operators can switch whole toolsets off.
  • A model is part of your test suite. Unit and in-process client tests prove the tools work; tool-selection evals prove a model picks the right one. Run both before a description changes.

At the top of the project

Open one in the explorer for the full story

Learn more on Sefism

Roadmaps, cheat sheets and projects that go with AI agent with an MCP server.

See 12 more
Checked against 13 official sources, October 2026. If something has changed, the docs win.Show sources

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com