agentleFS
PinMeToPinMeTo/pinmeto-location-mcp/AGENTS.md

pinmeto-location-mcp

AGENTS.md15 starsChanged 4 months agoMITView on GitHub

This is an MCP (Model Context Protocol) server that provides AI agents like Claude with access to PinMeTo's location management platform. It exposes tools for fetching location data, insights from Google/Facebook/Apple, ratings, and keywords. The server requires these environment variables (loaded via --env-file=.env.local in npm scripts): - PINMETO_ACCOUNT_ID - PinMeTo account identifier - PINMETO_APP_ID - OAuth application ID - PINMETO_APP_SECRET - OAuth application secret - PINMETO_API_URL - (Optional, dev only) Override API base URL - PINMETO_LOCATION_API_URL - (Optional, dev only)…

  • Reads credentials
  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    ⚠️ REQUIRED: Every PR must include a changeset.

    line 18
  2. Distinctive:

    Before starting any feature, bug fix, or enhancement:

    line 24
  3. Very specific:

    Add a changeset: npx changeset add (or --empty for non-release changes)

    line 45
  4. Distinctive:

    NEVER commit directly to main without explicit user approval

    line 67
  5. Distinctive:

    ALWAYS create a feature branch for any code changes

    line 68
  6. Distinctive:

    ALWAYS create a PR for features and fixes

    line 69
  7. Very specific:

    All tools follow the MCP best practice naming pattern: pinmeto_{action}_{network}_{resource}

    line 74
  8. Very specific:

    Every tool in this server sets readOnlyHint: true and a human-readable title — the server only fetches data and never modifies state, and …

    line 89
  9. Very specific:

    Use StdioServerTransport to simulate MCP protocol messages

    line 126
  10. Distinctive:

    Test both success paths and error handling

    line 127
  11. Distinctive:

    When ending a work session, work is NOT complete until git push succeeds.

    line 131
  12. Distinctive:

    Verify: - All changes committed AND pushed

    line 147
  13. Distinctive:

    NEVER push directly to main for code changes - use feature branches and PRs

    line 151
  14. Distinctive:

    Always ask the user before any direct main branch operations

    line 153

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent Instructions

Project Overview

This is an MCP (Model Context Protocol) server that provides AI agents like Claude with access to PinMeTo's location management platform. It exposes tools for fetching location data, insights from Google/Facebook/Apple, ratings, and keywords.

Environment Configuration

The server requires these environment variables (loaded via --env-file=.env.local in npm scripts):

  • PINMETO_ACCOUNT_ID - PinMeTo account identifier
  • PINMETO_APP_ID - OAuth application ID
  • PINMETO_APP_SECRET - OAuth application secret
  • PINMETO_API_URL - (Optional, dev only) Override API base URL
  • PINMETO_LOCATION_API_URL - (Optional, dev only) Override locations API base URL

Releases and Changesets

⚠️ REQUIRED: Every PR must include a changeset. CI will reject PRs without one. For changes that don't affect the published package (docs, internal tooling), add an empty changeset with npx changeset add --empty.

For the full release workflow (version guidelines, release commands, maintainer flow), use the release skill.

Feature Development Workflow

Before starting any feature, bug fix, or enhancement:

Step 1: Create a Feature Branch

# NEVER work directly on main
git checkout main
git pull origin main
git checkout -b <branch-name>  # e.g., feature/add-apple-ratings, fix/auth-timeout

Branch Naming Convention:

  • feature/<description> - New features
  • fix/<description> - Bug fixes
  • refactor/<description> - Code refactoring
  • docs/<description> - Documentation only
  • chore/<description> - Tooling, dependencies, maintenance

Step 2: Do the Work

  • Make commits to your feature branch
  • Run tests: npm test
  • Run build: npm run build
  • Add a changeset: npx changeset add (or --empty for non-release changes)

Step 3: Create a Pull Request

git push -u origin <branch-name>
gh pr create --title "feat: description" --body "..."

Step 4: Get the PR Approved

  • Request review
  • Address feedback
  • NEVER merge without approval

Step 5: Merge and Clean Up

# After PR approval and passing CI
gh pr merge --squash --delete-branch
git checkout main
git pull origin main

⚠️ WORKFLOW CRITICAL RULES:

  • NEVER commit directly to main without explicit user approval
  • ALWAYS create a feature branch for any code changes
  • ALWAYS create a PR for features and fixes
  • Documentation-only changes MAY go to main with explicit user approval

Tool Naming Convention

All tools follow the MCP best practice naming pattern: pinmeto_{action}_{network}_{resource}

PatternExampleDescription
pinmeto_get_{resource}pinmeto_get_locationSingle resource retrieval
pinmeto_get_{resource}spinmeto_get_locationsBulk resource retrieval (ALL)
pinmeto_search_{resource}spinmeto_search_locationsSearch/discovery tools
pinmeto_get_{network}_{resource}pinmeto_get_google_insightsNetwork-specific data (single or all)

Unified Single/Bulk Pattern: Network tools accept an optional storeId parameter — without it they fetch all locations, with it a single location.

For the step-by-step process of adding a tool, use the add-tool skill.

Tool Annotations

Every tool in this server sets readOnlyHint: true and a human-readable title — the server only fetches data and never modifies state, and directory submission requires a title on every tool. All other annotations use SDK defaults. If a future tool writes, set readOnlyHint: false and consider destructiveHint: true for deletes/overwrites and idempotentHint: true where repeated calls have no additional effect.

