1
0
mirror of https://github.com/go-micro/go-micro.git synced 2026-05-06 19:21:46 +02:00
Files
Asim Aslam 7a5d86a2a4 Claude/update docs roadmap f zd2 j (#2885)
* feat: add agent platform showcase and blog post

Add a complete platform example (Users, Posts, Comments, Mail) that
mirrors micro/blog, demonstrating how existing microservices become
AI-accessible through MCP with zero code changes.

Includes blog post "Your Microservices Are Already an AI Platform"
walking through real agent workflows: signup, content creation,
commenting, tagging, and cross-service messaging.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: rename handler types to drop redundant Service suffix

UserService → Users, PostService → Posts, CommentService → Comments,
MailService → Mail. Matches micro/blog naming convention.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: consolidate top-level directories, reduce framework bloat

Move internal/non-public packages behind internal/ or into their
parent packages where they belong:

- deploy/ → gateway/mcp/deploy/ (Helm charts belong with the gateway)
- profile/ → service/profile/ (preset plugin profiles are a service concern)
- scripts/ → internal/scripts/ (install script is not public API)
- test/ → internal/test/ (test harness is not public API)
- util/ → internal/util/ (internal helpers shouldn't be imported externally)

Also fixes CLAUDE.md merge conflict markers and updates project
structure documentation.

All import paths updated. Build and tests pass.

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* refactor: redesign model package to match framework conventions

Rename model.Database interface to model.Model (consistent with
client.Client, server.Server, store.Store). Remove generics in
favor of interface{}-based API with reflection.

Key changes:
- model.Model interface: Register once, CRUD infers table from type
- DefaultModel + NewModel() + package-level convenience functions
- Schema registered via Register(&User{}), no per-call schema passing
- Memory implementation as default (in model package, like store)
- memory/sqlite/postgres backends updated for new interface
- protoc-gen-micro generates RegisterXModel() instead of generic factory
- All docs, blog, and README updated

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

* docs: clarify blog post 7 uses modular monolith, not multi-service

Blog post 7 demonstrated all handlers in a single process but framed
it as microservices without acknowledging the architectural difference.

- Add "A Note on Architecture" section explaining this is a modular
  monolith demo and pointing to micro/blog for multi-service
- Clarify that handlers can be broken out into separate services later
- Fix "service registry" language to match single-process reality
- Restructure "Adding MCP to Existing Services" to distinguish the
  in-process approach from registry-based gateway options
- Update closing to acknowledge both paradigms
- Fix README type names (&CommentService{} -> &Comments{}, etc.)

https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 13:13:31 +00:00
..

Platform Example: AI Agents Meet Real Microservices

This example mirrors the micro/blog platform — a real microblogging application built on Go Micro. It demonstrates how existing microservices become AI-accessible through MCP with zero changes to business logic.

Services

Service Endpoints Description
Users Signup, Login, GetProfile, UpdateStatus, List Account management and authentication
Posts Create, Read, Update, Delete, List, TagPost, UntagPost, ListTags Blog posts with markdown and tagging
Comments Create, List, Delete Threaded comments on posts
Mail Send, Read Internal messaging between users

Running

go run .

MCP tools available at: http://localhost:3001/mcp/tools

Agent Scenarios

These are realistic multi-step workflows an AI agent can complete:

1. New User Onboarding

"Sign up a new user called carol, then write a welcome post introducing herself"

The agent will: call Signup → use the returned user ID → call Posts.Create

2. Content Creation

"Log in as alice and write a blog post about Go concurrency patterns, then tag it with 'golang' and 'concurrency'"

The agent will: call Login → call Posts.Create → call TagPost twice

3. Social Interaction

"List all posts, find the welcome post, and comment on it as bob saying 'Great to be here!'"

The agent will: call Posts.List → pick the right post → call Comments.Create

4. Cross-Service Workflow

"Send a mail from alice to bob welcoming him, then check bob's inbox to confirm delivery"

The agent will: call Mail.Send → call Mail.Read to verify

5. Platform Overview

"Show me all users, all posts, and all tags currently in use"

The agent will: call Users.List, Posts.List, and ListTags (potentially in parallel)

How It Works

The key insight: you don't need to write any agent-specific code. The MCP gateway discovers services from the registry, extracts tool schemas from Go types, and generates descriptions from doc comments.

service := micro.New("platform",
    micro.Address(":9090"),
    mcp.WithMCP(":3001"),  // This one line makes everything AI-accessible
)

service.Handle(&Users{})
service.Handle(&Posts{})
service.Handle(&Comments{})
service.Handle(&Mail{})

Each handler method becomes an MCP tool. The @example tags in doc comments give agents sample inputs to learn from.

Connecting to Claude Code

Add to your Claude Code MCP config:

{
  "mcpServers": {
    "platform": {
      "command": "curl",
      "args": ["-s", "http://localhost:3001/mcp/tools"]
    }
  }
}

Or use stdio transport:

micro mcp serve --registry mdns

Architecture

Agent (Claude, GPT, etc.)
    │
    ▼
MCP Gateway (:3001)         ← Discovers services, generates tools
    │
    ▼
Go Micro RPC (:9090)        ← Standard service mesh
    │
    ├── UserService          ← Signup, Login, Profile
    ├── PostService          ← CRUD + Tags
    ├── CommentService       ← Threaded comments
    └── MailService          ← Internal messaging

Relation to micro/blog

This example is a simplified, self-contained version of micro/blog. The real platform splits each service into its own binary with protobuf definitions. This example uses Go structs directly for simplicity, but the MCP integration works identically either way — the gateway discovers services from the registry regardless of how they're implemented.