feat(mcp): expose paper-named tools#149
Merged
Merged
Conversation
90e9f02 to
f692948
Compare
There was a problem hiding this comment.
Pull request overview
This PR exposes the MCP tools named in the paper and adds delegation/limit-query support while sharing attenuation checks between hooks and MCP paths.
Changes:
- Registers
aflock_authorize/aflock_attestaliases and addsaflock_check_limits/aflock_delegate. - Adds child JWT minting for delegated sublayouts and tests for paper-named MCP tools.
- Moves attenuation checking into
internal/policyand updates Go module metadata.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
internal/mcp/server.go |
Registers paper-named tools and implements limit checking and delegation handlers. |
internal/mcp/handlers_paper_tools_test.go |
Adds tests for limit responses, delegation behavior, and tool registration. |
internal/auth/jwt.go |
Adds child-token minting and limit merging for delegated sublayouts. |
internal/auth/jwt_test.go |
Tests child token limit merging and nil argument errors. |
internal/policy/attenuation.go |
Adds shared attenuation validation helper. |
internal/hooks/handler.go |
Replaces local attenuation helper with shared policy helper. |
go.mod |
Updates Go version and dependency classification. |
go.sum |
Tidies dependency checksums. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+145
to
+146
| child := attenuateChildPolicy(parentPolicy, sub) | ||
| return ti.IssueToken(childSessionID, agentID, identityHash, child, ttl) |
| } | ||
| identityHash = s.agentIdentity.IdentityHash | ||
| } | ||
| childJWT, err := s.tokenIssuer.MintChildToken(s.policy, matched, childSessionID, agentID, identityHash, time.Hour) |
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
442b28d to
e29791e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #117.
Adds the four MCP tools the paper names in §3.3:
aflock_authorize— alias ofcheck_toolaflock_attest— alias ofsign_attestationaflock_check_limits— new; returns{value, used, remaining, enforcement}per declared limitaflock_delegate— new; JWT-gated, validates sublayout + attenuation, writes propagation, mints an attenuated child JWT viaauth.TokenIssuer.MintChildTokencheck_toolandsign_attestationstay registered.AttenuationViolationsmoves frominternal/hooks/handler.gotointernal/policy/so hooks and MCP share one rule.api_key gating for
aflock_check_limitsis intentionally out of scope — will follow PR #127 once it lands.Test plan
go test ./...cleansub.Limits.MaxSpendUSDand inherits parentMaxTokensIn