Build Artifacts

  • src/generated/version.ts is a tracked, generated file — regenerated from package.json by scripts/generate-version.mjs on every prebuild/pretest. Do not edit it, and do not add it to .gitignore; it is committed so bare npx tsc/npx vitest work on a fresh checkout.
  • The .mcpb is packed from the working directory, not from git. .mcpbignore is a deny-by-default allowlist (/* then !/build, !/node_modules, ...) with gitignore semantics: the packer uses the ignore library and does not read .gitignore, so a blocklist lets any untracked local directory into the bundle, and an unanchored rule like dist also strips node_modules/*/dist. npm run verify:mcpb (run by release:draft and pack:test) unpacks the bundle, rejects unsafe paths and unexpected top-level entries, and starts the packed server. The first v4.1.0 asset shipped without this and failed to install.
  • npm run bundle emits dist/index.mjs, a self-contained single-file server bundle. It was vendored by the PinMeTo/claude-plugins marketplace repo; as of 2026-08-08 that marketplace is skill-only and no longer consumes it, so this artifact is currently unused pending a decision to retire it. It is still attached to GitHub releases by release:draft and excluded from the .mcpb via .mcpbignore.

Failure Contracts

These are easy to get wrong from reading the call sites alone:

  • makePinMeToRequest() never throws and never returns null. It returns an ApiResult<T> discriminated union (src/errors.ts): { ok: true, data } or { ok: false, error }. Narrow on ok before touching data; failures are also logged to stderr.
  • makePaginatedPinMeToRequest() returns a three-element tuple: [data[], areAllPagesFetched, lastError]. Destructuring only the first two silently drops the error. areAllPagesFetched: false means pagination broke off partway, so partial data alongside a non-null lastError is the expected shape — not an empty dataset.
  • Insights tools default to total aggregation and none comparison. This is deliberate, for token efficiency — don't "helpfully" change the defaults to time series.

Protocol Notes

  • Don't override the SDK's initialize or server/discover handlers. Capabilities are derived from what createMcpServer() registers. A previous hand-written initialize override advertised a resources capability this server never implemented. serveStdio(() => createMcpServer()) selects the protocol era and uses the SDK handlers for both openings.
  • Client identity is resolved per request in PinMeToMcpServer._userAgent(context), never written to axios.defaults. Modern requests read clientInfo from ctx.mcpReq.envelope[CLIENT_INFO_META_KEY]; legacy requests fall back to the identity captured by initialize. Every tool path that calls PinMeTo must pass its handler context through the request helpers.
  • Server identity is era-specific on the wire. Legacy clients receive serverInfo in the initialize result. Modern clients receive it in _meta['io.modelcontextprotocol/serverInfo'] on every response. The SDK stamps the same Implementation object in both cases, including description and websiteUrl; do not add custom handshake handlers to move or gate those fields.
  • The MCP SDK is v2 (@modelcontextprotocol/server) with Zod 4. Do not go back to @modelcontextprotocol/sdk 1.x. The v1 line ended at 1.30.0 and emits JSON Schema draft-07 on every tool schema with no opt-out (typescript-sdk#2084); Claude Desktop rejects that dialect on outputSchema, which broke every tool call for customers (PinMeTo/issues#6064). v2 emits 2020-12, and tests/mcp_server.test.ts pins that dialect. Tool handler content blocks need type: 'text' as const; v2's result types no longer accept a widened string.
  • MCP Sampling, Roots, and Logging are deprecated as of MCP 2026-07-28. Sampling support was removed in v4.0.0 — no client our customers use implemented it. Don't reintroduce them. Log to stderr (already the convention here); that is the recommended replacement for the Logging feature.
  • "Sampling" in this codebase now means review subsetting only (applySamplingStrategy, samplingStrategy, samplingNote) — choosing which reviews to analyze. It has nothing to do with MCP Sampling. Keep samplingNote for messages about which reviews were analyzed (subset strategy, partial store failures); use analysisNote for messages about what analysis was performed.
  • Cached responses must carry the same warningCode as the fresh response they stand in for. InsightsCacheEntry stores it for exactly this reason — the insights cache key includes analysisType and samplingStrategy, so a dropped warning makes the second identical request look cleaner than the first.
  • warningCode reports the single most actionable condition, not the most severe. LARGE_DATASET_WARNING and INCOMPLETE_DATA outrank UNDIFFERENTIATED_ANALYSIS_TYPE because callers key off the first two to decide whether to re-call. Secondary context belongs in analysisNote (top level when the response has no metadata, e.g. the confirmation paths) rather than displacing the code.
  • pinmeto_get_google_review_insights only differentiates summary and comparison. performStatisticalAnalysis() populates only summary; performStatisticalLocationComparison() adds locationComparison. Nothing populates themes, issues, or trends, and the themes parameter is ignored. Those analysisType values are accepted and flagged with UNDIFFERENTIATED_ANALYSIS_TYPE. If you implement real extraction, remove the flag and the description caveat together.

Testing

Tests use Vitest with axios mocking. When writing tests:

  • Mock axios for all API interactions
  • Set required environment variables in beforeAll
  • Use StdioServerTransport to simulate MCP protocol messages
  • Test both success paths and error handling

Session Completion

When ending a work session, work is NOT complete until git push succeeds.

  1. Run quality gates (if code changed) - Tests, linters, build
  2. Add a changeset (if not already present) - npx changeset add or --empty
  3. Push and create PR:
    # Feature branch (normal case):
    git push -u origin <branch-name>
    gh pr create --title "..." --body "..."
    
    # Main (only for documentation-only changes with user approval):
    git pull --rebase
    git push
    git status  # MUST show "up to date with origin"
  4. Clean up - Clear stashes, prune remote branches
  5. Verify - All changes committed AND pushed

Critical rules:

  • Work is NOT complete until git push succeeds
  • NEVER push directly to main for code changes - use feature branches and PRs
  • Documentation-only changes MAY go to main with explicit user approval
  • Always ask the user before any direct main branch operations

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.