← Back to Blog

2026-09-22 • Updated 2026-09-26 • 7 min read • Connect

How to Give an AI Agent Access to Your GitHub Repository With MCP

Add a public or private GitHub repo to an MCP server so your AI agent cites real files and functions. Set it up without code and test it in minutes.

To give an AI agent access to your GitHub repository with MCP, index the repository into an MCP server and connect that server to the agent. Context MCP Studio does this without code: you paste the GitHub URL, choose code example lookup, and deploy a hosted server. Claude, Cursor, Windsurf, or Codex can then search your README, markdown, and source files and cite the exact file. The agent reads the repository. It cannot push, commit, or open pull requests.

By the end of this guide you will have a server built from one repository, connected to your agent, and a quick test that shows whether its answers come from your code. Private repositories work too, behind an access token.

What the agent can see in your repository

It sees the indexed text of the repo, and every answer links to a file. MCP Studio reads the README, markdown files, and source files, then splits them into passages the agent can search. When the agent asks how something works, it receives the matching passages and a link to the file on GitHub, so you can open it and read around the answer.

It cannot change anything. The agent gets search and retrieval over the indexed files, which refresh automatically once a day. It never gets write access.

This guide follows one example. A repository called billing-webhooks contains a function named verifySignature in src/webhooks.ts, and its README says that signatures are checked against the raw request body. A good answer names both details and cites one of those two files, rather than a plausible function that does not exist, as described in Vibe coding and the function that does not exist.

Public and private repositories

A public repository is just a URL. Paste it into the wizard and it is added immediately.

A private repository needs GitHub sign-in, and it makes the server private. When you paste a private repo URL, MCP Studio notices it cannot read it publicly and asks you to sign in with GitHub or link your GitHub account. It checks that your account can read the repo before creating the source. The GitHub token is stored server-side, never shown in the browser, and used only to read the repository.

From that moment every request to the server must carry an access token, including the request that lists its tools. Tokens start with mcps_live_ and work for one server only. The server stays private while the private repository is connected. The private servers guide covers creating and revoking tokens.

How to build the server in MCP Studio

MCP Studio is the no-code MCP server builder on Appa Tools, and it hosts the server for you.

  1. Open the wizard. The wizard itself takes about a minute.
  2. Name it for the repo. billing-webhooks is a label you will recognize in your agent's server list.
  3. Paste the GitHub URL. For a private repo, sign in with GitHub when the wizard asks. That sign-in is what lets MCP Studio read the files.
  4. Choose at least three tools. Get Code Examples (get_code_examples) and Search Documentation (search_docs) cover most questions about a codebase. Extract Schema & Types (extract_schema) helps when the repo defines data models, and Find API Reference (find_api_reference) helps when it also holds an API spec.
  5. Deploy and wait until indexing finishes. A large repository takes longer than the wizard, and it keeps indexing if you close the page.

The MCP Studio wizard, showing a source added and ready to deploy

Copy the server URL from the setup page:

https://appatools.com/mcp-studio/api/mcp/your-server-name

How to connect it to your agent

For a public server, add the URL to your client's MCP settings. The exact location for Cursor, Claude Desktop, and Windsurf is in Connect to AI tools.

For a private server, the token has to travel with every request in an Authorization header. Cursor, Windsurf, and VS Code take a headers field beside the URL, and Give Cursor access to your private documentation walks through it. In Codex, put the token in an environment variable and name that variable in bearer_token_env_var, as shown in Connect an MCP server to Codex.

How to check that it works

Ask about something you know is in the tree.

How is a billing webhook signature verified?

The answer should name verifySignature and the raw request body. Open the citation. It should be src/webhooks.ts or the README, not a blog post that happens to mention webhooks.

Ask for something the repository does not contain. When nothing matches, the server says so first.

You: Where is the function that sends the office wifi password?

Assistant: Nothing in this server's content covers an office wifi password. The closest material is webhook signature verification, which is a different subject. You would need to add that document as a source.

Look for the tool call. If the agent describes a helper that is not in the tree, indexing may be unfinished or the client never called the server. Check for a tool call before you blame the repository.

Repositories and published docs together

A repository and your published documentation answer different questions. The limit or policy belongs in the docs, and the working sample belongs in the repo. You can put both on one server when you test each separately, as described in Create an MCP server from multiple sources. The API version of this setup is Connect your API documentation to an AI agent.

Disconnecting a source deletes everything indexed from it, and re-adding it starts a fresh index. Other sources on the server stay as they are.

Frequently asked questions

Can an AI agent read my private GitHub repository?

Yes, if you add it to a private MCP server. MCP Studio asks you to sign in with GitHub, confirms your account can read the repo, and then makes the server private so every request needs an access token. Only people you give a token to can query it.

Can the agent change my code or push to GitHub?

No. The server indexes the text of your repository for search and retrieval only. It cannot commit, push, open pull requests, or edit issues, and the GitHub token is used only to read the repository.

Do I need to write code to connect a GitHub repo to Claude or Cursor?

No. You paste the repository URL into the MCP Studio wizard, pick the tools, and deploy. Then you add the server URL to Claude, Cursor, Windsurf, or Codex, plus an access token if the repository is private.

How does the agent see new commits?

Sources refresh automatically once a day, and files that have not changed are skipped. After a large change you can press Refresh on the source in the dashboard to re-index it sooner.

Can I make the server public again after adding a private repo?

Not while the private repository is connected. To reopen the server, disconnect the private source first, which permanently deletes everything indexed from it.

Connect a repository with MCP Studio

Paste one GitHub URL into MCP Studio, choose Get Code Examples, and deploy. The wizard takes about a minute and needs no code. Then ask your agent for a function you know is in the tree and open the file it cites: connect a repository.

Where to go next