Skip to content

feat(mcp): expose paper-named tools#149

Merged
manzil-infinity180 merged 3 commits into
devfrom
feat/mcp-paper-tools-117
May 27, 2026
Merged

feat(mcp): expose paper-named tools#149
manzil-infinity180 merged 3 commits into
devfrom
feat/mcp-paper-tools-117

Conversation

@manzil-infinity180
Copy link
Copy Markdown
Contributor

Closes #117.

Adds the four MCP tools the paper names in §3.3:

  • aflock_authorize — alias of check_tool
  • aflock_attest — alias of sign_attestation
  • aflock_check_limits — new; returns {value, used, remaining, enforcement} per declared limit
  • aflock_delegate — new; JWT-gated, validates sublayout + attenuation, writes propagation, mints an attenuated child JWT via auth.TokenIssuer.MintChildToken

check_tool and sign_attestation stay registered. AttenuationViolations moves from internal/hooks/handler.go to internal/policy/ so hooks and MCP share one rule.

api_key gating for aflock_check_limits is intentionally out of scope — will follow PR #127 once it lands.

Test plan

  • go test ./... clean
  • live MCP probe — all four names resolve and return well-formed JSON
  • delegate happy path: propagation file written, child JWT carries sub.Limits.MaxSpendUSD and inherits parent MaxTokensIn
  • delegate rejects unknown / attenuation-violating sublayout

@manzil-infinity180 manzil-infinity180 force-pushed the feat/mcp-paper-tools-117 branch from 90e9f02 to f692948 Compare May 26, 2026 14:35
@manzil-infinity180 manzil-infinity180 changed the title feat(mcp): expose paper-named tools (closes #117) feat(mcp): expose paper-named tools May 26, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_attest aliases and adds aflock_check_limits / aflock_delegate.
  • Adds child JWT minting for delegated sublayouts and tests for paper-named MCP tools.
  • Moves attenuation checking into internal/policy and 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 thread internal/mcp/server.go Outdated
Comment thread internal/mcp/server.go
Comment thread internal/mcp/server.go Outdated
Comment thread internal/policy/attenuation.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Comment thread internal/mcp/server.go
Comment thread internal/mcp/server.go
Comment thread internal/mcp/server.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

This comment was marked as duplicate.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comment thread internal/auth/jwt.go
Comment on lines +145 to +146
child := attenuateChildPolicy(parentPolicy, sub)
return ti.IssueToken(childSessionID, agentID, identityHash, child, ttl)
Comment thread internal/mcp/server.go
}
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants