今日已更新 350 条资讯 | 累计 25009 条内容
关于我们

Build Your First East Africa MCP Server in 30 Minutes

Gabriel Mahia 2026年07月28日 18:00 1 次阅读 来源:Dev.to

Every tool in the East Africa coordination infrastructure stack started from the same scaffold. Here's exactly how to build and publish one yourself. What You're Building An MCP server is a Python package that exposes tools to AI assistants. When a user installs it and connects it to Claude, the AI can call your tools as naturally as answering a question. pip install your-mcp-server # Then Claude can: # "Check NHIF coverage for outpatient surgery" → calls your tool → returns structured result Step 1: Set Up the Project (2 min) your-mcp-server/ ├── src/ │ └── your_package/ │ ├── __init__.py │ └── main.py ├── pyproject.toml ├── README.md └── .github/ └── workflows/ └── publish.yml mkdir your-mcp-server && cd your-mcp-server mkdir -p src/your_package touch src/your_package/__init__.py src/your_package/main.py Step 2: Write Your Tool (10 min) # src/your_package/main.py from __future__ import annotations from typing import Annotated from fastmcp import FastMCP mcp = FastMCP ( name = " your-mcp-server " , instructions = " Describe what your server does in one paragraph. " , ) @mcp.tool ( description = ( " What this tool does in plain language. " " Include the Western parallel if applicable. " " Note if it uses DEMO data. " ) ) def your_tool ( param1 : Annotated [ str , " Description of param1 " ], param2 : Annotated [ int , " Description of param2 " ] = 0 , ) -> dict : # Your logic here return { " result " : f " Processed { param1 } " , " note " : " DEMO — replace with real data source in production " , " source " : " your-mcp-server " , } def main (): mcp . run () if __name__ == " __main__ " : main () Step 3: Configure pyproject.toml (3 min) [build-system] requires = ["setuptools> = 61.0 "] build-backend = "setuptools.build_meta" # ← exact string, no variation [project] name = "your-mcp-server" version = "0.1.0" description = "One-line description" authors = [{name = "Your Name" , email = "you@example.com" }] license = { text = "MIT" } readme = "README.md" requires-pytho

本文内容来源于互联网,版权归原作者所有
查看原文