CLI and APIs
Connect over MCP
You want your coding agent to read code, open issues, review pull requests and fix CI on the forge, with tools made for that. Connect it to the MCP server of the forge, so it does not guess at shell commands.
4 min read
The MCP server is at /mcp. It gives your agent the same features as the REST API and the src CLI, with the same access rules.
You need an MCP client that supports OAuth. A client without OAuth can use an existing token.
1. Connect your TanStack account
The client signs in at TanStack.com. Find your case:
| Your case | Do this |
|---|---|
| You use the same GitHub account on TanStack.com and Source | Nothing. MCP finds your Source account by its verified GitHub ID. |
| Your accounts use different sign-in methods | Sign in to Source with your method. Open Settings, Connected accounts, choose Connect TanStack, then sign in at TanStack.com. |
| You are new | Choose Continue with TanStack on Sign up, then pick a Source username. |
- With the same GitHub account, your username, repositories and organization memberships stay the same.
- An email match never merges accounts.

Note
If you are signed in to TanStack.com, the TanStack button shows your avatar and Continue as [name] on TanStack. A click still runs OAuth. If the account hint is not available, the button stays Continue with TanStack. Continue with GitHub is a separate choice.
2. Add the server to your client
In an MCP client that supports OAuth, add this Streamable HTTP server:
https://source.tanstack.com/mcp
For Claude Code:
claude mcp add --transport http tanstack-source https://source.tanstack.com/mcp
For another client, use its remote MCP server settings, and choose browser sign-in. The server advertises TanStack.com through OAuth resource discovery.
The client opens TanStack.com in your browser. Check the app and the permissions, then authorize it. The client stores and refreshes its credentials, so you do not make or copy a token.
Important
The client acts as you, with your Source permissions. It can read and change any repository that you can access. For a coding agent with less access, use an agent session token.
3. Check the connection
Ask the client to call whoami. It returns your Source account.
If the client asks you to connect an account, finish step 1, then connect the client again. Link an existing account while you are signed in to that account. An email match does not link accounts.
Done
Your agent calls the tools of the forge as you. MCP tools and rules lists what each tool does, and the rules that the tools follow.
In a client that shows MCP Apps, a pull request, an issue, a CI run or an agent run that the agent reads comes with a live card, with buttons that hand a failure or review threads back to the agent and that start a merge: see See live cards in your agent.
Use an existing token
Personal tokens (tsp_, or the older gfp_) and agent session tokens (tsa_, or the older gfa_) also work. Send the token in the Authorization header:
claude mcp add --transport http tanstack-source https://source.tanstack.com/mcp --header "Authorization: Bearer <token>"
- An agent session is limited to one repository, and expires.
- A personal token has the repositories, the actions and the end time that you chose when you made it.
- A client that does not support OAuth can use either one in the Authorization header.
Revoke access
Open TanStack connected apps, and revoke the client. Source checks each OAuth request with TanStack.com, so the next request fails.
- If you unlink TanStack in Source, these OAuth clients stop too. You cannot unlink your only sign-in method.
- Access tokens last one hour.
- Refresh tokens rotate, and expire 30 days after the first authorization.
- If a client sends an old refresh token again, that grant is revoked.
Account approval
A waiting account can use get_approval_status and redeem_invite through a linked TanStack identity. The other tools that need a login stay blocked until approval. See Get approved and invite someone for invites and the admin tools.