mcp-forge

Guide

How to turn HTTP and GraphQL APIs, SQL and NoSQL databases into tools that Claude and other AI agents can call, with an example for each step. Every example works on a fresh install.

Install and first run

Install with one command (other options are on the home page):

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/jaydip187/mcp-forge/releases/latest/download/mcp-forge-installer.sh | sh
mcp-forge --version

Start the server:

mcp-forge serve

Open http://127.0.0.1:7410. On first run there is no account yet, so the server prints a one-time setup code in its log:

no accounts yet: … setup code ABCD-EFGH-JKLM

Enter the code in the browser with a username and password to create the first account. Data lives in ~/.mcp-forge; change it with --data-dir.

Next, click New project (or + next to Projects in the sidebar) and create a project called github. A project is one MCP server: agents connect to http://127.0.0.1:7410/mcp/github and see that project's tools.

Working in the web UI

Each project has tabs: Tools, Specs, Auth, Databases, Context, Quality, Calls, Audit log, Connect and Settings.

The Tools tab of the github project: its MCP URL with a Copy button, the project tabs, and three tools, get_repo, get_user and list_issues, each with its method, path and description and an on switch.
The github project's Tools tab. The URL at the top is what agents connect to; each switch hides or shows a tool.

Creating something always works the same way. New tool on the Tools tab, or Add on the Auth, Databases and Context tabs and New key on Connect, opens a dialog with numbered steps:

  • Next checks the step against the server before moving on. If something is wrong, the dialog stays on that step, marks the field and lists what to fix, for example “Name: must be 1–64 characters of a-z, A-Z, 0-9, _ or -”. A name that's already taken is caught there too.
  • Click a step number to go back; jumping ahead checks the steps in between. Enter moves to the next step.
  • The last step has the save button. If saving still finds a problem, the dialog opens the step that has it.
  • A click outside the dialog doesn't close it, so a half-filled form isn't lost. Press Esc or Cancel to leave.

Edit opens the same dialog with the current values. Tools are the exception: once created, a tool has its own page with every section one under another and the Test console beside it, so you can change a description and try it straight away.

Scripts can run the same checks: POST a body to …/check instead of creating it (see CLI reference).

Example: a GitHub API tool

Goal: let an agent answer "How many stars does rust-lang/rust have?" without handing it the whole GitHub API.

In the github project, click New tool → HTTP request. A dialog walks you through the tool one step at a time:

The New HTTP tool dialog on step 1 of 5, What the agent sees, with the name get_repo and the description filled in, and the steps Request, Parameters, Body and Response listed along the top.
Step 1 of 5: the name and description are what an agent reads when it decides which tool to call.
StepFill in
What the agent seesName get_repo, description “Look up a GitHub repository: stars, language, open issues.”
RequestMethod GET, base URL https://api.github.com, path /repos/{owner}/{repo}
ParametersNothing to do: owner and repo were added from the path
BodyNothing for a GET
ResponseOptionally, a response shape (below)

Next checks each step against the server before moving on. A bad name or URL is caught on the step where you typed it, with the field marked, instead of when you save. Databases, auth configs, resources, prompts and access keys open in the same kind of dialog from an Add button on their tab.

Each {placeholder} in the path becomes a required parameter, so the agent sees owner and repo. Values are percent-encoded, so an agent can't sneak in /, ? or ...

Shape the response

GitHub returns about a hundred fields. Add a Response shape, a jq expression applied before the agent sees anything:

{name: .full_name, stars: .stargazers_count, language, open_issues: .open_issues_count}

Click Create tool. You land on the tool's page; try it in the Test console with owner = rust-lang and repo = rust. Agent sees shows exactly what an agent will get back, for example:

The get_repo tool page with the Test console beside it: owner rust-lang and repo rust filled in, a 200 OK and Shaped badge, and Agent sees showing name, stars, language and open_issues.
A real run of get_repo. Shaped means the response shape ran: of about a hundred fields, the agent gets four.
{
  "name": "rust-lang/rust",
  "stars": 122307,
  "language": "Rust",
  "open_issues": 12657
}
The response shape runs before the agent sees anything, so the other fields never cost it a token.

Numbers here are illustrative. A few more jq shapes that work well: .items[] | {id, title} to keep two fields of every list item, .items[:10] to keep the first ten, and del(.metadata) to drop one noisy field.

Import a spec, Postman, HAR or curl

When an API publishes an OpenAPI 3.x or Swagger 2.0 description, import it instead of typing each tool. The public Swagger Petstore makes a good first try.

  1. Create a project called petstore and open its Tools tab.
  2. Click Import and paste https://petstore3.swagger.io/api/v3/openapi.json, or upload a JSON or YAML file.
  3. Filter the operations by tag, path or method, and tick the ones you want. Fewer, well-described tools work better than hundreds.
  4. Click Import. Each operation becomes a tool with typed parameters taken from the spec.
  5. Rename tools, rewrite descriptions for the model, hide parameters or give them fixed values, and add response shapes, just like a hand-made tool.

When the API changes, import the spec again from the Specs tab. mcp-forge matches operations to the tools they created and shows what will change before it changes anything. Fields you edited by hand are kept.

Postman collections, HAR files and curl commands

These are converted to an OpenAPI document first, then imported like a spec, with the same preview, filters and re-import:

  • Postman collections (v2.0 and v2.1): folders become tags, request names become tool names, collection variables with values are filled in, and :id path segments become parameters.
  • HAR files (browser dev tools → Network → Save all as HAR): only API calls are kept, repeats of the same endpoint merge, and id-like path segments such as /users/42 become parameters.
  • curl commands: paste one or several. -X, -H, -d, --json, -G, -u and -F are understood.

Cookies, Authorization and other secret-looking headers never carry over; they become suggested auth configs instead. Example values from request bodies are dropped, and only their shape is kept.

Auth and secrets

mcp-forge never stores secret values. Auth configs and database connections hold a reference, resolved each time a tool runs:

ReferenceWhere the value comes from
env:NAMEEnvironment variable NAME of the mcp-forge process, or of the MCP client when it runs mcp-forge over stdio.
keyring:NAMEYour OS keychain, service mcp-forge, account NAME: macOS Keychain, Windows Credential Manager or Secret Service on Linux.

A pasted token is rejected. Secret values are redacted from errors, URLs, the test console and the audit log.

Example: a GitHub token

# macOS and Linux
export GITHUB_TOKEN=ghp_...
mcp-forge serve

# Windows PowerShell
$env:GITHUB_TOKEN = "ghp_..."
mcp-forge serve

On the project's Auth tab, click Add auth config and create one named github of type Bearer token with reference env:GITHUB_TOKEN, then pick it in the Auth field of get_repo. Three kinds are available:

  • Bearer token sends Authorization: Bearer <secret>.
  • API key sends the secret as a header or query parameter with the name you choose, such as X-API-Key.
  • Basic sends a username with the secret as the password.

OAuth2

For APIs that hand out tokens through OAuth2, such as Google, Microsoft, Salesforce or Auth0, two more types are available. The client secret is a reference like any other secret.

  • OAuth2: sign in (authorization code) acts as a person. Fill in the authorization URL, token URL, client ID and scopes, register the redirect URL the dialog shows (http://127.0.0.1:7410/oauth/callback by default) with the provider, save, and click Connect in the list. PKCE is always used.
  • OAuth2: client credentials is for service accounts: token URL, client ID, scopes and an optional audience. There's no sign-in step.

mcp-forge sends the access token as a bearer token, refreshes it shortly before it expires, and retries once with a fresh token if the API answers 401. Sign-in tokens are stored encrypted with secret.key in the data directory; keep that file with the database. Tokens never appear in the UI, exports or logs.

Example: a GraphQL query

A GraphQL tool is one fixed query or mutation. Click New tool → GraphQL query or mutation, set the endpoint to https://api.github.com/graphql with the github auth config, and write the document:

query User($login: String!) {
  user(login: $login) {
    name
    bio
  }
}

Each $variable becomes an argument, and String! makes login required. Add a description for each so the agent knows what to pass. Values are sent as GraphQL variables, never pasted into the document.

  • Queries are marked read-only. Mutations are marked as changing data, and a read-only project hides them.
  • A response with errors fails the call with each message and its path, plus any partial data.
  • Auth configs, OAuth2, timeouts, response shapes and approvals work as for HTTP tools.

To offer a whole API, use Import: give the endpoint and mcp-forge sends the standard introspection query, or upload the schema as SDL or a saved introspection result. Each query and mutation field becomes a tool with a generated selection set, three levels deep.

Example: a safe SQL query

Goal: let a support agent look up a customer's recent orders in a PostgreSQL shop database, and nothing else.

1. Point mcp-forge at the database

Ideally use a login that may only SELECT. Put its connection string in an environment variable:

export SHOP_DB_URL='postgres://readonly:PASSWORD@db.example.com:5432/shop'
mcp-forge serve
DatabaseValue of the variable
PostgreSQLpostgres://user:PASSWORD@host:5432/db
MySQLmysql://user:PASSWORD@host:3306/db
SQLite/path/to/shop.db
SQL Servermssql://user:PASSWORD@host:1433/db (ADO.NET and JDBC strings work too; add ?trust_server_certificate=true for self-signed certificates)
ClickHousehttps://user:PASSWORD@host:8443/db (the HTTP interface; every query is sent with readonly=2)

On the Databases tab, click Add database. The dialog has three steps: the connection, its limits and privacy settings, and what agents may do. Create a connection named shop with driver PostgreSQL and reference env:SHOP_DB_URL. Click Test: it shows the server version, the login, and whether that login can change data.

2. Publish a saved query

On the Tools tab, click New tool → SQL query, name it recent_orders, choose the shop connection and enter one statement:

SELECT id, status, total
FROM orders
WHERE customer_id = :customer_id
ORDER BY id DESC

:customer_id becomes an argument. Set its type to integer and mark it required. Types can be string, integer, number or boolean, optionally with a list of allowed values. Values are always sent separately from the SQL, never pasted into it, so SQL injection through arguments isn't possible.

3. What the agent gets

{
  "columns": ["id", "status", "total"],
  "rows": [[1042, "shipped", 59.90], [1017, "delivered", 12.50]],
  "truncated": false
}
Values ride next to the SQL, never inside it, so there is nothing to inject into.

truncated turns true when the connection's row limit (100 by default) cut the result short.

Let agents explore a database

Saved queries cover known questions. For open-ended ones, turn on Agent tools for the connection on the Databases tab. Three tools appear, prefixed with the connection name:

  • shop_list_tables lists the tables and views the agent may use.
  • shop_describe_table shows columns, types, keys and which columns are masked.
  • shop_run_sql runs one statement the agent writes itself.

Narrow what they can reach:

  • Tables agents may explore: for example orders and customers. Empty means every non-system table. System catalogs are always off limits.
  • Masked columns: for example users.password_hash or *.email. Their values come back as [masked], and agent-written SQL can't select, filter on or compute with them.

Agent-written SQL is parsed before it runs. Exactly one statement is allowed, writes hidden in CTEs are refused, and dangerous functions such as pg_read_file, dblink, SLEEP or LOAD_FILE are blocked. Reads run in a read-only transaction with a time limit and are always rolled back.

Allowing writes

Connections are read only until you change What agents may do:

Access modeSaved queriesAgent run_sql
Read only defaultreadread
Saved writesread and writeread
Full accessread and writeread and write

Example: mark an order as shipped

With the connection on Saved writes, create a saved query ship_order:

UPDATE orders SET status = 'shipped' WHERE id = :order_id

Write tools take an extra dry_run argument. With dry_run: true the statement runs, reports the count and is undone:

// ship_order({"order_id": 1042, "dry_run": true})
{"columns": [], "rows": [], "truncated": false,
 "affected_rows": 1, "committed": false, "dry_run": true}

Safety rails on every write:

  • It runs in a transaction and is undone if it changes more rows than allowed (Most rows one write may change, 100 by default).
  • UPDATE and DELETE need a WHERE clause. Write WHERE true if you really mean every row.
  • Schema changes (CREATE, ALTER, DROP, TRUNCATE) also need Allow schema changes. Admin statements such as GRANT, SET or COPY never run.
  • The Audit tab lists every write: tool, caller, SQL, values, rows, and whether it was committed, undone or failed.

NoSQL databases

MongoDB, Redis, DynamoDB and Elasticsearch connections are added on the same Databases tab, with the same access modes, allowed names, masks and limits as SQL:

DatabaseValue of the variable
MongoDBmongodb://reader:PASSWORD@host:27017/shop (the database name is required)
Redisredis://:PASSWORD@host:6379/0 (rediss:// for TLS)
DynamoDBdynamodb://ACCESS_KEY_ID:SECRET@us-east-1
Elasticsearchhttps://reader:PASSWORD@host:9200 (or ?api_key=KEY; OpenSearch works too)

Example: orders for one customer in MongoDB

Click New tool → NoSQL operation, pick the connection, the operation find and the collection orders, and give the body:

{"filter": {"customer": "{{customer}}", "status": "{{status}}"}, "limit": 20}

Each {{name}} becomes a typed argument. A whole-string "{{name}}" is replaced by the value itself, never by text that could add an operator, and object keys are never filled in. Agents get {documents, truncated}.

  • Only the listed operations run: no EVAL or FLUSHALL, no Elasticsearch scripts, no MongoDB $where, $function, $out or $merge.
  • Writes follow the access mode, are capped by Most items one write may change, can be tried with dry_run, and are listed on the Audit tab.
  • Agent tools work as for SQL: list targets, describe one, and run an operation the agent writes itself.

Resources and prompts

Besides tools, a project can offer things to read and instructions to reuse. Manage both on the Context tab.

Resources

  • Your documents (forge://resources/<name>): Markdown, text, JSON, CSV or YAML written in mcp-forge, such as a style guide, a glossary or a runbook.
  • Database schemas (schema://<connection>): offered while the connection's Describe agent tool is on, limited to the allowed tables, with masks applied.
  • Imported specs, when Share imported specs is on.

Example: a prompt

Click Add prompt. The dialog asks for a name and description, then the template, then the arguments:

Use user_overview for {{login}} and write a {{tone}} two-line summary.

Each {{name}} becomes an argument, added for you when you leave the template step. Claude shows prompts as slash commands; other clients list them under prompts. Try next to a prompt fills it in with sample values, so you see exactly what an agent's app gets.

Chained tools

A chain calls other tools of the project in order and shows up to agents as one tool. Click New tool → Chain of tools. Each step names a tool and computes its arguments with jq over {input, steps, last}: the chain's inputs, every earlier result, and the previous one.

inputs:  login (required)
step 1:  get_user     {login: .input.login}
step 2:  list_repos   {owner: .last.login}
output:  {user: .steps[0].login, repos: [.steps[1][].name]}
  • Every step runs like a normal call, with argument checks, limits, masks and its own entry in the call log.
  • A failing step stops the chain, and the agent is told which step failed and why.
  • Up to 10 steps; chains may call chains three levels deep. Loops, missing tools and jq that doesn't compile are refused when you save.
  • A chain changes data if any step does: read-only projects hide it, and it gets a dry_run argument. If any step needs approval, the chain waits for one approval before it starts.

Description quality

Agents choose tools by their names and descriptions. The Quality tab scores every tool, worst first, with a hint for each problem:

  • missing or very short descriptions, and vague names such as get or tool2;
  • parameters without a description, with a hint that fits the parameter: the format for dates, the range and default for page sizes, where to find an id;
  • parameters that probably take a few fixed values but list none;
  • long responses with no response shape.

The checks run inside mcp-forge. Improve with Claude is optional: put a reference to your Anthropic API key on the Quality tab (env:ANTHROPIC_API_KEY, never the key itself), and each tool with findings gets a button that suggests better wording side by side. Nothing changes until you click Apply.

Approvals

Turn on Require approval for a tool, and agent calls to it wait for a person before anything is sent. New tools start with it on when they can change things, such as HTTP DELETE or SQL that writes.

  • The call appears on the Approvals page with the tool, arguments and client; a badge in the sidebar counts waiting calls. Approve runs it; Deny refuses it.
  • Clients that support it also show Approve and Decline in their own app. Whichever answer comes first wins.
  • No answer within the project's timeout (300 seconds by default) refuses the call. Refused calls never reach your API or database, and the agent is told why.
  • Test console runs don't wait.
Whichever comes first wins: a person's answer, or the timeout refusing the call.

Call log and audit

The Calls tab lists every tool call, from agents and from the test console: when, which tool, OK or error, how long it took, which client or access key, the arguments, and the error the agent was given. Chain calls show each step. Above the list are the error rate, median and 95th-percentile time, and a per-tool breakdown for the last 24 hours, 7 days or 30 days.

  • Arguments whose names look secret, such as password, token or api_key, are stored as [redacted].
  • Calls are kept for 30 days by default (Settings → Call log); 0 stops recording.
  • The Audit log tab records every database write in detail: tool, caller, statement, values, rows, and whether it was committed, undone or failed.

Connect Claude and other clients

Each project's Connect tab has ready-to-copy versions of everything below.

The Connect tab: a Claude Code command and a JSON config for connecting over HTTP, each with a copy button, and below them the Access keys section.
The Connect tab, with the HTTP snippets ready to copy. The stdio versions sit underneath (left out here).

Claude Code

# over HTTP, while mcp-forge serve is running
claude mcp add --transport http github http://127.0.0.1:7410/mcp/github

# over stdio: Claude Code starts mcp-forge itself, no server needed
claude mcp add github -- mcp-forge stdio --project github

Claude Desktop, .mcp.json and other clients

{
  "mcpServers": {
    "github": { "type": "http", "url": "http://127.0.0.1:7410/mcp/github" }
  }
}

Or over stdio:

{
  "mcpServers": {
    "github": { "command": "mcp-forge", "args": ["stdio", "--project", "github"] }
  }
}

Tool edits reach connected clients right away, so you can keep refining descriptions while an agent is connected. Over stdio, edits made in a running UI are picked up within a couple of seconds. If the server has an admin token, HTTP clients must send Authorization: Bearer <token>; the Connect tab adds the header to its snippets.

Now ask Claude "How many stars does rust-lang/rust have?". It calls get_repo and answers from the shaped response.

Access keys

Rather than sharing the admin token, give each client or teammate its own key: Connect → New key. The dialog asks for a name and an expiry, then which tools the key may use. The key is shown once (mcpf_…) and stored only as a hash. Clients send it as Authorization: Bearer mcpf_…; deleting the key cuts them off.

  • On localhost, /mcp stays open unless you switch on Require a key on this machine too.
  • A key limited to some tools only lists and calls those.
  • Apps that support MCP sign-in, such as claude.ai custom connectors, need only the project URL: you sign in on mcp-forge and allow the app for that one project. Connect → Connected apps lists and disconnects them.

Curating large APIs

A big spec can produce hundreds of tools, which crowds an agent's context. The project's Settings help:

  • Read-only mode exposes only GET, HEAD and OPTIONS tools and SQL tools that don't write.
  • Tag and path filters include or hide tools, for example only /repos/**.
  • Tool search lists just two tools, search_tools and call_tool. The agent searches by keyword and calls what it finds.
  • Strip nulls and a maximum response length keep answers short.

The Tools tab says why each hidden tool is hidden.

Share tools as YAML

Export a project to move it to another machine, keep it in git, or review it in a pull request. Secrets stay references, so the file is safe to share.

mcp-forge export --project github -o tools.yaml
mcp-forge import --project github tools.yaml --on-conflict replace

This is what the GitHub tool and the shop query from this guide export as:

version: 1
project:
  name: GitHub
  slug: github
auth_configs:
- name: github
  kind:
    type: bearer
  secret_ref: env:GITHUB_TOKEN
db_connections:
- name: shop
  driver: postgres
  dsn_ref: env:SHOP_DB_URL
  access_mode: read_only
  row_limit: 100
  timeout_ms: 10000
  max_affected_rows: 100
  allow_ddl: false
  table_allowlist: [orders, customers]
  column_masks: ['*.email']
tools:
- name: get_repo
  description: 'Look up a GitHub repository: stars, language, open issues.'
  auth: github
  response_shape: '{name: .full_name, stars: .stargazers_count, language, open_issues: .open_issues_count}'
  kind:
    type: http
    method: GET
    base_url: https://api.github.com
    path_template: /repos/{owner}/{repo}
    params:
    - {name: owner, location: path, required: true, schema: {type: string}}
    - {name: repo, location: path, required: true, schema: {type: string}}
- name: recent_orders
  description: The latest orders for one customer.
  connection: shop
  kind:
    type: sql
    mode:
      type: query
      sql: SELECT id, status, total FROM orders WHERE customer_id = :customer_id ORDER BY id DESC
      params:
      - {name: customer_id, required: true, schema: {type: integer}}

Tools refer to auth configs and connections by name. --on-conflict decides what happens to existing items with the same name: fail (the default), skip or replace. Importing a connection with full access needs --confirm-full-access. The same import and download are under Settings in the UI.

Run it for a team

By default mcp-forge listens on 127.0.0.1:7410 only. To listen on another address you must set an admin token of 16 or more characters:

export MCP_FORGE_ADMIN_TOKEN="$(openssl rand -hex 24)"
mcp-forge serve --bind 0.0.0.0:7410

MCP clients then send Authorization: Bearer <token>, and scripts may use it on /api. Put TLS in front with a reverse proxy, and manage people's accounts on the server:

mcp-forge user add alice          # prompts for a password
mcp-forge user passwd alice       # new password; ends their sessions
mcp-forge user list
mcp-forge user remove alice

Docker

docker build -t mcp-forge .
docker run -d --name mcp-forge -p 127.0.0.1:7410:7410 \
  -v mcp-forge-data:/data \
  -e MCP_FORGE_ADMIN_TOKEN="$(openssl rand -hex 24)" \
  -e GITHUB_TOKEN=ghp_... \
  mcp-forge
docker logs mcp-forge             # shows the first-run setup code

The container runs as an unprivileged user and keeps data in the /data volume. There is no OS keychain inside a container, so pass secrets as environment variables and reference them as env:NAME.

CLI reference

mcp-forge serve  [--bind 127.0.0.1:7410] [--admin-token T] [--data-dir DIR]
mcp-forge stdio  --project SLUG [--data-dir DIR]
mcp-forge export --project SLUG [-o tools.yaml]
mcp-forge import --project SLUG [FILE|-] [--on-conflict fail|skip|replace] [--confirm-full-access]
mcp-forge user add NAME [--password-stdin]
mcp-forge user passwd NAME [--password-stdin]
mcp-forge user list
mcp-forge user remove NAME
Environment variableSame as
MCP_FORGE_BIND--bind
MCP_FORGE_ADMIN_TOKEN--admin-token
MCP_FORGE_DATA_DIR--data-dir
MCP_FORGE_PROJECTstdio --project
RUST_LOGLog level, for example info,mcp_forge=debug. Logs go to stderr.

REST API

The UI uses a REST API under /api; scripts authenticate with the admin token. To validate without saving, POST the same body to …/check: tools/check, auth-configs/check, db-connections/check, resources/check, prompts/check or api-keys/check under /api/projects/{id}/. The answer is 204 when it would save, or 422 listing every problem at once. Add ?id=<item id> when checking an edit, so the item may keep its own name.

Troubleshooting

"environment variable X is not set"
Set it in the environment of the process that runs the tool: the serve process, or for stdio the MCP client that starts mcp-forge.
A client can't connect to /mcp/<project>
Check the project slug on the Connect tab and that mcp-forge serve is running. With an admin token, check that the client sends the Authorization header.
Tools don't show up
They may be turned off or hidden by the project's filters. The Tools tab says why next to each hidden tool.
PostgreSQL says "cannot execute … in a read-only transaction"
The read-only layer stopped a write. Change the connection's access mode if this tool should write.
"binding to non-loopback address … requires --admin-token"
Set MCP_FORGE_ADMIN_TOKEN, or bind to 127.0.0.1.
Lost the setup code or forgot a password
The setup code is printed on every start until the first account exists. Or run mcp-forge user add <name>, or mcp-forge user passwd <name> to reset a password.
Port 7410 is in use
Run mcp-forge serve --bind 127.0.0.1:7420 and use that port in client URLs.

Still stuck? Open an issue with the command you ran and the log output.