Permit.io authorization middleware for FastMCP servers
The permit-fastmcp server has 4 tools with inconsistent quality. Naming is action-oriented (greet, login, conditional-greet) but one tool (greet-jwt) uses a hyphenated variant that complicates parsing. All tools have descriptions, but they are extremely brief (10-60 chars) and lack critical context about when to use them, error conditions, and expected outputs. Input schemas are present and mostly typed, but lack critical parameter-level descriptions (e.g., 'number' in conditional-greet has a description, but 'username'/'password' in login lack depth on format expectations). Output schemas are entirely undocumented, callers cannot know what fields to expect from responses. Error handling is mentioned in descriptions (e.g., login says 'Demo: hardcoded' but provides no recovery guidance). The server relies on JWT token handling (greet-jwt, login) but exposes security considerations in source code (hardcoded SECRET_KEY, demo credentials) that should be documented as warnings for production use. Overall, these are example tools suitable for demos, not production agents.
Greet a user conditionally based on a number value and log a custom message.
Greet a user by name (no authentication required).
Greet a user by extracting their name from a JWT in the Authorization header.
Authenticate a user and return a JWT token if credentials are valid. Demo: hardcoded user/password check for 'admin'/'password' or 'client'/'client'.
Tool descriptions are extremely brief (10-60 chars) and lack critical context. 'Greet a user by name (no authentication required).' does not explain when to use this vs greet-jwt, what the response format is, or error conditions.
Output schemas are completely undocumented. Tools return strings ('Hello, {name}!' or a JWT token), but callers cannot parse structured responses or chain results to downstream tools. No documentation of return types.
Parameter descriptions are missing or insufficient. 'username' and 'password' in login lack format guidance (min/max length, allowed characters, case sensitivity). 'number' in conditional-greet has range hints in description but should be in schema as type integer with minimum/maximum constraints.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-21 | D | 57 | <=2025-11-25 | v2 |
| 2026-03-09 | C | 63 | - | v1 |
Error handling lacks recovery guidance. login() can raise 'Invalid username or password' but does not suggest whether to retry, call a recovery endpoint, or prompt the user. greet-jwt() raises exceptions for missing auth headers but provides no actionable next step for the LLM.
Tool naming consistency: 'greet-jwt' uses hyphens (non-standard in Python tool naming conventions), which may confuse LLMs expecting snake_case. Rename to 'greet_jwt' for consistency with other tools.
Security concern exposed in source code: hardcoded SECRET_KEY and demo credentials ('admin'/'password', 'client'/'client') in login() are documented as 'not production' but encourage insecure practices. No tooling guidance on secret injection or credential rotation.
greet-jwt uses Context to extract Authorization header from request, but this pattern is not documented in the tool description. LLMs cannot know that this tool requires special header handling vs regular parameters. Tool descriptions should explain dependencies on request context.