codex/devrel-3152
24 次代码提交
| 作者 | SHA1 | 备注 | 提交日期 | |
|---|---|---|---|---|
|
|
19ad28e04b |
Propagate A2A request cancellation (#3074)
Co-authored-by: Codex <codex@openai.com> |
||
|
|
3e885308a0 |
lint: clear the golangci-lint backlog and enforce a blocking lint in CI (#2995)
Fixes #2988. Brings 'golangci-lint run ./...' to zero issues (was ~373): - errcheck: explicitly ignore fire-and-forget calls with '_ =' (and a small errcheck.exclude-functions list for response writes — json Encoder.Encode, http ResponseWriter.Write, fmt.Fprint*); genuine cases handled. - unused: remove dead code (unexported decls and dead test helpers) and the imports they orphaned. - staticcheck: ST1005 error strings, ST1016 receiver names, S1000/S1017/S1019/ S1023 simplifications, SA4004/SA4006/SA4010 dead code, SA1021 net.IP.Equal, SA6002 (store *[]byte in sync.Pool). - govet: fix a context leak (lostcancel) in internal/util/mdns and move t.Fatal/Fatalf out of goroutines (testinggoroutine) in tests. - ineffassign, unconvert: mechanical fixes. CI: the Lint workflow now runs a blocking full-tree 'golangci-lint run' on pushes and PRs (dropped only-new-issues now that the tree is clean). Verified: go build, go vet, test compilation, and unit tests for the behaviourally-touched packages all pass. Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
4311b73361 |
Enhance ADK vs Go Micro comparison and apply lint fixes (#2994)
* docs: compare Go Micro with Google ADK in the comparison guide Adds a 'vs Agent Frameworks (Google ADK)' section: ADK builds an agent, Go Micro builds the distributed system the agent lives in (agents are services in the mesh). Covers the category difference, a feature table, when to choose each, and MCP/A2A interoperability. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL * docs: replace ADK comparison slogan with concrete explanation State plainly what each tool provides (ADK builds an agent process; Go Micro builds the surrounding service mesh) instead of marketing phrasing. * lint: apply golangci-lint autofixes; exclude ST1003 and demo errcheck Mechanical, behaviour-preserving fixes applied by 'golangci-lint run --fix': gofmt, misspell (US spelling), usestdlibvars (http.Method*/Status*), unconvert, and the auto-fixable staticcheck simplifications (QF*, S1017/S1019/S1023/S1039). Config: exclude ST1003 (remaining offenders are exported API renames, e.g. web.Id, which would break compatibility) and skip errcheck for examples/ and internal/harness/ (demo code where fire-and-forget is intentional). Build and test compilation verified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL * lint: WIP cleanup checkpoint (errcheck config + partial fixes) Checkpoint of an in-progress golangci-lint cleanup (background pass). Builds cleanly; lint is not yet zero. Follow-up commit will complete the cleanup and switch CI to a blocking full-tree lint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
c7657f73f4 |
Refactor agent plan storage, update docs, and release v6 (#2977)
goreleaser / goreleaser (push) Has been cancelled
* test(harness): read agent plan from the scoped store
The store-scoping change moved an agent's plan from the default table
key agent/{name}/plan to its own table (database "agent", table {name},
key "plan"). The plan-delegate harness tests still read the old key and
failed with 'not found'; read through store.Scope(mem, "agent", name)
like the agent does.
* docs: orient agents-first across README, landing, and docs overview
Lead with agents (then services and flows), surface MCP + A2A as the
interop story, and frame agents as services. Landing hero and feature
grid reordered agents-first with an A2A gateway card.
* v6: module path go-micro.dev/v6, TLS secure by default, NewService
Cut v6. Three breaking changes, bundled so the major bump is paid once:
- Module path go-micro.dev/v5 -> go-micro.dev/v6 across all imports + go.mod.
- TLS verification on by default (was off). MICRO_TLS_SECURE removed;
MICRO_TLS_INSECURE=true opts out for self-signed/dev.
- micro.NewService(name, opts...) is the canonical service constructor,
symmetric with NewAgent/NewFlow; micro.New kept as a deprecated alias;
the old name-less NewService(opts...) removed. Generators emit NewService.
Also ports the JWT auth token provider in-module (go-micro.dev/v6/auth/jwt/token
on golang-jwt/jwt/v5), dropping the v5-pinned github.com/micro/plugins/v5/auth/jwt
and the deprecated dgrijalva/jwt-go.
Docs/README/landing updated to v6 and @latest; v5->v6 migration guide added;
CHANGELOG cut as [6.0.0]. Blog posts left at their historical versions.
---------
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
f42c9d1d69 |
feat(a2a): agents can serve A2A directly, no gateway required (#2975)
Refactor the A2A handler into a reusable dispatcher + Invoke seam and expose NewAgentHandler(card, invoke) + Card(). An agent now serves its own A2A endpoint with AgentA2A(addr) / WithA2A — handling tasks in-process (no RPC hop, no separate gateway). The gateway and embedded agent share the same handler; the only difference is RPC vs in-process invocation. Docs, README, and changelog cover both deployment modes. Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
307b94aab7 |
Implement A2A protocol gateway and update documentation (#2974)
goreleaser / goreleaser (push) Has been cancelled
* feat(a2a): Agent2Agent protocol gateway Add gateway/a2a — exposes registered agents over the open A2A protocol so agents on other frameworks can discover and call them. Agent Cards are generated from registry metadata (the same way the MCP gateway derives tools from service endpoints); incoming A2A tasks translate to the agent's existing Agent.Chat RPC, so there's no per-agent code. v1 is the synchronous JSON-RPC binding: message/send returns a completed Task, tasks/get retrieves it, and Agent Cards are served for discovery; streaming and push notifications are advertised as unsupported. Run with 'micro a2a serve' (cmd/micro/a2a). Tests cover card generation, message/send, tasks/get, listing, and unknown-method errors. * docs: A2A guide, README contents + A2A section, universe A2A check - Add a Contents table of contents at the top of the README and an A2A subsection under Building Agents. - Add the Agent2Agent (A2A) guide and register it in the docs nav. - Exercise the A2A gateway in the universe harness: the concierge agent is reached over A2A (message/send -> Agent.Chat -> completed task). * feat(a2a): outbound client — call external A2A agents Add a2a.Client (Send/Card) so a Go Micro agent or flow can call an agent on any framework by URL — the outbound counterpart to the gateway. Wired in two places: flow.A2A(url) as a workflow step (the cross-framework Dispatch), and agent delegate to an http(s) URL routes over A2A. The universe harness now drives the gateway through the client, exercising both directions. Tests cover client send/card and the round trip. * docs: A2A both-directions — guide, README, changelog, blog #26 --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
a1a57799c3 |
Add payment requirements to tool catalog and implement x402 client (#2966)
* feat(mcp): advertise x402 payment requirements in the tool catalog /mcp/tools now includes each priced tool's payment requirements (amount, network, asset, payTo) when payments are enabled, so an agent can see the cost before calling and choose by price — a shoppable catalog, the foundation for a tool marketplace. Free tools carry no payment block; the shared Tool struct is copied when pricing so it isn't mutated. Tests cover priced/free tools and payments-disabled. Documented in the payments guide. * feat(x402): consumer client with a spend budget (pay-and-retry) Add x402.Client, the consumer counterpart to Middleware: it settles 402 challenges automatically via a pluggable Payer, up to a spend Budget. A call that would exceed the budget is refused before any payment is made, and spend accumulates across calls — the spend cap that keeps an autonomous, paying caller in bounds. Tests cover pay-within-budget, refuse-over-budget, budget accumulation, and free endpoints, end to end against the server Middleware with a mock facilitator and payer. Guide documents the consumer side; agent-level AgentMaxSpend is the next step. * chore: gofmt gateway/mcp/benchmark_test.go (trailing newline) --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
e4d2a41c32 |
refactor(x402): Amount/Amounts naming + per-tool amounts + docs (#2965)
goreleaser / goreleaser (push) Has been cancelled
Follow-up to the merged x402 integration (#2964). Drop the commerce-y 'price' vocabulary for the protocol's own 'amount', and add per-tool pricing as an operator concern (the way scopes/rate-limits are set at the gateway). - x402.Config: Price -> Amount (default), plus Amounts map for per-tool overrides; AmountFor(tool) resolves per-tool -> default. Add a Require primitive (per-request enforcement) and LoadConfig for an operator config file. - MCP gateway: enforce payment per-tool inside /mcp/call (where scopes are enforced) using AmountFor, instead of a flat path-based middleware. - CLI: --x402-price -> --x402-amount; add --x402-config (per-tool file) to micro mcp serve and micro-mcp-gateway. - docs: new Payments (x402) guide + nav + README section; blog/22 updated to Amount/Amounts and the config-file model. Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
9deac487cb |
feat(x402): opt-in agent-native payments for tools (#2964)
Integrate the x402 payment protocol (HTTP 402) so a tool can require a stablecoin payment and an agent can settle it — the next step after autonomous agents (blog 21): agents that act, and pay. - wrapper/x402: HTTP middleware enforcing the 402 challenge/verify flow, with a pluggable Facilitator interface. Go Micro carries no chain or crypto code — verification/settlement is delegated to a facilitator (Coinbase CDP, Alchemy, self-hosted), so Base and Solana are just different facilitators behind one interface. HTTPFacilitator default; tests cover challenge / accept / reject via a mock facilitator. - MCP gateway: optional Options.Payment gates /mcp/call (listing tools and health stay free); off unless configured. - micro mcp serve and micro-mcp-gateway: opt-in --x402-pay-to/-price/ -network/-facilitator flags (env vars on the standalone binary). - blog/22 'Integrating x402: Payments for Agents'; README feature row. Pricing is flat per call for now; richer models and an agent-side spend cap (next to MaxSteps/ApproveTool) are follow-ups. Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
69fc228c73 |
Enhance CLI color output and expose framework primitives via API (#2924)
* feat: expose framework primitives via API gateway and MCP
Add registry, store, and broker as both HTTP routes and MCP tools
so AI agents and HTTP clients can inspect and operate the framework.
API gateway (/micro/* namespace):
GET /micro/registry List registered services
GET /micro/registry/{name} Describe a service
GET /micro/store List store keys
GET /micro/store/{key} Read a record
POST /micro/store/{key} Write a record
POST /micro/broker/{topic} Publish a message
MCP gateway (micro_* tool prefix):
micro_registry_list List services
micro_registry_get Describe a service
micro_store_list List keys
micro_store_read Read a record
micro_store_write Write a record
micro_broker_publish Publish a message
Framework tools use a Handler field on the MCP Tool struct for
direct dispatch (no RPC). Service tools continue to use RPC.
Rate limiters and circuit breakers are applied to framework
tools the same as service tools.
* fix: make framework internals opt-in on API and MCP gateways
Framework primitives (registry, broker, store) are now only
exposed when explicitly enabled:
API gateway: micro api --internal
MCP gateway: Options{Internal: true}
Off by default — user services are always exposed, framework
internals require the flag. Banner output only shows framework
routes when enabled.
* fix: always expose framework internals, gate by auth in production
Revert the --internal flag approach. Framework primitives (registry,
broker, store) are now always exposed:
- micro api: /micro/* routes always available (dev tool)
- MCP gateway: micro_* tools always registered. When Auth is
configured (production), they require micro:admin scope.
Without Auth (dev), they're open — same as all other tools.
This follows the existing pattern: micro run/api = dev (open),
micro server = production (auth + scopes). Framework internals
follow the same security model as user services.
Remove the Internal option from MCP Options. Remove --internal
flag from micro api.
Note: scope persistence depends on the store backend. The default
in-memory store does not survive restarts. Use MICRO_STORE=file
for persistent scopes in production.
* fix: correct DefaultStore comment — it's file-backed, not memory
* fix(server): don't recreate deleted admin user on restart
When the default admin account is deleted via the dashboard, set
a marker key (auth/.admin-deleted) in the store. On startup, skip
admin creation if the marker exists. This prevents the default
admin/micro credentials from reappearing after restart when the
user has intentionally removed them.
---------
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
1bb25d6e7f |
Add agent platform showcase and refactor project structure (#2884)
* 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 --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
524e16296b |
Update documentation, add agent demo, and enhance service API (#2882)
* docs: update all four documentation guides and mark Q2 complete - ai-native-services: add WithMCP one-liner, standalone gateway, WebSocket client example, and OpenTelemetry observability section - mcp-security: add OTel distributed tracing, WebSocket authentication (connection-level and per-message), DeniedReason audit field - tool-descriptions: add manual overrides with WithEndpointDocs and export formats section - agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone gateway production pattern with Docker example - Update roadmap: mark Q2 documentation as complete, Q2 at 100% - Update status: reflect all recent completions, shift priorities https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add agent demo example and blog post Add examples/agent-demo with a multi-service project management app (projects, tasks, team) that demonstrates AI agents interacting with Go Micro services through MCP. Includes seed data and example prompts. Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking through the example code and showing cross-service agent workflows. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: enable multiple services in a single binary Remove global state mutations from service and cmd option functions so that configuring one service no longer overwrites another's settings. Key changes: - service/options.go: remove all DefaultXxx global writes from option functions; newOptions() now creates fresh Server, Client, Store, and Cache per service while sharing Registry, Broker, and Transport - cmd/cmd.go: newCmd() uses local copies instead of pointers to package globals; Before() no longer mutates DefaultXxx vars - cmd/options.go: remove global mutations from all option functions - service/service.go: export ServiceImpl type for cross-package use - service/group.go: new Group type for multi-service lifecycle - micro.go: add Start/Stop to Service interface, expose Group and NewGroup convenience function - examples/multi-service: working example with two services https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * docs: highlight multi-service binary support Add multi-service section to README with code example, update features list, add to examples index, and note in status summary. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: unify service API and clean up developer experience - Unified service creation: micro.New("name", opts...) as canonical API - Clean handler registration: service.Handle(handler, opts...) accepts server.HandlerOption args directly, no need to reach through Server() - Unexported serviceImpl: users interact through Service interface only - Service groups use Service interface (not concrete type) - Fixed Stop() to properly propagate BeforeStop/AfterStop errors - Fixed store init: error-level log instead of fatal on init failure - Updated all examples to use consistent patterns - Updated README, getting-started, MCP docs, and guides - Added blog post about the DX cleanup https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * fix: add blog post 5 to blog index Blog post 5 (Developer Experience Cleanup) existed as a file but was missing from the blog index page. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: make micro new generate MCP-enabled services by default - main.go template includes mcp.WithMCP(":3001") by default - Handler template has agent-friendly doc comments with @example tags - Proto template has descriptive field comments - README includes MCP usage, Claude Code config, and tool description tips - Makefile adds mcp-tools, mcp-test, mcp-serve targets - go.mod updated to Go 1.22 - Added --no-mcp flag to opt out of MCP integration - Post-create output shows MCP endpoint URLs https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * docs: add MCP migration guide and troubleshooting guide - Migration guide: 3 approaches to add MCP to existing services (WithMCP one-liner, standalone gateway, CLI) - Troubleshooting guide: common issues with agents, WebSocket, Claude Code, auth, rate limiting, and performance https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * refactor: rename model/ package to ai/ for AI model providers The model/ package name conflicted with the conventional use of "model" for data models. Renamed to ai/ which better describes the package's purpose (AI provider abstraction for Anthropic, OpenAI, etc.) and frees up model/ for future data model layer use. - Rename model/ → ai/ with package name change - Update all Go imports from go-micro.dev/v5/model to go-micro.dev/v5/ai - Update cmd/micro/server/server.go references (model.X → ai.X) - Update all documentation and roadmap references - All tests pass, CLI builds successfully https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add model package for typed data access with CRUD and queries New model/ package provides a typed data model layer using Go generics. Supports structured CRUD operations, WHERE filters, ordering, pagination, and automatic schema creation from struct tags. Three backends: - memory: in-memory for development and testing - sqlite: embedded SQL for dev and single-node production - postgres: full PostgreSQL for production deployments Key features: - Generic Model[T] with Create/Read/Update/Delete/List/Count - Query builder: Where(), WhereOp(), OrderAsc/Desc(), Limit(), Offset() - Struct tags: model:"key" for primary key, model:"index" for indexes - Auto table creation from struct schema - 19 tests passing across memory and sqlite backends https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add model code generation to protoc-gen-micro Extend the micro plugin to generate model structs from proto messages annotated with // @model. Generated alongside client/server code in the same .pb.micro.go file. For a proto message like: // @model message User { string id = 1; string name = 2; } Generates: - UserModel struct with model:"key" and json tags - NewUserModel(db) factory returning *model.Model[UserModel] - UserModelFromProto(*User) *UserModel converter - (*UserModel).ToProto() *User converter Supports @model(table=custom_table, key=custom_field) options. Adds GetComments() to generator for plugin comment inspection. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add Model() to Service interface for Client/Server/Model trifecta Every service now exposes Client(), Server(), and Model() — call services, handle requests, and save/query data from the same interface. Includes README docs, blog post, and a full model guide on the docs site. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add Helm chart for MCP gateway Kubernetes deployment Adds official Helm chart at deploy/helm/mcp-gateway/ with: - Deployment, Service, ServiceAccount templates - HPA for auto-scaling based on CPU/memory - Ingress with TLS support - Configurable registry (consul, etcd, mdns), rate limiting, JWT auth, audit logging, and per-tool scopes - Security context (non-root, read-only rootfs, drop all caps) - NOTES.txt with post-install connection instructions Updates roadmap and status docs to reflect Helm Charts as delivered. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * docs: add Helm chart entry to changelog https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add per-tool circuit breakers to MCP gateway Protects downstream services from cascading failures. When a tool's RPC calls fail repeatedly, the circuit opens and rejects requests immediately until the service recovers (half-open probe pattern). - CircuitBreakerConfig with MaxFailures, Timeout, MaxHalfOpen - Per-tool breakers created during service discovery - Integrated into HTTP call path with 503 response when open - Records success/failure after each RPC call - --circuit-breaker and --circuit-breaker-timeout CLI flags - 8 unit tests covering all state transitions https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
c800dd3729 |
feat: add deployment example, workflow example, and MCP benchmarks (#2877)
Docker Compose deployment example (examples/deployment/): - docker-compose.yml with Consul, MCP gateway, Jaeger tracing - Dockerfile and Dockerfile.gateway for multi-stage builds - README with architecture diagram and customization guide Cross-service workflow example (examples/mcp/workflow/): - Inventory, Orders, Notifications services - Shows agents orchestrating multi-step workflows from natural language - Stock check → reserve → order → notify in a single agent conversation MCP gateway benchmark suite (gateway/mcp/benchmark_test.go): - ListTools: ~20μs (10 tools), ~48μs (100 tools) - Tool lookup: ~19ns (zero-alloc, scales to 500+ tools) - Auth inspect: ~7ns, scope check: ~16ns - Rate limiter: ~111ns per check - JSON encode/decode: ~1.5-2μs per tool Updated examples README with new examples index. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
d2036b880d |
Claude/update docs roadmap f zd2 j (#2873)
* docs: update all four documentation guides and mark Q2 complete - ai-native-services: add WithMCP one-liner, standalone gateway, WebSocket client example, and OpenTelemetry observability section - mcp-security: add OTel distributed tracing, WebSocket authentication (connection-level and per-message), DeniedReason audit field - tool-descriptions: add manual overrides with WithEndpointDocs and export formats section - agent-patterns: add LangChain/LlamaIndex SDK pattern and standalone gateway production pattern with Docker example - Update roadmap: mark Q2 documentation as complete, Q2 at 100% - Update status: reflect all recent completions, shift priorities https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add agent demo example and blog post Add examples/agent-demo with a multi-service project management app (projects, tasks, team) that demonstrates AI agents interacting with Go Micro services through MCP. Includes seed data and example prompts. Add blog post 4 "Agents Meet Microservices: A Hands-On Demo" walking through the example code and showing cross-service agent workflows. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: enable multiple services in a single binary Remove global state mutations from service and cmd option functions so that configuring one service no longer overwrites another's settings. Key changes: - service/options.go: remove all DefaultXxx global writes from option functions; newOptions() now creates fresh Server, Client, Store, and Cache per service while sharing Registry, Broker, and Transport - cmd/cmd.go: newCmd() uses local copies instead of pointers to package globals; Before() no longer mutates DefaultXxx vars - cmd/options.go: remove global mutations from all option functions - service/service.go: export ServiceImpl type for cross-package use - service/group.go: new Group type for multi-service lifecycle - micro.go: add Start/Stop to Service interface, expose Group and NewGroup convenience function - examples/multi-service: working example with two services https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * docs: highlight multi-service binary support Add multi-service section to README with code example, update features list, add to examples index, and note in status summary. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: unify service API and clean up developer experience - Unified service creation: micro.New("name", opts...) as canonical API - Clean handler registration: service.Handle(handler, opts...) accepts server.HandlerOption args directly, no need to reach through Server() - Unexported serviceImpl: users interact through Service interface only - Service groups use Service interface (not concrete type) - Fixed Stop() to properly propagate BeforeStop/AfterStop errors - Fixed store init: error-level log instead of fatal on init failure - Updated all examples to use consistent patterns - Updated README, getting-started, MCP docs, and guides - Added blog post about the DX cleanup https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
beeaad748e |
Claude/update docs roadmap f zd2 j (#2868)
* feat: add LlamaIndex SDK for Go Micro services Add LlamaIndex integration package that enables LlamaIndex agents to discover and call Go Micro microservices through the MCP gateway. Follows the same pattern as the existing LangChain SDK. - GoMicroToolkit with from_gateway() factory and tool filtering - FunctionTool integration via llama_index.core.tools - Auth support, error handling, and retry configuration - Examples for basic agent and RAG + microservices workflows - Unit tests with mocked gateway responses https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * docs: update status for OTel, WebSocket, and LlamaIndex SDK completion Reflect recently completed work in roadmap and status documents: - Q2 progress: 85% -> 95% (WebSocket, LlamaIndex SDK done) - Q3 progress: 40% -> 50% (OpenTelemetry integration done) - Transports: 2 -> 3 (added WebSocket) - Agent SDKs: 1 -> 2 (added LlamaIndex) - Test coverage: 568 -> 1,000+ lines https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add WithMCP convenience option, improve startup banner, and blog post - Add mcp.WithMCP(":3000") service option for one-line MCP setup - Improve `micro run` startup banner to show Agent playground, MCP tools, and WebSocket endpoints prominently - Add blog post: "Building the AI-Native Future of Go Micro with Claude" covering WebSocket transport, OTel integration, LlamaIndex SDK, and Anthropic's Claude Max sponsorship - Update blog index and navigation links https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
076b7c37be |
feat: add WebSocket transport for MCP gateway (#2867)
Add bidirectional WebSocket transport at /mcp/ws using JSON-RPC 2.0 protocol (same as stdio). This enables persistent connections for real-time AI agents that need streaming tool interactions. New files: - gateway/mcp/websocket.go: WebSocketTransport with connection-level auth, per-message auth fallback, write serialization, OTel tracing - gateway/mcp/websocket_test.go: 14 tests covering initialize, tools/list, tool calls, auth (header + param), scopes, rate limiting, audit, concurrent requests, multiple connections, error handling, and connection persistence Changes: - gateway/mcp/mcp.go: Register /mcp/ws handler in serveHTTP - go.mod: Added github.com/gorilla/websocket v1.5.3 Auth supports two modes: - Connection-level: Bearer token in WebSocket upgrade request headers - Per-message: _token field in JSON-RPC params (same as stdio) https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
ab6f027741 |
Claude/update docs roadmap f zd2 j (#2866)
* Update docs and roadmap to March 2026 with focus priorities - ROADMAP.md: Updated from Nov 2025 to reflect Q1 completions and current state - ROADMAP_2026.md: Updated status to March 2026, added model package as delivered - CURRENT_STATUS_SUMMARY.md: Rewrote with March 2026 status and clear next priorities - PROJECT_STATUS_2026.md: Added model package section, updated recommendations - Website roadmap: Updated Q3 security status and timestamps Key focus areas identified: documentation guides, multi-protocol MCP, LlamaIndex SDK, and OpenTelemetry integration. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * Add CLAUDE.md and four documentation guides to fill doc gaps - CLAUDE.md: Project guide with structure, build commands, and priorities - ai-native-services.md: End-to-end tutorial building an MCP-enabled task service - mcp-security.md: Production security guide (auth, scopes, rate limiting, audit) - tool-descriptions.md: Best practices for writing Go comments that help agents - agent-patterns.md: Six integration patterns from single-agent to event-driven - Updated docs index with new "AI & Agents" section linking all four guides These were the highest priority gaps identified in the roadmap analysis: the framework has solid features that were under-documented. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc * feat: add OpenTelemetry tracing to MCP gateway Integrate OpenTelemetry spans into the MCP gateway for both HTTP and stdio transports. Each tool call now creates a server span with rich attributes (tool name, account ID, auth outcome, transport type). Trace context is propagated to downstream RPC calls via metadata, enabling end-to-end distributed tracing through Jaeger, Grafana, etc. New files: - gateway/mcp/otel.go: Span creation, attribute constants, metadata carrier - gateway/mcp/otel_test.go: 8 tests covering span creation, auth denied/allowed, rate limiting, trace propagation, noop provider, and missing token Changes: - Options.TraceProvider: Optional trace.TracerProvider field - handleCallTool (HTTP): Creates OTel spans with auth/rate-limit attributes - handleToolsCall (stdio): Same instrumentation for stdio transport - go.mod: Added go.opentelemetry.io/otel/sdk v1.35.0 (test dependency) The existing MCP trace ID (UUID) is preserved for backward compatibility and recorded as a span attribute alongside the W3C trace context. https://claude.ai/code/session_01GkduEhcrqcG45rdfYh8dAc --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
1db7903010 |
[WIP] Implement missing features from documentation (#2859)
* Initial plan * Add --header and --metadata flags to micro call command Co-authored-by: asim <17530+asim@users.noreply.github.com> * Apply code formatting with gofmt Co-authored-by: asim <17530+asim@users.noreply.github.com> * Add clarifying comments for dual metadata handling paths Co-authored-by: asim <17530+asim@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: asim <17530+asim@users.noreply.github.com> |
||
|
|
ac47a4650a |
MCP gateway: add per-tool scopes, tracing, rate limiting, and audit logging (#2850)
* Initial plan
* Add MCP per-tool scopes, tracing, rate limiting, and audit logging
- Add Scopes field to Tool struct for per-tool scope requirements
- Add Auth (auth.Auth) integration to Options for token inspection
- Add trace ID generation (UUID) propagated via metadata to downstream RPCs
- Add per-tool rate limiting with configurable requests/sec and burst
- Add AuditFunc callback for immutable tool-call audit records
- Extract tool scopes from registry endpoint metadata ("scopes" key)
- Update both HTTP and stdio transports with auth/trace/rate/audit
- Add comprehensive tests for all new functionality
Co-authored-by: asim <17530+asim@users.noreply.github.com>
* Revert unrelated example go.mod changes
Co-authored-by: asim <17530+asim@users.noreply.github.com>
* Remove auto-generated example go.sum files
Co-authored-by: asim <17530+asim@users.noreply.github.com>
* Add WithEndpointScopes helper, gateway-level ToolScopes, and documentation
- Add server.WithEndpointScopes() for declaring per-endpoint auth scopes at
handler registration time
- Add mcp.Options.ToolScopes for gateway-level scope overrides without
changing individual services
- Update documented example to show WithEndpointScopes usage
- Update examples/mcp/README.md with scopes, tracing, and rate-limiting docs
- Update gateway/mcp/DOCUMENTATION.md with scopes section and FAQ
- Add tests for both new features
Co-authored-by: asim <17530+asim@users.noreply.github.com>
* Fix ToolScopes doc comment: clarify override (not merge) semantics
Co-authored-by: asim <17530+asim@users.noreply.github.com>
* Revert unrelated example go.mod/go.sum changes
Co-authored-by: asim <17530+asim@users.noreply.github.com>
* Rename ToolScopes to Scopes in MCP Options
The field name "Scopes" is more universal and consistent with how
auth scopes are used throughout go-micro. Updated all code references,
tests, and documentation.
Co-authored-by: asim <17530+asim@users.noreply.github.com>
* MCP gateway: add per-tool scopes, tracing, rate limiting, and audit logging
Co-authored-by: asim <17530+asim@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
|
||
|
|
fe76f3ddb5 | further mcp integrations | ||
|
|
3986738e2c |
stdio MCP transport and gateway refactor
Implement Q2 2026 roadmap items for AI-native microservices: MCP stdio transport: - JSON-RPC 2.0 over stdio for Claude Code integration - Methods: initialize, tools/list, tools/call - Auto-detection: stdio (no address) vs HTTP/SSE (with address) micro mcp command: - 'micro mcp serve' - start MCP server (stdio or HTTP) - 'micro mcp list' - list available tools - 'micro mcp test' - test a tool (placeholder) - Enables Claude Code users to add microservices as tools Gateway refactor: - Created gateway/api package (reusable, 150 lines) - Moved gateway logic from cmd/micro/server/gateway.go - HandlerRegistrar pattern for flexibility - cmd/micro/server/gateway.go now compatibility wrapper (72 lines) - 50% code reduction, better separation of concerns - Library users can now use gateway in custom apps Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
4acb55733d | update mcp doc location | ||
|
|
42efe1862a | fix mcp exampl | ||
|
|
ee76eb6d2c |
v5.15.0: Unified Gateway Architecture + MCP Support
Major Features: - Unified gateway architecture (micro run + micro server use same code) - MCP (Model Context Protocol) integration as library package - AI-accessible microservices with 3 lines of code Gateway Unification: - Created reusable gateway module (cmd/micro/server/gateway.go) - Updated micro run to use unified gateway (removed duplicate code) - Conditional authentication (disabled in dev, required in prod) - Reduced code duplication, simplified maintenance MCP Integration: - New library package: gateway/mcp - Automatic service discovery → MCP tools - HTTP/SSE transport support (stdio coming soon) - Works for both library users and CLI users - CLI flags: --mcp-address for micro run and micro server Documentation: - ADR-010: Unified Gateway Architecture - CLI & Gateway Guide for users - MCP Gateway README and examples - Blog post: Making Your Microservices AI-Native with MCP Breaking Changes: None (fully backward compatible) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |