Skip to content
MCP ThesaurusMCP Thesaurus

publicdata kr

CommunityGood70/100Claim

nuget FieldCure.Mcp.PublicData.KrstdioMITupdated 3mo ago

Korean public data API gateway. A Model Context Protocol (MCP) server that lets any MCP client discover, inspect, and call 80,000+ APIs on data.go.kr β€” weather, real estate, business registration, air quality, transit, and more. Built with C# and the official MCP C# SDK.

SourceWebsiteDocs

What can you do with publicdata kr?

FieldCure MCP PublicData.Kr

NuGet License: MIT

Korean public data API gateway. A Model Context Protocol (MCP) server that lets any MCP client discover, inspect, and call 80,000+ APIs on data.go.kr β€” weather, real estate, business registration, air quality, transit, and more. Built with C# and the official MCP C# SDK.

Features

  • 3 tools β€” search APIs by keyword, inspect parameters/response fields, call any data.go.kr API
  • Automatic serviceKey injection β€” the API key is added to every request; never leaked to the LLM
  • Lazy key resolution β€” env var β†’ MCP Elicitation β†’ soft-fail chain (no hard-fail on startup). Hosts that support MCP Elicitation can prompt the user for the key on first use; on upstream 401/403 or SERVICE_KEY_IS_NOT_REGISTERED the cached key is invalidated and a re-elicit is attempted (session cap: 2 re-elicits)
  • XML β†’ JSON normalization β€” strips the response/header/body/items wrapper, returns clean JSON
  • Error code mapping β€” translates data.go.kr error codes into Korean guidance messages the LLM can relay directly
  • SSRF protection β€” domain whitelist limits calls to approved government hosts
  • EUC-KR support β€” legacy encoding from older government APIs is auto-detected and converted
  • Stateless β€” no cache, no database, no local files; every call is independent
  • Stdio transport β€” standard MCP subprocess model via JSON-RPC over stdin/stdout

Installation

dotnet tool install -g FieldCure.Mcp.PublicData.Kr

After installation, the fieldcure-mcp-publicdata-kr command is available globally.

From source

git clone https://github.com/fieldcure/fieldcure-mcp-publicdata.git
cd fieldcure-mcp-publicdata
dotnet build

Prerequisites

  1. Sign up at data.go.kr and get your API key (data.go.kr νšŒμ›κ°€μž… ν›„ 인증킀 λ°œκΈ‰)
  2. Subscribe to λͺ©λ‘μ‘°νšŒμ„œλΉ„μŠ€ (Required) β€” discover_api and describe_api depend on this API (discover_api, describe_api 도ꡬ가 이 APIλ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€)
  3. Subscribe to each individual API you want to query (μ‘°νšŒν•˜λ €λŠ” κ°œλ³„ API도 각각 ν™œμš©μ‹ μ²­ ν•„μš”)

Requirements

Authentication

This server requires a data.go.kr API key (곡곡데이터포털 인증킀). Key resolution is lazy (on first tool call) and follows the FieldCure MCP Credential ADR:

  1. Environment variable β€” DATA_GO_KR_API_KEY (canonical) or PUBLICDATA_API_KEY (legacy alias)
  2. MCP Elicitation β€” if no env var is found, the server requests the key interactively on the first tool call (requires a client that supports MCP Elicitation β€” e.g. Claude Code β‰₯ 2.1.76, AssistStudio). The resolved key is cached in process memory for the session lifetime and is never written to disk by the server.
  3. Soft-fail β€” if both paths fail, tools/list still works and tool calls return a structured error message asking the user to set the env var.

--api-key <value> is also accepted as a CLI arg but is intended for manual testing only, not as a supported configuration path.

Setup by host

Claude Code / Claude Desktop β€” add the key to your MCP config:

{
  "mcpServers": {
    "publicdata-kr": {
      "command": "fieldcure-mcp-publicdata-kr",
      "env": {
        "DATA_GO_KR_API_KEY": "<your-key>"
      }
    }
  }
}

On Claude Code (β‰₯ 2.1.76), if the env var is omitted the server prompts for the key via Elicitation on first use.

AssistStudio β€” the key is requested via Elicitation on first use and stored in Windows PasswordVault for subsequent launches; the host then injects it as an env var when starting the server.

Docker / CI β€” pass the key as a standard environment variable:

docker run -e DATA_GO_KR_API_KEY=<your-key> ...

Key validation and re-elicitation

If the server receives an HTTP 401/403 or a resultCode=22 / SERVICE_KEY_IS_NOT_REGISTERED_ERROR body from data.go.kr, it invalidates the cached key and re-requests via Elicitation (session cap: 2 re-elicits per ApiKeyResolver lifetime). After exhausting retries, the tool returns a soft-fail error message.

Note: On data.go.kr an HTTP 401 can mean either an invalid key or an API that you have not applied for (ν™œμš©μ‹ μ²­). If a re-elicitation prompt appears right after calling an API you haven't subscribed to, entering the same key will produce the final error envelope with details β€” at that point visit the API's data.go.kr page and apply for access.

Configuration

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "publicdata-kr": {
      "command": "fieldcure-mcp-publicdata-kr",
      "env": {
        "DATA_GO_KR_API_KEY": "YOUR_DATA_GO_KR_API_KEY"
      }
    }
  }
}

Claude Code (v2.1.76+)

claude mcp add publicdata-kr -- fieldcure-mcp-publicdata-kr

Claude Code supports MCP Elicitation, so DATA_GO_KR_API_KEY may be omitted β€” the server will prompt for the key on first tool use.

VS Code (Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "publicdata-kr": {
      "command": "fieldcure-mcp-publicdata-kr",
      "env": {
        "DATA_GO_KR_API_KEY": "YOUR_DATA_GO_KR_API_KEY"
      }
    }
  }
}

From source (without dotnet tool)

{
  "mcpServers": {
    "publicdata-kr": {
      "command": "dotnet",
      "args": [
        "run",
        "--project", "C:\\path\\to\\fieldcure-mcp-publicdata\\src\\FieldCure.Mcp.PublicData.Kr"
      ],
      "env": {
        "DATA_GO_KR_API_KEY": "YOUR_DATA_GO_KR_API_KEY"
      }
    }
  }
}

AssistStudio

Install the dotnet tool first. AssistStudio does not auto-install external MCP servers (only built-in ones are managed via the AssistStudio auto-update path). The fieldcure-mcp-publicdata-kr command must be on PATH before you add the server, otherwise the connection fails with a generic "server shut down unexpectedly" message.

dotnet tool install -g FieldCure.Mcp.PublicData.Kr
# later, to upgrade:
dotnet tool update -g FieldCure.Mcp.PublicData.Kr

Then: Settings > MCP Servers > Add Server:

Field Value
Name PublicData.Kr
Command fieldcure-mcp-publicdata-kr
Arguments (empty)
Environment DATA_GO_KR_API_KEY = your data.go.kr API key (optional β€” AssistStudio can prompt via Elicitation if unset)
Description (auto-filled on first connection)

Tools

Tool Description
discover_api Search data.go.kr APIs by keyword β€” returns names, providers, endpoint URLs
describe_api Get operations, request parameters, and response fields for a specific API
call_api Call any data.go.kr API with automatic serviceKey injection and response normalization

Workflow

1. discover_api("λ―Έμ„Έλ¨Όμ§€")
   β†’ { serviceId: "15073861", serviceName: "ν•œκ΅­ν™˜κ²½κ³΅λ‹¨_에어코리아_λŒ€κΈ°μ˜€μ—Όμ •λ³΄", ... }

2. describe_api("15073861")
   β†’ { operations: [{ name: "getMsrstnAcctoRltmMesureDnsty", url: "...", requestParameters: [...] }] }

3. call_api(url: "http://apis.data.go.kr/B552584/ArpltnInforInqireSvc/getMsrstnAcctoRltmMesureDnsty",
            params: '{"stationName": "μ’…λ‘œκ΅¬", "dataTerm": "DAILY", "returnType": "json"}')
   β†’ { totalCount: 24, items: [{ stationName: "μ’…λ‘œκ΅¬", pm10Value: "45", ... }] }

discover_api

Search Korean public data APIs on data.go.kr by keyword. Results are deduplicated by service β€” each API appears once even if it has multiple operations.

Parameter Type Required Description
query string Yes Search keyword (e.g., λ―Έμ„Έλ¨Όμ§€, 뢀동산, μ‚¬μ—…μž)
page int β€” Page number (default: 1)
pageSize int β€” Results per page (default: 10, max: 50)

describe_api

Get the request parameters and response fields of a specific API. Use the serviceId from discover_api results.

Parameter Type Required Description
serviceId string Yes Service ID (list_id) from discover_api

call_api

Call a Korean public data API. The serviceKey is automatically injected β€” never pass it yourself. If the call fails with ACCESS_DENIED, the user needs to apply for access to that specific API at data.go.kr.

Parameter Type Required Description
url string Yes Full endpoint URL from describe_api results
params string β€” Query parameters as a JSON string (not a raw object), e.g. '{"stationName":"μ’…λ‘œκ΅¬","dataTerm":"DAILY"}'. Parameter names must come from describe_api's request_parameters β€” do not guess.
maxResults int β€” Max items to return (default: 20, prevents context overflow)

Error Code Mapping

When a data.go.kr API returns an error, the server translates it into a Korean guidance message the LLM can relay directly:

Code Meaning LLM receives
12 NO_OPENAPI_SERVICE 이 APIκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. discover_api둜 λ‹€μ‹œ κ²€μƒ‰ν•΄λ³΄μ„Έμš”.
20 ACCESS_DENIED 이 API에 λŒ€ν•œ ν™œμš©μ‹ μ²­μ΄ ν•„μš”ν•©λ‹ˆλ‹€. (포털 링크 포함)
22 KEY_NOT_REGISTERED API ν‚€κ°€ λ“±λ‘λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.
30 TRAFFIC_EXCEEDED 일일 호좜 ν•œλ„λ₯Ό μ΄ˆκ³Όν–ˆμŠ΅λ‹ˆλ‹€.
31 UNREGISTERED_IP 이 IPκ°€ λ“±λ‘λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

Environment Variables

Variable Required Default Description
DATA_GO_KR_API_KEY β€” β€” data.go.kr API key (인증킀). If unset, the server requests it via MCP Elicitation on first tool call.
PUBLICDATA_API_KEY β€” β€” Legacy alias for DATA_GO_KR_API_KEY. Still accepted; prefer the canonical name for new setups.
PUBLICDATA_TIMEOUT_SECONDS β€” 30 Per-request timeout
PUBLICDATA_MAX_RESPONSE_LENGTH β€” 50000 Maximum response body length in characters

CLI args (--api-key, --timeout, --max-response-length) override environment variables and are intended for manual testing only β€” DATA_GO_KR_API_KEY and Elicitation are the supported paths.

Naming note: the API key follows the external service naming convention (DATA_GO_KR_API_KEY), while server-local configuration uses the PUBLICDATA_ prefix. This keeps the key aligned with data.go.kr's own documentation so users don't have to configure it twice, while local tunables stay grouped under a single package namespace.

Security

  • API key masking β€” the serviceKey is replaced with *** in any error output visible to the LLM
  • Domain whitelist β€” call_api only allows requests to approved hosts: api.odcloud.kr, apis.data.go.kr, api.data.go.kr, openapi.data.go.kr, www.law.go.kr, open.neis.go.kr
  • Response size limit β€” configurable via PUBLICDATA_MAX_RESPONSE_LENGTH (default: 50,000 chars)
  • No log leaks β€” the API key is never printed to stdout or stderr

Project Structure

src/FieldCure.Mcp.PublicData.Kr/
β”œβ”€β”€ Program.cs                       # MCP server entry point (stdio); no startup hard-fail
β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ ApiKeyResolver.cs            # env var β†’ MCP Elicitation β†’ soft-fail chain + cache + retry cap
β”‚   β”œβ”€β”€ InvalidApiKeyException.cs    # Signals upstream auth rejection (HTTP 401/403 or body error)
β”‚   β”œβ”€β”€ KeyedCall.cs                 # Tool-side resolve β†’ run β†’ invalidate β†’ retry helper
β”‚   β”œβ”€β”€ PublicDataHttpClient.cs      # HTTP proxy with serviceKey injection + auth-error detection
β”‚   β”œβ”€β”€ DomainWhitelist.cs           # SSRF prevention via host whitelist
β”‚   β”œβ”€β”€ ResponseNormalizer.cs        # XMLβ†’JSON conversion, wrapper removal
β”‚   └── ErrorCodeMapper.cs           # Error code β†’ Korean guidance messages
└── Tools/
    β”œβ”€β”€ DiscoverApiTool.cs           # discover_api
    β”œβ”€β”€ DescribeApiTool.cs           # describe_api
    └── CallApiTool.cs               # call_api

Development

# Build
dotnet build

# Test
dotnet test

# Pack as dotnet tool
dotnet pack src/FieldCure.Mcp.PublicData.Kr -c Release

See Also

Part of the AssistStudio ecosystem.

License

MIT